PropertyUtils class in org.apache.commons.commons-beanutils 1.9.4 java.lang.NoSuchMethodException - jasper-reports

Method getProperty on PropertyUtils class in org.apache.commons.commons-beanutils 1.9.4 throws
java.lang.NoSuchMethodException: Unknown property 'class' for
The exception being thrown form JasperReports library version 6.20.0
So I debugged to find the place and then tried using the library directly and was able to see it being reproduced whereas BeanUtils from spring can be used to invoke the method.

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.

Scala. NoSuchMethodException when instantiating trait

After refactoring some projects, I I got the following Exception when calling a scala class that implements a trait from a Spring Boot application
8/06/22 13:32:26 ERROR SpringApplication: Application startup failed
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'MLController' defined in URL [jar:file:/home/xxxx/environment/spark-2.2.1-bin-hadoop2.7/./xxxx/ikodaanalysis-mlserver-0.1.0.jar!/xxx/mlserver/MLController.class]: Instantiation of bean failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [xxx.mlserver.MLController]: Constructor threw exception; nested exception is java.lang.NoSuchMethodError: ikoda.utilobjects.SparkConfProviderWithStreaming.$init$(Lxxx/utilobjects/SparkConfProviderWithStreaming;)V
I checked the dependencies and everything appeared to be present in the jar.
So why was I getting the Exception?
I found the answer here. I felt it was probably a fairly common issue and worth reporting on SO.
I assume it's down to Java 8 and Scala 2.12 expecting to find the "init" method in the ScalaDsl.class file (new style Traits as interfaces) rather than in ScalaDsl$class.class file (old style Traits as interface and supporting class).
......
I think the Scala 2.12 package needs to be compiled (not just run)
under Java 8 to avoid this problem.

What are the Jersey versions compatible with Jackson 2.9.2

Could you please help me with these 2 queries/Issues :
Can anyone who has worked on Jackson 2.9.2 ,let me know what is the compatible Jersey version for Jackson 2.9.2.I am currently using Jersey 2.23.2 but it does not work with Jackson 2.9.2.I get following error :
[ERROR ] SRVE0777E: Exception thrown by application class 'org.glassfish.jersey.servlet.WebComponent.serviceImpl:489'
javax.servlet.ServletException: org.glassfish.jersey.server.ContainerException: java.lang.NoSuchMethodError: com.fasterxml.jackson.databind.util.BeanUtil.okNameForSetter(Lcom/fasterxml/jackson/databind/introspect/AnnotatedMethod;)Ljava/lang/String;
at org.glassfish.jersey.servlet.WebComponent.serviceImpl(WebComponent.java:489)
at org.glassfish.jersey.servlet.WebComponent.service(WebComponent.java:427)
at org.glassfish.jersey.servlet.ServletContainer.service(ServletContainer.java:388)
at org.glassfish.jersey.servlet.ServletContainer.service(ServletContainer.java:341)
at org.glassfish.jersey.servlet.ServletContainer.service(ServletContainer.java:228)
at com.ibm.ws.webcontainer.servlet.ServletWrapper.service(ServletWrapper.java:1290)
2) In general ,is there some way to find combination of Jars.I have faced this issue earlier also while finding right combination of Jersey and Spring jars.It will save my and other's facing same issue lot of time,if someone can guide on this.
Thanks.
As of mid November 2017, the most recent version of Jersey is 2.26.
Jersey supports Jackson via the jersey-media-json-jackson extension module, which is released under the same version number as Jersey core modules. This extension module contains the auto-discoverable JacksonFeature that registers the JacksonJsonProvider class for binding JSON to Java objects.
In the version 2.26, this extension depends on Jackson 2.8.4. While in the version 2.23.2, it depends on Jackson 2.5.4.
The BeanUtil.okNameForSetter(Annotated Method) method was deprecated in Jackson 2.5 and has been removed in Jackson 2.9.
To support the most recent version of Jackson, you could get rid of the jersey-media-json-jackson extension module.
Then add the jackson-jaxrs-json-provider module to your project and register the JacksonJsonProvider directly in your ResourceConfig or Application implementation.
I am getting the same error as below:
[ERROR ] SRVE0777E: Exception thrown by application class 'org.glassfish.jersey.servlet.WebComponent.serviceImpl:489'
javax.servlet.ServletException: org.glassfish.jersey.server.ContainerException:
java.lang.NoSuchMethodError: com.fasterxml.jackson.databind.util.BeanUtil.okNameForSetter(Lcom/fasterxml/jackson/databind/introspect/AnnotatedMethod;)Ljava/lang/String;
I was able to resolve above issue with
Jersey2 version: 2.23.2
Jackson version: 2.7.4

