UserEntity$Description and no properties discovered to create BeanSerializer (to avoid exception, disable SerializationFeature.FAIL_ON_EMPTY_BEANS) - mongodb

I am developing the Spring Boot + MongoDB example and I am getting below error.
I used Lombok to generate setters and getters. I am simply calling the repositoy.findAll() method and giving me the below error.
Whitelabel Error PageThis application has no explicit mapping for /error, so you are seeing this as a fallback.Sat Feb 10 16:49:04 IST 2018There was an unexpected error (type=Internal Server Error, status=500).Could not write JSON: No serializer found for class com.myfi.model.UserEntity$Description and no properties discovered to create BeanSerializer (to avoid exception, disable SerializationFeature.FAIL_ON_EMPTY_BEANS); nested exception is com.fasterxml.jackson.databind.JsonMappingException: No serializer found for class com.myfi.model.UserEntity$Description and no properties discovered to create BeanSerializer (to avoid exception, disable SerializationFeature.FAIL_ON_EMPTY_BEANS) (through reference chain: java.util.ArrayList[0]->com.myfi.model.Tweet["user"]->com.myfi.model.User["entities"]->com.myfi.model.UserEntity["description"])

I was seeing the same issue in my project.
For me, my problem was I was running the application within eclipse, and eclipse was not aware of the lombok annotations. When I added the lombok plugin to eclipse it started working

Related

Websphere 9.0.0.7 - Cluster Loading Wrong JPA Specification

Having a very frustrating problem right now that I've exhausted all other avenues of research on. In short, we have a certain vendor application that runs on Websphere 9 and requires JPA 2.0 specification for java persistence.
The issue is, despite setting the JPA specification level to 2.0 in the administrative console, as well as setting it via wsadmin command directly, the cluster continues to load JPA 2.1 and ultimately causing big errors when the application runs.
We see it in the startup logs at:
00000001 SharedJPAComp I CWWJP0048I: Initialized the JPA service for
the JPA 2.1 specification level.
Seen in verbose class loading at:
class load: com.ibm.ws.jpa.runtime.JPA21Runtime from:
file:/opt/app/WebSphere90/AppServer_x64/plugins/com.ibm.ws.jpa.container21.jar
And seen in System.Out logs during the actual exception :
0000017c BusinessExcep E CNTR0020E: EJB threw an unexpected (non-declared) exception during invocation of method "insert" on bean
"BeanId([app name redacted], null)". Exception data:
java.lang.AbstractMethodError:
javax/persistence/EntityManagerFactory.createEntityManager(Ljavax/persistence/SynchronizationType;Ljava/util/Map;)Ljavax/persistence/EntityManager;
at
com.ibm.ws.jpa.runtime.JPA21Runtime.createEntityManagerInstance(JPA21Runtime.java:165)
Actual correct setting shown here
Websphere Java Persistence Settings
Has anyone encountered this kind of issue? Research so far has found nothing. Running on Websphere fixpack 9.0.0.7

Play 2.5.3: Cryptic error message: Exception caught in Netty java.lang.NoClassDefFoundError

[error] p.c.s.n.PlayRequestHandler - Exception caught in Netty
java.lang.NoClassDefFoundError: Could not initialize class play.api.http.DefaultHttpErrorHandler$
at
I get error message and my app doesn't start in dev mode.
The error doesn't give me any details about what went wrong. I changed log level in logback.xml to DEBUG, but it didn't help.
Any suggestions how to investigate the problem? A week ago it worked just fine and since then there was no any changes in sources and configuration. It stopped working for an unknown reason.
Edit1: How do I enable more verbose logging? Otherwise it's absolutely unclear where the error comes from.
Edit2: changed the title
(Server started, use Ctrl+D to stop and go back to the console...)
Warning: node.js detection failed, sbt will use the Rhino based Trireme JavaScript engine instead to run JavaScript assets compilation, which in some cases may be orders of magnitude slower than using no
de.js.
[error] p.c.s.n.PlayRequestHandler - Exception caught in Netty
java.lang.NoClassDefFoundError: Could not initialize class play.api.http.DefaultHttpErrorHandler$
at play.core.server.Server$class.logExceptionAndGetResult$1(Server.scala:45)
at play.core.server.Server$class.getHandlerFor(Server.scala:65)
at play.core.server.NettyServer.getHandlerFor(NettyServer.scala:47)
at play.core.server.netty.PlayRequestHandler.handle(PlayRequestHandler.scala:82)
at play.core.server.netty.PlayRequestHandler.channelRead(PlayRequestHandler.scala:163)
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:292)
at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:278)
at com.typesafe.netty.http.HttpStreamsHandler.channelRead(HttpStreamsHandler.java:129)
at com.typesafe.netty.http.HttpStreamsServerHandler.channelRead(HttpStreamsServerHandler.java:96)
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:292)
[error] p.c.s.n.PlayRequestHandler - Exception caught in Netty
java.lang.NoClassDefFoundError: Could not initialize class play.api.http.DefaultHttpErrorHandler$
at play.core.server.Server$class.logExceptionAndGetResult$1(Server.scala:45)
at play.core.server.Server$class.getHandlerFor(Server.scala:65)
at play.core.server.NettyServer.getHandlerFor(NettyServer.scala:47)
at play.core.server.netty.PlayRequestHandler.handle(PlayRequestHandler.scala:82)
at play.core.server.netty.PlayRequestHandler.channelRead(PlayRequestHandler.scala:163)
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:292)
at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:278)
at com.typesafe.netty.http.HttpStreamsHandler.channelRead(HttpStreamsHandler.java:129)
at com.typesafe.netty.http.HttpStreamsServerHandler.channelRead(HttpStreamsServerHandler.java:96)
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:292)
I don't know exactly what your problem is, but I encountered this cryptic, unhelpful error when I discovered an error in my application.conf where I was attempting to set a configuration based on an environment variable that may or may not be there. Clearly, the cause of the exception and the place it becomes apparent are pretty far apart.
So I would suggest checking your application.conf for a misconfiguration. Consider also any dependencies that might have been built for Play versions < 2.5. Basically anything that might cause the application to be "mis-initalized" for lack of a better term.
EDIT: I just discovered another cause of this error that falls under the category of "mis-initialization." I changed the name of a route in my routes file but forgot to change the corresponding reverse route in my template. I feel this should be caught sooner and with a more intuitive error, but regardless, look out for this (or something similar) as well in application.conf or routes.
Oops.. java.lang.NoClassDefFoundError: Could not initialize class play.api.http.DefaultHttpErrorHandler$ tells nothing what went wrong.
One such reason I have encountered is when I had missing/typos in my configuration properties and use guice injectors.
You can run your app in prod mode to see more informative error message activator clean compile start.
....
[info] Done packaging.
(Starting server. Type Ctrl+D to exit logs, the server will remain in background)
Oops, cannot start the server.
Configuration error: Configuration error[storage.conf # file:/myproject/mymodule/target/universal/stage/conf/storage.conf: 16: Could not resolve substitution to a value: ${storage.cluster.name}]
at play.api.Configuration$.configError(Configuration.scala:154)
....
In my case the below dependency was what was causing the error
libraryDependencies += "com.google.cloud" % "gcloud-java-storage" % "0.2.5"
Source Getting ChannelException when adding Google cloud client library to Play 2.5
In my case it was a missed } in the application.conf file :( .

BeanCreationException Vaadin

I'm trying to integrate Spring Boot Vaadin (https://github.com/peholmst/vaadin4spring) with Vaadin's Dashboard Demo Code (https://github.com/vaadin/dashboard-demo). The only thing modification I made was add the annotation "#VaadinUI" in the DashboardUI class. I checked in my code using the branch "integrate-vaadin-dashboard-demo-project".
I get the error message:
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.boot.context.properties.ConfigurationPropertiesBindingPostProcessor': Invocation of init method failed; nested exception is java.lang.NoClassDefFoundError: javax/validation/ParameterNameProvider.
I'm not really sure what the message means. Can somebody explain it and come up with a resolution to the error message?
Gist Error Output:
https://gist.github.com/anonymous/43d602c1105e00d4d7d6
Clone Url:
https://github.com/caritos/pangolin.git
Branch:
integrate-vaadin-dashboard-demo-project
You pack javax validation api 1.0 in your jar. This is the version the GWT compiler needs (when you build a widgetset). But spring-boot depends on version 1.1. Usually the problem is the other way around...

Grails - can't evaluate expression debugging in Eclipse inside annotated method

When I set a breakpoint in Eclipse doing grails test-app, evaluating expressions with ctrl-shift-I fails inside an annotated method. The error is complaining about not being able to resolve the annotation class.
The annotation itself is indicating an aspect, handled via AOP.
The method works normally, I just can't debug effectively in Eclipse.
How would I fix this? Is this a bug in Eclipse or in Groovy?
This is the error I get from the Eclipse error logs:
Caused by: org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed:
____Eval.groovy: 4: unable to resolve class com.mycompany.....
# line 4, column 60.
ebapps....MyClass
^
1 error
at org.codehaus.groovy.control.ErrorCollector.failIfErrors(ErrorCollector.java:313)
at org.codehaus.groovy.control.CompilationUnit.applyToSourceUnits(CompilationUnit.java:1030)
at org.codehaus.groovy.control.CompilationUnit.doPhaseOperation(CompilationUnit.java:636)
at org.codehaus.groovy.control.CompilationUnit.compile(CompilationUnit.java:585)
at groovy.lang.GroovyClassLoader.doParseClass(GroovyClassLoader.java:279)
at groovy.lang.GroovyClassLoader.parseClass(GroovyClassLoader.java:258)
at org.grails.ide.eclipse.groovy.debug.core.evaluation.GroovyJDIEvaluator.convertSnippetToScript(GroovyJDIEvaluator.java:349)
at org.grails.ide.eclipse.groovy.debug.core.evaluation.GroovyJDIEvaluator.performEvaluate(GroovyJDIEvaluator.java:183)

STS reports error in bean config for java.sql.Date property

I have a bean class with a property setter like this:
public void setDueDate(java.sql.Date dueDate)
I also have an instance of this bean configured in XML like this:
<property name="dueDate">
<bean class="java.sql.Date"/>
</property>
STS marks that config with an error:
No constructor with 0 arguments defined in class 'java.sql.Date'
Well, that's true, java.sql.Date has no no-arg constructor. But this app works fine so obviously Spring is smart enough to create a Date instance without a constructor. Question is, why is the STS editor/builder complaining, and is it possible to convince it that this is not an error or warning?
At this time, I can only see 3 situations where the code "would work", in the order of their likeliness to happen:
the parent bean where the property is injected is defined with scope="prototype" or lazy-init="true" and is not accessed at all
the runtime classpath contains an implementation of java.sql.Dateshadowing the original
that particular context xml is not used in the application
Otherwise, Spring should issue a nice:
Could not instantiate bean class [java.sql.Date]: No default constructor found; nested exception is java.lang.NoSuchMethodException: java.sql.Date.<init>()
In case the code works, but STS reports an wrong error, please file a bug against STS at https://issuetracker.springsource.com/browse/STS (as mentioned above).
In the meantime you can workaround this issue by disabling the validation via the Spring preferences for the project. Just go to preferences of the project -> Spring, then the "Project Validators" tab, and deactivate the validation that is responsible for the wrong error report.