NoClassDefFoundError when using instrumentation on Bluemix - ibm-cloud

I am trying to add a javaagent to my bluemix app, this agent uses Instrumentation. The thing is that when I run the application I get the following error:
premain() - Instrumentation is already running
...
CWWKF0004E: An unknown exception occurred while installing or removing features. Exception: java.lang.NoClassDefFoundError: agent.ClassInstrumentorTransform
ERR at com.ibm.ws.kernel.feature.internal.subsystem.SubsystemFeatureDefinitionImpl.setHeader(SubsystemFeatureDefinitionImpl.java)
ERR at [internal classes]
I have tried creating another agent with the same Premain-Class and Agent-Class structure but with my own classes and it works, I have tried uploading my own copy of Instrumentation classes and point the javaagent to it using Class-Path but the error still appears.
Any sugestion what can be the problem?
I suspect maybe the Bluemix enviorment uses the Instrumentation, any ideas how this might be checked and how I can solve the inter dependency?

Based on the error message, it looks like you have a class in a feature bundle that is trying to access a class from the javaagent, but you have not added the javaagent package to org.osgi.framework.bootdelegation as described in the Specifying Liberty profile bootstrap properties" topic in the knowledge center topic.

Related

Hi, I am currently upgrading wicket application from 1.5.3 to 6.30.0 but i am getting error and login page is not getting instantiated

org.apache.wicket.WicketRuntimeException: Can't instantiate page using constructor 'public com.ecs.test.web.page.Login()'. An exception has been thrown during construction!
at org.apache.wicket.session.DefaultPageFactory.newPage(DefaultPageFactory.java:194)
Caused by: java.lang.NoClassDefFoundError: javax/inject/Inject
at org.apache.wicket.spring.injection.annot.AnnotProxyFieldValueFactory.supportsField(AnnotProxyFieldValueFactory.java:324)
at org.apache.wicket.injection.Injector.findFields(Injector.java:148)
it might help tring to add Objenesis lib to your project dependencies. Wicket CI checks if this lib is available and if so, it's used to build proxy objects even if they don't provide a no args (i.e. Default) constructor.

Why appear this error when run optaplanner .jar?

I have an optaplanner aplication, and i want to export it as a runnable jar, but when i run the jar, appear a error and I don't know why.
I'm using the Vehicle Routing example, and i want to use the GUI interface without eclipse.
Exception in thread "main" java.lang.NullPointerException
at org.kie.internal.io.ResourceFactory.newByteArrayResource(ResourceFactory.java:66)
at org.drools.compiler.kie.builder.impl.AbstractKieModule.getResource(AbstractKieModule.java:308)
at org.drools.compiler.kie.builder.impl.AbstractKieModule.addResourceToCompiler(AbstractKieModule.java:273)
at org.drools.compiler.kie.builder.impl.AbstractKieModule.addResourceToCompiler(AbstractKieModule.java:268)
at org.drools.compiler.kie.builder.impl.AbstractKieProject.buildKnowledgePackages(AbstractKieProject.java:253)
at org.drools.compiler.kie.builder.impl.AbstractKieProject.verify(AbstractKieProject.java:74)
at org.drools.compiler.kie.builder.impl.KieBuilderImpl.buildKieProject(KieBuilderImpl.java:267)
at org.drools.compiler.kie.builder.impl.KieBuilderImpl.buildAll(KieBuilderImpl.java:235)
at org.drools.compiler.kie.builder.impl.KieBuilderImpl.buildAll(KieBuilderImpl.java:184)
at org.optaplanner.core.config.score.director.ScoreDirectorFactoryConfig.buildDroolsScoreDirectorFactory(ScoreDirectorFactoryConfig.java:544)
at org.optaplanner.core.config.score.director.ScoreDirectorFactoryConfig.buildScoreDirectorFactory(ScoreDirectorFactoryConfig.java:351)
at org.optaplanner.core.config.solver.SolverConfig.buildSolver(SolverConfig.java:255)
at org.optaplanner.core.impl.solver.AbstractSolverFactory.buildSolver(AbstractSolverFactory.java:61)
at org.optaplanner.examples.common.app.CommonApp.createSolver(CommonApp.java:136)
at org.optaplanner.examples.common.app.CommonApp.createSolutionBusiness(CommonApp.java:124)
at org.optaplanner.examples.common.app.CommonApp.init(CommonApp.java:115)
at org.optaplanner.examples.common.app.CommonApp.init(CommonApp.java:111)
at org.optaplanner.examples.pmrouting.app.PMRoutingAPP.main(PMRoutingAPP.java:39)
Because Drools is incompatible with uber jars.
Use one of the other score calculators if you really want to run with an uber jar...

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

Can't use akka in IDEA plugin development

When I develop an IDEA plugin, I want to use akka, but have some problems.
I created a demo project here: https://github.com/freewind/idea-plugin-akka-demo
You can just clone it and reproduce the problem on your computer. (Notice the Setup section)
And I copy the problem here:
Problems
1. Can't use default akka configuration
If I removed:
src/main/resources/application.conf
src/main/scala/freewind/MyAkkaConfig
and run this plugin, it will report this error when starting:
com.intellij.ide.plugins.PluginManager$StartupAbortedException:
com.intellij.diagnostic.PluginException: No configuration setting found for key 'akka'
[Plugin: com.yourcompany.unique.plugin.id]
2. Can't load the configuration from file
Then I copied the reference.conf from akka jar, to src/main/resources/application.conf, but it still report the same error. Seems akka in IDEA plugin can't find this file automatically.
3. ClassNotFoundException: akka.actor.LightArrayRevolverScheduler
So I have to use MyAkkaConfig.scala to hardcode the configuration in scala code, but this time, it reports another error:
com.intellij.ide.plugins.PluginManager$StartupAbortedException:
com.intellij.diagnostic.PluginException: ClassNotFoundException: akka.actor.LightArrayRevolverScheduler
[Plugin: com.yourcompany.unique.plugin.id]
The akka.actor.LightArrayRevolverScheduler is used in MyAkkaConfig.scala, and is included in akka-actor_2.11:2.3.12:jar. But why IDEA can't load it?
For the 3rd problem, it can be fixed by passing the classloader:
val system = ActorSystem("my-actor", MyAkkaConfig.config, this.getClass.getClassLoader)
But we also can remove the MyAkkaConfig.config, to use the file application.conf under resources

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