java.lang.NoSuchMethodError: net.sf.json.JSONObject.put(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object - eclipse

After some time to work with eclipse, jboss and json I get this library json-lib-0.9.jar and added to jboss library so here the problem is that when I run the program I get
java.lang.NoSuchMethodError:
net.sf.json.JSONObject.put(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object
This error ocurs when i try to make json.put(key,value). json is define as JSONObject.
Can someone help me please i don't know how resolve this one:(
Thanks,
Radu
The exact error is
[org.apache.catalina.core.ContainerBase.[jboss.web].[default-host].[/ExtJSFirstTry].[servlet.User]]
(http--127.0.0.1-8080-2) Servlet.service() for servlet servlet.User
threw exception: java.lang.NoSuchMethodError:
net.sf.json.JSONObject.put(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;

You need to add the JSON library to your build path. Follow this tutorial .. http://www.wikihow.com/Add-JARs-to-Project-Build-Paths-in-Eclipse-(Java)

Related

How to solve "java.lang.NoClassDefFoundError: org/json/JSONException"

I am using marionette driver for testing with selenium. when I run the code it gives me the error:
java.lang.NoClassDefFoundError: org/json/JSONException.
Also gives error :
Found argument '--webdriver-port' which wasn't expected, or isn't valid in this context
Please help for the same
I have used "java-json.jar" however now it's give the error "org.openqa.selenium.WebDriverException: java.net.ConnectException: Connection refused:" so can you suggest what issue is for the same
Try adding java-json/.jar in your classpath.
Download the jar from Jar link

errai GWT data binding getting failed

I am trying to run errai databinding in my GWT application
simply followed this tutorial , but with no luck
https://docs.jboss.org/author/display/ERRAI/Data+Binding
I am kept on getting errors, resolved some by adding some jars etc.
Now , I am getting this error which I am not able to resolve
[ERROR] Error generating BindableProxyLoaderImpl
java.lang.AbstractMethodError: org.jboss.errai.codegen.meta.MetaField.getDeclaringClassName()Ljava/lang/String;
Here is the screenshot of m console and the Jars i am using
Please guide
http://screencast.com/t/TdECCZNTxc

Caused by: org.dom4j.DocumentException: org.dom4j.DocumentFactory cannot be cast to org.dom4j.DocumentFactory

I've a gradle project which uses hibernate > 4 . If I run my war file in Apache tomcat, I don't get any error. But when I'm deploying it in Wildfly 8.2 , I get the following exception
Caused by: org.hibernate.InvalidMappingException: Error while parsing file: /G:/wildfly-8.2.0.Final/bin/content/mywar-1.0.war/WEB-INF/classes/com/mysite/
hbm/Role.hbm.xml
at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl.buildHibernateConfiguration(EntityManagerFactoryBuilderImpl.java:1182) [hibernate-ent
itymanager-4.3.7.Final.jar:4.3.7.Final]
at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl$4.perform(EntityManagerFactoryBuilderImpl.java:848) [hibernate-entitymanager-4.3.7.Fi
nal.jar:4.3.7.Final]
at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl$4.perform(EntityManagerFactoryBuilderImpl.java:845) [hibernate-entitymanager-4.3.7.Fi
nal.jar:4.3.7.Final]
at org.hibernate.boot.registry.classloading.internal.ClassLoaderServiceImpl.withTccl(ClassLoaderServiceImpl.java:398) [hibernate-core-4.3.7.Final.jar:4.
3.7.Final]
at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl.build(EntityManagerFactoryBuilderImpl.java:844) [hibernate-entitymanager-4.3.7.Final.
jar:4.3.7.Final]
at org.jboss.as.jpa.hibernate4.TwoPhaseBootstrapImpl.build(TwoPhaseBootstrapImpl.java:44) [jipijapa-hibernate4-3-1.0.1.Final.jar:]
at org.jboss.as.jpa.service.PersistenceUnitServiceImpl$1$1.run(PersistenceUnitServiceImpl.java:154) [wildfly-jpa-8.2.0.Final.jar:8.2.0.Final]
... 8 more
Caused by: org.hibernate.InvalidMappingException: Unable to read XML
at org.hibernate.internal.util.xml.MappingReader.legacyReadMappingDocument(MappingReader.java:375) [hibernate-core-4.3.7.Final.jar:4.3.7.Final]
at org.hibernate.internal.util.xml.MappingReader.readMappingDocument(MappingReader.java:304) [hibernate-core-4.3.7.Final.jar:4.3.7.Final]
at org.hibernate.cfg.Configuration.add(Configuration.java:518) [hibernate-core-4.3.7.Final.jar:4.3.7.Final]
at org.hibernate.cfg.Configuration.add(Configuration.java:514) [hibernate-core-4.3.7.Final.jar:4.3.7.Final]
at org.hibernate.cfg.Configuration.add(Configuration.java:688) [hibernate-core-4.3.7.Final.jar:4.3.7.Final]
at org.hibernate.cfg.Configuration.addInputStream(Configuration.java:726) [hibernate-core-4.3.7.Final.jar:4.3.7.Final]
at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl.buildHibernateConfiguration(EntityManagerFactoryBuilderImpl.java:1177) [hibernate-ent
itymanager-4.3.7.Final.jar:4.3.7.Final]
... 14 more
Caused by: org.dom4j.DocumentException: org.dom4j.DocumentFactory cannot be cast to org.dom4j.DocumentFactory Nested exception: org.dom4j.DocumentFactory cannot
be cast to org.dom4j.DocumentFactory
at org.dom4j.io.SAXReader.read(SAXReader.java:484) [dom4j-1.6.1.jar:1.6.1]
I just added a exclude in my Gradle file like
runtime.exclude group: "dom4j"
Now when I run gradle build, dom4j.jar is not created in the war file. Now I can run my deploy and run my project successfully on Wildfly 8.2 without any error. But the real problem starts here.
One of the feature in my project is that, it'll copy a file.xlsm to anotherfile.xlsm where I'm using jars like Apache Poi for those purposes. Here, Apache Poi is trying to access a method in dom4j.jar during file processing, it results in the following error
18:40:13,261 ERROR [io.undertow.request] (default task-29) UT005023: Exception handling request to /app/parentPath/myAction: org.springframework.web.util.NestedSe
rvletException: Handler processing failed; nested exception is java.lang.NoClassDefFoundError: org/dom4j/DocumentException
at org.springframework.web.servlet.DispatcherServlet.triggerAfterCompletionWithError(DispatcherServlet.java:1287) [spring-webmvc-4.1.4.RELEASE.jar:4.1.4
.RELEASE]
Any ideas how I can permanently use dom4j.jar inside my classpath? I've searched for many question and most of them suggested to remove dom4j from classpath. I do successfully run my program by removing it from classpath but it results in the above error during excel file processing. Wasted more than a day on this..!! IS it possible to include dom4j.jar in my classpath?
Update:
I've done a little trick in MANIFEST.MF file.
I've opened
mywar.war > META-INF > MANIFEST.MF
and added
Dependencies: org.dom4j export
at the end of the file and saved it. So if I deploy my war file, I'm successfully running it without any error.
Can someone explain where I've to add this kind of property in my src/ file so that it will be automatcially added to MANIFEST.MF after gradle build..
This exception on wildfly usually occurs when you include a hibernate lib in your war that's different from the wildfly one, since you are deploying to wildfly it already include hibernate so you can set you live as provided in gradle aka compileProvided and deploy without exporting the dependence.
If you still got the same error try declaring the hibernate dependency on manifest but keep the lib as provided it should work fine.
I had this same problem and i know how frustrating this one can be. I was able to resolve this problem. see my answer here. Hope this help

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

Exception in thread "main" java.lang.NoSuchMethodError: net.sf.jasperreports.engine.design.JasperDesign.setIgnorePagination(Z)V

I am new to dynamicreports, the example can be found at the link, but it gives me the following exception.
Please help me to find the issue.
Exception in thread "main" java.lang.NoSuchMethodError: net.sf.jasperreports.engine.design.JasperDesign.setIgnorePagination(Z)V
Regards
You must be sure that you are using the correct version of the libraries.
http://dynamicreports.sourceforge.net/requirements.html
In your case you have an error with jasperreports. With DynamicReports 3.0.2, the jasperreports correct version is 4.7.0 or above