Strange Scala Error when Using Scala Reflect

I added a dependency to the scala reflect library version 2.11.8 to one of my existing project such that I could use TypeTag's but strangely I face some error when running. Here is my error:
Class JavaLaunchHelper is implemented in both /Library/Java/JavaVirtualMachines/jdk1.8.0_121.jdk/Contents/Home/bin/java (0x10a3ab4c0) and /Library/Java/JavaVirtualMachines/jdk1.8.0_121.jdk/Contents/Home/jre/lib/libinstrument.dylib (0x10b4ce4e0). One of the two will be used. Which one is undefined.
Exception in thread "main" java.lang.AbstractMethodError: Method com/my/csvparser/CSVParser$.scala$App$_setter_$executionStart_$eq(J)V is abstract
at com.my.csvparser.CSVParser$.scala$App$_setter_$executionStart_$eq(CSVParser.scala)
at scala.App$class.$init$(App.scala:44)
at com.my.csvparser.CSVParser$.<init>(CSVParser.scala:13)
at com.my.csvparser.CSVParser$.<clinit>(CSVParser.scala)
at com.my.csvparser.CSVParser.main(CSVParser.scala)
Did anyone face a similar issue? My Scala version is 2.11.8

New dependency causing java.lang.NoSuchMethodError exception

I'm working on a project that is making use of a Scala ETCD client (https://github.com/nikore/scala-etcd), this has been all fine and good until I added a Scala Fleet client (https://github.com/MonsantoCo/fleet-client) into the mix.
When I compile it is fine but once I run the project it throws the following exception on the lines where the ETCDClient is constructed
Exception in thread "main" java.lang.NoSuchMethodError: spray.json.StandardFormats$class.optionFormat(Lspray/json/StandardFormats;Lspray/json/JsonFormat;)Lspray/json/StandardFormats$OptionFormat;
at net.nikore.etcd.EtcdJsonProtocol$.optionFormat(EtcdJsonProtocol.scala:5)
at net.nikore.etcd.EtcdJsonProtocol$.<init>(EtcdJsonProtocol.scala:18)
at net.nikore.etcd.EtcdJsonProtocol$.<clinit>(EtcdJsonProtocol.scala)
at net.nikore.etcd.EtcdClient.<init>(EtcdClient.scala:76)
at net.nikore.etcd.EtcdClient$.apply(EtcdClient.scala:20)
at au.com.someproject.helpers.SomeProjectService$class.main(SomeProjectService.scala:116)
at au.com.someproject.some_agent.ServiceMain$.main(ServiceMain.scala:17)
at au.com.someproject.some_agent.ServiceMain.main(ServiceMain.scala)
The only thing that I call tell that might be causing this is that the ETCD Client requires spray-json 1.3.1 but the Fleet Client requires spray-json 1.3.2. Having a look at the compiled package, spray-json 1.3.2 is packaged.
What is the cause of this (if I am wrong about the dependencies) and how can I go about resolving this?
EDIT:
Bellow is the code at SomeProjectService.scala:116:
etcdClient = EtcdClient(s"http://${serviceConfiguration.getString("someproject.etcd.host")}:${serviceConfiguration.getString("someproject.etcd.port")}")
And bellow is the code at ServiceMain.scala:17:
object ServiceMain extends SomeProjectService {
ServiceMain is the entry point for the service but the main function is declared in the SomeProjectService trait where the etcdClient is declared