arrowhead-f / core-java

Arrowhead Core Framework Implementation in Java
https://forge.soa4d.org/plugins/mediawiki/wiki/arrowhead-f/index.php/Main_Page
Apache License 2.0
4 stars 12 forks source link

HV000030: No validator could be found for type: java.time.ZonedDateTime. #48

Closed fortikeco closed 5 years ago

fortikeco commented 5 years ago

There seems to be a problem with current hibernate annotations in the file eu.arrowhead.common.database.EventFilter.java:

  @Column(name = "start_date")
  private ZonedDateTime startDate;
  @Column(name = "end_date")
  @LDTInFuture(message = "Filter end date must be in the future")
  private ZonedDateTime endDate;

If I try to start the Publish/Subscribe example, I get: cd publisher/config && java -jar ../target/publisher-4.0.jar

Working directory: /home/bjorn/java/workspace/client/provider/config Mar 05, 2019 2:46:16 PM org.glassfish.grizzly.http.server.NetworkListener start INFO: Started listener bound to [0.0.0.0:8460] Mar 05, 2019 2:46:16 PM org.glassfish.grizzly.http.server.HttpServer start INFO: [HttpServer] Started. Started insecure server at: http://0.0.0.0:8460 Service Registry Entry: { "providedService" : { "serviceDefinition" : "IndoorTemperature", "interfaces" : [ "XML", "JSON" ], "serviceMetadata" : { "unit" : "celsius" } }, "provider" : { "systemName" : "InsecureTemperatureSensor", "address" : "0.0.0.0", "port" : 8460 }, "serviceUri" : "temperature", "version" : 1 } IntraCloud Auth Entry: null Orchestration Store Entry: [ ] Registering service is successful! Type "stop" to shutdown PROVIDER Server...

cd subscriber/config && java -jar ../target/subscriber-4.0.jar Working directory: /home/bjorn/java/workspace/client/subscriber/config Mar 05, 2019 2:48:11 PM org.glassfish.grizzly.http.server.NetworkListener start INFO: Started listener bound to [0.0.0.0:8464] Mar 05, 2019 2:48:11 PM org.glassfish.grizzly.http.server.HttpServer start INFO: [HttpServer] Started. Started insecure server at: http://0.0.0.0:8464 Exception in thread "main" eu.arrowhead.client.common.exception.ArrowheadException: Unknown error occurred at http://0.0.0.0:8454/eventhandler/subscription at eu.arrowhead.client.common.Utility.handleException(Utility.java:179) at eu.arrowhead.client.common.Utility.sendRequest(Utility.java:158) at eu.arrowhead.client.common.Utility.sendRequest(Utility.java:164) at eu.arrowhead.client.subscriber.SubscriberMain.subscribe(SubscriberMain.java:101) at eu.arrowhead.client.subscriber.SubscriberMain.(SubscriberMain.java:61) at eu.arrowhead.client.subscriber.SubscriberMain.main(SubscriberMain.java:66) Caused by: javax.ws.rs.ProcessingException: Error reading entity from input stream. at org.glassfish.jersey.message.internal.InboundMessageContext.readEntity(InboundMessageContext.java:889) at org.glassfish.jersey.message.internal.InboundMessageContext.readEntity(InboundMessageContext.java:808) at org.glassfish.jersey.client.ClientResponse.readEntity(ClientResponse.java:321) at org.glassfish.jersey.client.InboundJaxrsResponse$1.call(InboundJaxrsResponse.java:115) at org.glassfish.jersey.internal.Errors.process(Errors.java:316) at org.glassfish.jersey.internal.Errors.process(Errors.java:298) at org.glassfish.jersey.internal.Errors.process(Errors.java:229) at org.glassfish.jersey.process.internal.RequestScope.runInScope(RequestScope.java:389) at org.glassfish.jersey.client.InboundJaxrsResponse.runInScopeIfPossible(InboundJaxrsResponse.java:264) at org.glassfish.jersey.client.InboundJaxrsResponse.readEntity(InboundJaxrsResponse.java:112) at eu.arrowhead.client.common.Utility.handleException(Utility.java:177) ... 5 more Caused by: com.fasterxml.jackson.core.JsonParseException: Unrecognized token 'HV000030': was expecting ('true', 'false' or 'null') at [Source: (org.glassfish.jersey.message.internal.ReaderInterceptorExecutor$UnCloseableInputStream); line: 1, column: 10] at com.fasterxml.jackson.core.JsonParser._constructError(JsonParser.java:1804) at com.fasterxml.jackson.core.base.ParserMinimalBase._reportError(ParserMinimalBase.java:679) at com.fasterxml.jackson.core.json.UTF8StreamJsonParser._reportInvalidToken(UTF8StreamJsonParser.java:3524) at com.fasterxml.jackson.core.json.UTF8StreamJsonParser._handleUnexpectedValue(UTF8StreamJsonParser.java:2619) at com.fasterxml.jackson.core.json.UTF8StreamJsonParser._nextTokenNotInObject(UTF8StreamJsonParser.java:824) at com.fasterxml.jackson.core.json.UTF8StreamJsonParser.nextToken(UTF8StreamJsonParser.java:721) at com.fasterxml.jackson.jaxrs.base.ProviderBase.readFrom(ProviderBase.java:774) at org.glassfish.jersey.message.internal.ReaderInterceptorExecutor$TerminalReaderInterceptor.invokeReadFrom(ReaderInterceptorExecutor.java:257) at org.glassfish.jersey.message.internal.ReaderInterceptorExecutor$TerminalReaderInterceptor.aroundReadFrom(ReaderInterceptorExecutor.java:236) at org.glassfish.jersey.message.internal.ReaderInterceptorExecutor.proceed(ReaderInterceptorExecutor.java:156) at org.glassfish.jersey.message.internal.MessageBodyFactory.readFrom(MessageBodyFactory.java:1091) at org.glassfish.jersey.message.internal.InboundMessageContext.readEntity(InboundMessageContext.java:874) ... 15 more

