cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - If community subscription notifications are filling up your inbox you can set up a daily digest and get all your notifications in a single email. X

Does anyone know how to use java api to achieve anomaly detection with Thingwatcher8.0?

weli
12-Amethyst

Does anyone know how to use java api to achieve anomaly detection with Thingwatcher8.0?

Please see my code in attachment,the output of my code is:

CALIBRATING

WAT9999E

Unexpected exception. {Throwable=[NullPointerException: }]

Is isAnomalousValue false

ThingWatcherStat FAILED

It indicates after calibrating the thingwatcher failed.

I used jar install to run resut and training Microservices.  I can see log from training microservice

com.thingworx.analytics.training.core.TrainingRunner: Successfully stored PMML to modelUri "Optional[http://192.168.31.202:8090/results/models/1/models.xml]" for jobId "1"

But I see error in result microservice:

INFO  [2017-07-18 00:16:27,791] io.dropwizard.jersey.jackson.JsonProcessingExceptionMapper: Mapping exception: class javax.ws.rs.WebApplicationException

! com.thingworx.analytics.results.db.EntityNotFoundException: Could not retrieve result [1]

! at com.thingworx.analytics.results.db.ResultsModelDAO.lambda$findSpecific$0(ResultsModelDAO.java:67)

! at java.util.Optional.orElseThrow(Unknown Source)

! at com.thingworx.analytics.results.db.ResultsModelDAO.findSpecific(ResultsModelDAO.java:67)

! at com.thingworx.analytics.results.core.ResultsService.findById(ResultsService.java:44)

! at com.thingworx.analytics.results.resources.ModelResource.retrieveModelXml(ModelResource.java:185)

! ... 61 common frames omitted

! Causing: javax.ws.rs.WebApplicationException: Could not retrieve result [1]

! at com.thingworx.analytics.results.resources.ModelResource.retrieveModelXml(ModelResource.java:190)

! at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

! at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)

! at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)

! at java.lang.reflect.Method.invoke(Unknown Source)

! at org.glassfish.jersey.server.model.internal.ResourceMethodInvocationHandlerFactory$1.invoke(ResourceMethodInvocationHandlerFactory.java:81)

! at org.glassfish.jersey.server.model.internal.AbstractJavaResourceMethodDispatcher$1.run(AbstractJavaResourceMethodDispatcher.java:144)

! at org.glassfish.jersey.server.model.internal.AbstractJavaResourceMethodDispatcher.invoke(AbstractJavaResourceMethodDispatcher.java:161)

! at org.glassfish.jersey.server.model.internal.JavaResourceMethodDispatcherProvider$ResponseOutInvoker.doDispatch(JavaResourceMethodDispatcherProvider.java:160)

! at org.glassfish.jersey.server.model.internal.AbstractJavaResourceMethodDispatcher.dispatch(AbstractJavaResourceMethodDispatcher.java:99)

! at org.glassfish.jersey.server.model.ResourceMethodInvoker.invoke(ResourceMethodInvoker.java:389)

! at org.glassfish.jersey.server.model.ResourceMethodInvoker.apply(ResourceMethodInvoker.java:347)

! at org.glassfish.jersey.server.model.ResourceMethodInvoker.apply(ResourceMethodInvoker.java:102)

! at org.glassfish.jersey.server.ServerRuntime$2.run(ServerRuntime.java:326)

! at org.glassfish.jersey.internal.Errors$1.call(Errors.java:271)

! at org.glassfish.jersey.internal.Errors$1.call(Errors.java:267)

! at org.glassfish.jersey.internal.Errors.process(Errors.java:315)

! at org.glassfish.jersey.internal.Errors.process(Errors.java:297)

! at org.glassfish.jersey.internal.Errors.process(Errors.java:267)

Anyone can help? Thanks.

1 ACCEPTED SOLUTION

Accepted Solutions
cmorfin
19-Tanzanite
(To:cmorfin)

Hi

As indicated here is an update on fixing the issue.

The

WAT9999E

Unexpected exception. {Throwable=[NullPointerException: }]

exception is due to the use of t.getMessages().getMessages()

When everything works fine, there will be no message and it will be set to null. hence the call to null.getMessages report the NullPointerException.

To avoid this  call instead toExtendedString()


See attached modified code


Thanks

Christophe


View solution in original post

2 REPLIES 2
cmorfin
19-Tanzanite
(To:weli)

Handling this offline, will post outcome when resolved

cmorfin
19-Tanzanite
(To:cmorfin)

Hi

As indicated here is an update on fixing the issue.

The

WAT9999E

Unexpected exception. {Throwable=[NullPointerException: }]

exception is due to the use of t.getMessages().getMessages()

When everything works fine, there will be no message and it will be set to null. hence the call to null.getMessages report the NullPointerException.

To avoid this  call instead toExtendedString()


See attached modified code


Thanks

Christophe


Top Tags