Spring 3.1 NoClassDefFoundError ListableBeanFactory - eclipse

I am trying to upgrade an old project from Spring 2.5.6 to Spring 3.1.0. The project is not built with Maven so I had to add the jars manually to the build path.
The application uses Eclipse RAP as well as Spring.
I added all the Spring 3.1 jars in my build path:
lib/org.springframework.aop-3.1.0.RELEASE.jar
lib/org.springframework.asm-3.1.0.RELEASE.jar
lib/org.springframework.aspects-3.1.0.RELEASE.jar
lib/org.springframework.beans-3.1.0.RELEASE.jar
lib/org.springframework.context-3.1.0.RELEASE.jar
lib/org.springframework.context.support-3.1.0.RELEASE.jar
lib/org.springframework.core-3.1.0.RELEASE.jar
lib/org.springframework.expression-3.1.0.RELEASE.jar
lib/org.springframework.instrument-3.1.0.RELEASE.jar
lib/org.springframework.instrument.tomcat-3.1.0.RELEASE.jar
lib/org.springframework.jdbc-3.1.0.RELEASE.jar
lib/org.springframework.jms-3.1.0.RELEASE.jar
lib/org.springframework.orm-3.1.0.RELEASE.jar
lib/org.springframework.oxm-3.1.0.RELEASE.jar
lib/org.springframework.test-3.1.0.RELEASE.jar
lib/org.springframework.transaction-3.1.0.RELEASE.jar
lib/org.springframework.web-3.1.0.RELEASE.jar
lib/org.springframework.web.portlet-3.1.0.RELEASE.jar
lib/org.springframework.web.servlet-3.1.0.RELEASE.jar
lib/org.springframework.web.struts-3.1.0.RELEASE.jar
and I also listed them in the MANIFEST.MF.
The project builds fine, but at runtime when trying to login it gives me the following error:
java.lang.NoClassDefFoundError: org/springframework/beans/factory/ListableBeanFactory
I looked in the beans jar and the class is definitely there. I also searched through the project and the class is not used explicitly anywhere.
What could cause this? Thank you in advance.

This class does not exist in Spring 3.1.0. See http://www.jarfinder.com/index.php/java/info/org.springframework.beans.factory.ListableBeanFactory

Related

java.lang.ClassCastException: __redirected.__XMLInputFactory cannot be cast to org.codehaus.stax2.XMLInputFactory2

I am migration Java Web Application from jboss 6.0 to wildfly 11. I am getting
"java.lang.ClassCastException: __redirected.__XMLInputFactory cannot
be cast to org.codehaus.stax2.XMLInputFactory2" while running the code
on wildfly 11.0.0.Final. Junit tests are working without error.
Looks like there is some dependency issue in wildfly but unable to find any solution. Appreciate any help to resolve this issue..
I have included following woodstox dependencies in pom.
woodstox-core-asl 4.4.1
stax2-api 3.1.4
Thanks
Sanjay
This is caused by duplicate classes in the classpath.
Wildfly ships stax2-api as part of the woodstocks module, see modules/system/layers/base/org/codehaus/woodstox/main/ in the wildfly dist folder.
If you also have it in your application's lib folder, this will cause issues.
The solution is to either set the dependency to <scope>provided</scope> (or build) in pom.xml, or if you really need a special version, exclude wildfly's module via jboss-deployment-structure.xml.
See https://docs.jboss.org/author/display/WFLY10/Class+Loading+in+WildFly for more information on classloading in Wildfly.

Unable to import RestBuilder to Grails 2.4.5 project

We are using Grails 2.4.5 and are trying to use the RestBuilder class to implement some functional tests for our REST API's.
I have included compile "org.grails.plugins:rest-client-builder:2.1.1" in the BuildConfig.groovy file.
I can see that the plugin is downloaded but do not see the RestBuilder class in any src directory. I also do not see any references to other dependencies that might include RestBuilder.
Could this be an issue when the plugin was upgraded/moved for Grails 3.x?
Thanks,
Kathy
Could this be an issue when the plugin was upgraded/moved for Grails
3.x?
No.
You are expressing a dependency on org.grails.plugins:rest-client-builder:2.1.1 which depends on org.grails:grails-datastore-rest-client:3.1.4.RELEASE and that is where grails.plugins.rest.client.RestBuilder is coming from. You should see the corresponding jar file under your home directory in /.grails/ivy-cache/org.grails/grails-datastore-rest-client/jars/grails-datastore-rest-client-3.1.4.RELEASE.jar.

OSGI Bundle implementing JPA Using DataNucleus 4.0.0 Release

I am trying to implement JPA using DataNucleus in an OSGI Environment (Apache ServiceMix). I am following the guide mentioned here - http://www.datanucleus.org/products/datanucleus/jpa/osgi.html (Section under Name "JPA and OSGi")
As per the documentation here I am using the DataNucleus JPA jar. So I have Deployed this Jar on ServiceMix as follows -
osgi:install mvn:org.datanucleus/datanucleus-jpa/2.1.7
osgi:start bundleId
As this jar export the persistence provider,I have correctly changed the provider in my persistence.xml file to be org.datanucleus.jpa.PersistenceProviderImpl (which is exported by the above bundle) rather than usual org.datanucleus.api.jpa.PersistenceProviderImpl which is in a normal J2EE JPA APP.
I also have the DataNucleus Core Bundle running on my ServiceMix, which was installed on my ServiceMix using the following -
osgi:install mvn:org.datanucleus/datanucleus-core/4.0.0-release
osgi:start bundleId
Please Note: I donot have the datanucleus-api-jpa bundle running on my ServiceMix, as per the documentation, the datanucleus-jpa bundle would export the necessary classes and hence datanucleus-api-jpa bundle would not be required.
At runtime, I am getting the following error Caused by: java.lang.ClassNotFoundException: org.datanucleus.PersistenceConfiguration not found by org.datanucleus.jpa [261]
What I have noticed is that the DataNucleus Core version 4.0.0-release does not have this class, but this class exists in all previous releases (3.2.15).
I cannot deploy DataNucleus Core Version 3.2.XX onto my ServiceMix, because I have other bundles using DataNucleus Core 4.0.0-release and having both is not an option because of Singleton Creation problems.
Please let me know, if you need me to post my code, I will do so.
Please help
Cheers,
Abhijit
In conclusion, you are using incorrect/invalid jars. "datanucleus-jpa" was removed back in v2 of DataNucleus. All recent versions using "datanucleus-api-jpa" (or "datanucleus-api-jdo" if using JDO). A simple download of the DataNucleus zip file for 4.0.x would show this very clearly.

java.lang.ClassNotFoundException for a class in external JAR

I have a maven project in Eclipse Java EE IDE for Web Developers.
When running Tomcat, I'm getting an error for a class that I can see that I have included.
My question is - do I have to add these JARs to an additional place because of Tomcat Apache?
Error:
SEVERE: Servlet /Resource threw load() exception
java.lang.ClassNotFoundException: org.odata4j.jersey.producer.resources.ODataApplication
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1714)
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1559)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:171)
at com.sun.jersey.core.reflection.ReflectionHelper.classForNameWithException(ReflectionHelper.java:240)
at com.sun.jersey.core.reflection.ReflectionHelper.classForNameWithException(ReflectionHelper.java:220)
at com.sun.jersey.spi.container.servlet.WebComponent.createResourceConfig(WebComponent.java:711)
And here is the class in my Library:
UPDATE:
My Web Deployment Assembly looks like:
The issue you are seeing is due to the fact that tomcat is looking at the wrong directory. It is currently most likely pointed at your src/main/webapp directory of your project. This does not jive with how maven works. Maven downloads the dependencies, but will only include them in the target build. You need to have the tomcat server look at target/myapp-0.0.1, or build to a war and deploy that way. The easiest solution as of now, would be for you to use the tomcat plugin. After setting it up, you can use an imbedded server, and just use the following command 'mvn tomcat:run'.
Maven Tomcat Plugin Docs
UPDATE:
I looked at the properties settings, and you should actually be able to edit the "Web Deployment Assembly" settings for your project (under project properties). Check screenshot for how I have mine setup. Notice how Maven Dependencies is mapped.
http://imgur.com/ofxryns

Unable to generate metamodel definitions using DataNucleus JPACriteriaProcessor from Eclipse

I'm trying to generate the metamodel definitions in Eclipse as documented on:
http://www.datanucleus.org/products/accessplatform/jpa/jpql_criteria.html
My project compiler level is set to 1.6 and the mentioned datanucleus jars are added to the factory path.
When the project builds I get the following error:
Errors occurred during the build.
Errors running builder 'Java Builder' on project 'X'.
Could not initialize class org.datanucleus.jpa.query.JPACriteriaProcessor
When using mvn compile the metamodel definitions are generated successfully, so it's probably related to Eclipse annnotation processing.
I'm using latest Spring Tool Suite 3.1.0.RELEASE based on Eclipse 4.2.1
Not put persistence-api.jar (or equivalent, such as Geronimo specs JPA2) in the Factory Path? Either way one of the deps is missing