Hi,
I have a problem with the Training .jar installation.
I followed this:
I have this error:
C:\Users\Gabriele.Brentegani\Desktop\Training>java -Dproperties.file=C:\ThingWatcher\components\Microservices-JAR\microservices.properties -jar training-standalone-2.0.0-bin.jar server training-standalone-single.yml
log4j:WARN No appenders could be found for logger (org.jboss.logging).
log4j:WARN Please initialize the log4j system properly.
log4j:WARN See http://logging.apache.org/log4j/1.2/faq.html#noconfig for more info.
INFO [2017-06-30 10:01:36,773] org.eclipse.jetty.util.log: Logging initialized @4166ms
INFO [2017-06-30 10:01:37,023] io.dropwizard.server.DefaultServerFactory: Registering jersey handler with root path prefix: /
INFO [2017-06-30 10:01:37,023] io.dropwizard.server.DefaultServerFactory: Registering admin handler with root path prefix: /
INFO [2017-06-30 10:01:37,023] io.dropwizard.assets.AssetsBundle: Registering AssetBundle with name: swagger for path /swagger/*
INFO [2017-06-30 10:01:37,133] io.dropwizard.assets.AssetsBundle: Registering AssetBundle with name: swagger-assets for path /swagger-static/*
INFO [2017-06-30 10:01:52,634] org.reflections.Reflections: Reflections took 15423 ms to scan 1 urls, producing 108856 keys and 249936 values
ERROR [2017-06-30 10:01:53,076] com.thingworx.analytics.ccc.spring.PropertyDrivenAppContext: Failed to instantiate the context given by [classpath:/spring/job-executor-asynchronous-memory-results.xml, classpath:/spring/service.xml, classpath:/spring/defaultmodelsource.xml, classpath:/spring/modelHea
lthCheck.xml, classpath:/spring/datasource.xml]. Are you sure there's a PropertySourcesPlaceholderConfigurer and NOT a PropertyPlaceholderConfigurer?
Exception in thread "main" org.springframework.beans.factory.BeanDefinitionStoreException: Invalid bean definition with name 'NeuronRestClientAdapter' defined in class path resource [spring/datasource.xml]: Could not resolve placeholder 'dataset.webservices.url' in string value "${dataset.webservice
s.url}"; nested exception is java.lang.IllegalArgumentException: Could not resolve placeholder 'dataset.webservices.url' in string value "${dataset.webservices.url}"
at org.springframework.beans.factory.config.PlaceholderConfigurerSupport.doProcessProperties(PlaceholderConfigurerSupport.java:211)
at org.springframework.context.support.PropertySourcesPlaceholderConfigurer.processProperties(PropertySourcesPlaceholderConfigurer.java:180)
at org.springframework.context.support.PropertySourcesPlaceholderConfigurer.postProcessBeanFactory(PropertySourcesPlaceholderConfigurer.java:155)
at org.springframework.context.support.PostProcessorRegistrationDelegate.invokeBeanFactoryPostProcessors(PostProcessorRegistrationDelegate.java:265)
at org.springframework.context.support.PostProcessorRegistrationDelegate.invokeBeanFactoryPostProcessors(PostProcessorRegistrationDelegate.java:162)
at org.springframework.context.support.AbstractApplicationContext.invokeBeanFactoryPostProcessors(AbstractApplicationContext.java:606)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:462)
at com.thingworx.analytics.ccc.spring.PropertyDrivenAppContext.create(PropertyDrivenAppContext.java:67)
at com.thingworx.analytics.ccc.dropwizard.utils.AnalyticsConfiguration.getApplicationContext(AnalyticsConfiguration.java:51)
at com.thingworx.analytics.ccc.dropwizard.utils.DropwizardBaseApplication.loadConfiguration(DropwizardBaseApplication.java:24)
at com.thingworx.analytics.training.TrainingApplication.register(TrainingApplication.java:57)
at com.thingworx.analytics.training.TrainingApplication.register(TrainingApplication.java:31)
at com.thingworx.analytics.ccc.dropwizard.utils.DropwizardBaseApplication.run(DropwizardBaseApplication.java:54)
at com.thingworx.analytics.ccc.dropwizard.utils.DropwizardBaseApplication.run(DropwizardBaseApplication.java:16)
at io.dropwizard.cli.EnvironmentCommand.run(EnvironmentCommand.java:43)
at io.dropwizard.cli.ConfiguredCommand.run(ConfiguredCommand.java:85)
at io.dropwizard.cli.Cli.run(Cli.java:75)
at io.dropwizard.Application.run(Application.java:79)
at com.thingworx.analytics.training.TrainingApplication.main(TrainingApplication.java:44)
Caused by: java.lang.IllegalArgumentException: Could not resolve placeholder 'dataset.webservices.url' in string value "${dataset.webservices.url}"
at org.springframework.util.PropertyPlaceholderHelper.parseStringValue(PropertyPlaceholderHelper.java:174)
at org.springframework.util.PropertyPlaceholderHelper.replacePlaceholders(PropertyPlaceholderHelper.java:126)
at org.springframework.core.env.AbstractPropertyResolver.doResolvePlaceholders(AbstractPropertyResolver.java:204)
at org.springframework.core.env.AbstractPropertyResolver.resolveRequiredPlaceholders(AbstractPropertyResolver.java:178)
at org.springframework.context.support.PropertySourcesPlaceholderConfigurer$2.resolveStringValue(PropertySourcesPlaceholderConfigurer.java:175)
at org.springframework.beans.factory.config.BeanDefinitionVisitor.resolveStringValue(BeanDefinitionVisitor.java:282)
at org.springframework.beans.factory.config.BeanDefinitionVisitor.resolveValue(BeanDefinitionVisitor.java:204)
at org.springframework.beans.factory.config.BeanDefinitionVisitor.visitGenericArgumentValues(BeanDefinitionVisitor.java:159)
at org.springframework.beans.factory.config.BeanDefinitionVisitor.visitBeanDefinition(BeanDefinitionVisitor.java:85)
at org.springframework.beans.factory.config.PlaceholderConfigurerSupport.doProcessProperties(PlaceholderConfigurerSupport.java:208)
... 18 more
And the microserver didn't stard properly.
My configuration:
microservices.properties:
results.destination.uri=results://localhost:8096/results/models
file.storage.path=C:\Users\Gabriele.Brentegani\Desktop\Training\pippo
results-h2-file.yml
---
appCtx:
- "classpath:/spring/aws-s3nfs.xml"
- "classpath:/spring/service.xml"
database:
driverClass: org.h2.Driver
password: sa
url: "jdbc:h2:file:./model-db"
user: sa
flyway:
baselineDescription: "<< MMS Flyway Baseline >>"
baselineOnMigrate: true
locations:
- /migration
outOfOrder: false
schemas:
- PUBLIC
validateOnMigrate: true
logging:
appenders:
-
target: stdout
threshold: ALL
timeZone: EST5EDT
type: console
level: INFO
loggers:
com.thingworx.analytics.model: INFO
propertyReaderCtx:
- "classpath:/spring/properties-wiring.xml"
server:
adminConnectors:
-
port: 8096
reuseAddress: true
type: http
applicationConnectors:
-
port: 8097
reuseAddress: true
type: http
registerDefaultExceptionMappers: false
swagger:
resourcePackage: com.thingworx.analytics.results
training-standalone-single.yml
---
appCtx:
- "classpath:/spring/job-executor-asynchronous-memory-results.xml"
- "classpath:/spring/service.xml"
- "classpath:/spring/defaultmodelsource.xml"
- "classpath:/spring/modelHealthCheck.xml"
- "classpath:/spring/datasource.xml"
database:
driverClass: org.h2.Driver
password: sa
url: "jdbc:h2:mem:training"
user: sa
flyway:
baselineDescription: "<< Training Microservice Flyway Baseline >>"
baselineOnMigrate: true
locations:
- /migration
logging:
appenders:
-
target: stdout
threshold: ALL
timeZone: EST5EDT
type: console
level: INFO
loggers:
org.apache.spark: WARN
propertyReaderCtx:
- "classpath:/spring/properties-wiring.xml"
server:
adminConnectors:
-
port: 8090
type: http
applicationConnectors:
-
port: 8091
type: http
registerDefaultExceptionMappers: false
swagger:
resourcePackage: com.thingworx.analytics.training
ANY SUGGESTION?? THANKS!!
PS: The Result part works fine:
Solved! Go to Solution.
Hi Maurizio
Glad you made it work but you should try with the empty value. It would work too and much easier to put in place.
You would only set an actual URL if you wanted to train with a dataset already existing in ThingWorx Analytics Server.
For dataset strictly coming through ThingWatcher/anomaly detection, simply leave those properties to an empty value.
Kind regards
Christophe
Hi Maurizio
the microservices.properties file needs some additional properties.
Check https://support.ptc.com/appserver/cs/view/solution.jsp?n=CS264852 for details.
Kind regards
Christophe
...ok and now what I have to put here ??
Thanks
Hi Maurizio
There is no value to add, simply add the properties in the file with an empty value like below:
dataset.webservices.url=
dataset.app.id=
dataset.app.key=
I have updated the article to clarify this point.
Kind regards
Christophe
I tried many url and I found the solution!!!!!!
This is my microservices.properties:
file.storage.path=C:\Users\MyUSERS\Desktop\AnalyticsThingWatcher\ThingWorx-Analytics-ThingWatcher\components\Microservices-JAR\Training
dataset.webservices.url=dataset://localhost:8090/dataset
dataset.app.id=S3Initializer (here I think that works with anything)
dataset.app.key=1234 (here I think that works with anything)
Hi Maurizio
Glad you made it work but you should try with the empty value. It would work too and much easier to put in place.
You would only set an actual URL if you wanted to train with a dataset already existing in ThingWorx Analytics Server.
For dataset strictly coming through ThingWatcher/anomaly detection, simply leave those properties to an empty value.
Kind regards
Christophe
Ok I checked it and the microservers result and training started poperly.
I tried to start an anomaly detection from simulated device by kepserverEX in the new composer, but gave me initializaztion Failed.
I notice this error in training/Healthcheck: (localhost:8091)
"model-destination" : {
"healthy" : false,
"message" : "Could not establish connectivity to: results://localhost:8096/results/models"
},
any suggestion?
Hi Maurizio
Would be good to open a new thread for a new error .. that would make the answers more easily searchable for future people having the same issue.
Regarding this error, do you run the micro services on the same machine as ThingWorx or a different one ?
I would think they are on a different one, but in any case could you replace the occurrences of localhost in microservices.properties with the ip address of the machine on which the micro services run.
then restart the microservices and ThingWorx and try again
Thanks
Christophe