Results 1 to 3 of 3
  1. #1
    ishakteyran is offline Member
    Join Date
    Dec 2007
    Posts
    11
    Rep Power
    0

    Default JPA application noclassdeffound error

    hello to all,

    i am developing my first JPA application on RAD 7.5.5 windows vista business, and using websphere application server 7.0 .

    using RAD , i created a JPA application and i created my entities and entity managers as well successfully, then for trying to actually manipulate my data, i created a Deneme.java which has the code
    Java Code:
    package source;
    
    import entities.controller.*;
    import entities.*;
    
    import javax.persistence.*;
    
    public class Deneme {
    	
    
    	public static void main(String[] args) {
    		
    		EntityManager em = Persistence.createEntityManagerFactory("Dene").createEntityManager();
    		System.out.print("success");
    
    	}
    
    }
    and i made the application run as java application but it gave the following error :

    ------------------------------------------

    Exception in thread "main" java.lang.NoClassDefFoundError: org.apache.commons.collections.set.MapBackedSet
    at org.apache.openjpa.lib.util.concurrent.ConcurrentR eferenceHashSet.<init>(ConcurrentReferenceHashSet. java:68)
    at org.apache.openjpa.kernel.AbstractBrokerFactory.ne wBrokerSet(AbstractBrokerFactory.java:486)
    at org.apache.openjpa.kernel.AbstractBrokerFactory.<i nit>(AbstractBrokerFactory.java:148)
    at org.apache.openjpa.jdbc.kernel.JDBCBrokerFactory.< init>(JDBCBrokerFactory.java:87)
    at com.ibm.ws.persistence.jdbc.kernel.WsJpaJDBCBroker Factory.<init>(WsJpaJDBCBrokerFactory.java:77)
    at com.ibm.ws.persistence.jdbc.kernel.WsJpaJDBCBroker Factory.newInstance(WsJpaJDBCBrokerFactory.java:12 2)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Nativ e Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Native MethodAccessorImpl.java:48)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(De legatingMethodAccessorImpl.java:37)
    at java.lang.reflect.Method.invoke(Method.java:600)
    at org.apache.openjpa.kernel.Bootstrap.invokeFactory( Bootstrap.java:124)
    at org.apache.openjpa.kernel.Bootstrap.newBrokerFacto ry(Bootstrap.java:62)
    at org.apache.openjpa.persistence.PersistenceProvider Impl.getBrokerFactory(PersistenceProviderImpl.java :102)
    at org.apache.openjpa.persistence.PersistenceProvider Impl.createEntityManagerFactory(PersistenceProvide rImpl.java:81)
    at com.ibm.websphere.persistence.PersistenceProviderI mpl.createEntityManagerFactory(PersistenceProvider Impl.java:71)
    at com.ibm.websphere.persistence.PersistenceProviderI mpl.createEntityManagerFactory(PersistenceProvider Impl.java:41)
    at org.apache.openjpa.persistence.PersistenceProvider Impl.createEntityManagerFactory(PersistenceProvide rImpl.java:109)
    at org.apache.openjpa.persistence.PersistenceProvider Impl.createEntityManagerFactory(PersistenceProvide rImpl.java:53)
    at javax.persistence.Persistence.createFactory(Persis tence.java:172)
    at javax.persistence.Persistence.createEntityManagerF actory(Persistence.java:112)
    at javax.persistence.Persistence.createEntityManagerF actory(Persistence.java:66)
    at source.Deneme.main(Deneme.java:20)
    Caused by: java.lang.ClassNotFoundException: org.apache.commons.collections.set.MapBackedSet
    at java.net.URLClassLoader.findClass(URLClassLoader.j ava:421)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:6 43)
    at sun.misc.Launcher$AppClassLoader.loadClass(Launche r.java:346)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:6 09)
    ... 22 more
    --------------------------------------------------

    using the first line of the exception i made asearch on google and i found the suggestion on [this forum post | ]JavaWorld Forums: Digester hanging on new Digester() ?! and copied commons collectins, beanutils, digester, logging and openjpa latest zip file to the build path of my application.

    and i made the aplication run. but still i get the very same error :(

    if it will make any help here is also the persistence.xml contents
    Java Code:
    <?xml version="1.0" encoding="UTF-8"?>
    <persistence version="1.0" xmlns="http://java.sun.com/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd">
    	<persistence-unit name="Dene">
    		<jta-data-source>jdbc/DeneJPA</jta-data-source>
    		<class>entities.Child</class>
    		<class>entities.Parent</class>
    		<properties>
    			<property name="openjpa.jdbc.Schema" value="Schema"/>
    		</properties>
    	</persistence-unit>
    </persistence>
    can anyone please suggest me how to come over of this problem ?

    thank you

  2. #2
    FON
    FON is offline Senior Member
    Join Date
    Dec 2009
    Location
    Belgrade, Serbia
    Posts
    364
    Rep Power
    5

    Default

    Can you create new class and make instance of
    org.apache.commons.collections.set.MapBackedSet ?

    I guess you took
    commons-collections-3.2.1
    and place it on your build path with no problems

    If that it OK than it looks like there is some bootstrap problem with openjpa.

    Maybe you could try to find some help about resources for your projects here:

    IBM WebSphere Developer Technical Journal: Leveraging OpenJPA with WebSphere Application Server V6.1

  3. #3
    ishakteyran is offline Member
    Join Date
    Dec 2007
    Posts
    11
    Rep Power
    0

    Default solution and track to this post

    hello to all,

    sorry for my late reply, but i was working on this kind of errors all the past days even nights, and i asked the same question on IBM developerworks forum too, and now the only problem remains to be jpa enhancer, for those who want to catch up with what happened with this error and thereafter, here is the link for the thread in developerworks forum.

    if you have any suggestion about jpa enhancer mentioned there, you can either reply here or there, i will also share the result on both forums.

Similar Threads

  1. Error, trying to deploy a web application
    By aspmedeiros in forum NetBeans
    Replies: 2
    Last Post: 03-23-2012, 08:29 AM
  2. JPA application noclassdeffound error
    By ishakteyran in forum Enterprise JavaBeans (EJB)
    Replies: 0
    Last Post: 03-11-2010, 12:34 AM
  3. Replies: 1
    Last Post: 07-22-2009, 11:00 PM
  4. java.lang.NoClassDefFound --Any way to handle this
    By sunny_sykes in forum Advanced Java
    Replies: 1
    Last Post: 03-30-2009, 08:29 AM
  5. Application error
    By saso1310 in forum CLDC and MIDP
    Replies: 1
    Last Post: 10-16-2008, 07:18 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •