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

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)

Related

TestNG doesn't show line number for line from where the null pointer exception occurs

TestNG shows null pointer exception but does not show the line number from where this exception occured - difficult to debug.
Environment: Eclipse Oxygen, TestNG downloaded from eclipse marketplace.
Tried configuring the Class in run configurations but of no use.
FAILED: testSaveWithoutBackend
java.lang.NullPointerException
at ServiceAction.save(ServiceAction.java)
I expect the standard way of error to be shown using the line numbers. Here the line numbers are missing it only says exception occured in save method.
I dont know which of this worked.
But I followed
Project > Properties: Java Compiler the checkbox Add line number attributes to the generated class files (used by the debugger)
Manually updated the core.prefs file in .settings folder to set org.eclipse.jdt.core.compiler.debug.lineNumber=generate
After which I right clicked and refreshed the project. Thats when things started working

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

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

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 :( .

GGTS throwing error when building, string index out of range

I am working on a very large project, and am currently tasked to get the project to work correctly using GGTS rather than intelli-j. The project compiles and runs correctly from cygwin. However, when trying to build the project in GGTS an error occurs. The error thrown is as follows:
Errors occurred during the build.
Errors running builder 'Java Builder' on project 'project'.
String index out of range: -23
The error gets highlighted under a src/groovy package. specifically GGTS highlights the "p" in the following:
package com.bussiness.sys.rep
/* CODE */
When looking at the error thrown at this point the following is said.
The type org.joda.convert.FromString cannot be resolved. It is indirectly referenced from required .class files
I have tried multiple grails clean, refresh-dependencies, builds, looking into configuring the build path, and re-importing. I continue to get the same error. Any help would be appreciated.
Edit 1:
Using Grails 2.3.8, and GGTS 3.6.0.M1 based on eclipse 4.4, for Windows.

Scalacl compiling error

I am attempting to use scalacl. I have added scalacl as an Xplugin for my project, but when I do it gives me two errors:
1) Error in Scala compiler: null
2) SBT builder crashed while compiling. The error message is 'null'. Check Error Log for details.
It also gives this error in a pop-up window:
An internal error occurred during: "Compute launch button tooltip".
Scala compiler cannot initialize for project: HelloWorld. Please check that your classpath contains the standard Scala library.