In the eventhadler logfile, I see:

Working directory: /home/bjorn/java/workspace/arrowhead/core-4.1/eventhandler/target Starting server in debug mode! Starting server as daemon! Mar 05, 2019 2:09:16 PM org.glassfish.grizzly.http.server.NetworkListener start INFO: Started listener bound to [0.0.0.0:8454] Mar 05, 2019 2:09:16 PM org.glassfish.grizzly.http.server.HttpServer start INFO: [HttpServer] Started. Started insecure server at: http://0.0.0.0:8454 In daemon mode, process will terminate for TERM signal... New POST request at: http://0.0.0.0:8454/eventhandler/subscription { "id" : 0, "eventType" : "temperature", "consumer" : { "systemName" : "InsecureSubscriber", "address" : "0.0.0.0", "port" : 8464 }, "sources" : [ ], "filterMetadata" : { }, "notifyUri" : "notify", "matchMetadata" : false } Mar 05, 2019 2:48:11 PM org.glassfish.jersey.server.validation.internal.ValidationExceptionMapper toResponse WARNING: Unexpected Bean Validation problem. javax.validation.UnexpectedTypeException: HV000030: No validator could be found for type: java.time.ZonedDateTime. at org.hibernate.validator.internal.engine.constraintvalidation.ConstraintValidatorManager.verifyResolveWasUnique(ConstraintValidatorManager.java:218) at org.hibernate.validator.internal.engine.constraintvalidation.ConstraintValidatorManager.findMatchingValidatorClass(ConstraintValidatorManager.java:193) at org.hibernate.validator.internal.engine.constraintvalidation.ConstraintValidatorManager.getInitializedValidator(ConstraintValidatorManager.java:97) at org.hibernate.validator.internal.engine.constraintvalidation.ConstraintTree.validateConstraints(ConstraintTree.java:125) at org.hibernate.validator.internal.engine.constraintvalidation.ConstraintTree.validateConstraints(ConstraintTree.java:91) at org.hibernate.validator.internal.metadata.core.MetaConstraint.validateConstraint(MetaConstraint.java:83) at org.hibernate.validator.internal.engine.ValidatorImpl.validateConstraint(ValidatorImpl.java:547) at org.hibernate.validator.internal.engine.ValidatorImpl.validateConstraintsForDefaultGroup(ValidatorImpl.java:487) at org.hibernate.validator.internal.engine.ValidatorImpl.validateConstraintsForCurrentGroup(ValidatorImpl.java:451) at org.hibernate.validator.internal.engine.ValidatorImpl.validateInContext(ValidatorImpl.java:403) at org.hibernate.validator.internal.engine.ValidatorImpl.validateCascadedConstraint(ValidatorImpl.java:723) at org.hibernate.validator.internal.engine.ValidatorImpl.validateCascadedConstraints(ValidatorImpl.java:601) at org.hibernate.validator.internal.engine.ValidatorImpl.validateParametersInContext(ValidatorImpl.java:992) at org.hibernate.validator.internal.engine.ValidatorImpl.validateParameters(ValidatorImpl.java:300) at org.hibernate.validator.internal.engine.ValidatorImpl.validateParameters(ValidatorImpl.java:254) at org.glassfish.jersey.server.validation.internal.DefaultConfiguredValidator.onValidate(DefaultConfiguredValidator.java:178) at org.glassfish.jersey.server.validation.internal.ValidationInterceptorExecutor.proceed(ValidationInterceptorExecutor.java:114) at org.glassfish.jersey.server.validation.internal.DefaultConfiguredValidator.validateResourceAndInputParams(DefaultConfiguredValidator.java:146) at org.glassfish.jersey.server.model.internal.AbstractJavaResourceMethodDispatcher.invoke(AbstractJavaResourceMethodDispatcher.java:138) at org.glassfish.jersey.server.model.internal.JavaResourceMethodDispatcherProvider$ResponseOutInvoker.doDispatch(JavaResourceMethodDispatcherProvider.java:200) at org.glassfish.jersey.server.model.internal.AbstractJavaResourceMethodDispatcher.dispatch(AbstractJavaResourceMethodDispatcher.java:103) at org.glassfish.jersey.server.model.ResourceMethodInvoker.invoke(ResourceMethodInvoker.java:493) at org.glassfish.jersey.server.model.ResourceMethodInvoker.apply(ResourceMethodInvoker.java:415) at org.glassfish.jersey.server.model.ResourceMethodInvoker.apply(ResourceMethodInvoker.java:104) at org.glassfish.jersey.server.ServerRuntime$1.run(ServerRuntime.java:277) Response to the request at: http://0.0.0.0:8454/eventhandler/subscription "HV000030: No validator could be found for type: java.time.ZonedDateTime."

eudyptula commented 5 years ago

Are you using an older version, since we had issues with ZonedDateTime in the past?

fortikeco commented 5 years ago

You are right! This occurred in the 4.1.0 version. I tested it with master and the problem does not occur. Ticket can be closed.