Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [eclipselink-users] NoClassDefFoundError: javax/transaction/Synchronization

I have javaee.jar in my classpath (both client and ejb module) and when I swich to TopLink (just change persistence.xml) the error does not occur. Therefore I am trying to find out whether it is some silly problem with my classpath or some eclipselink issue.
For testing ejb layer I have simple client using JUnit.

Furthermore, eclipselink first worked, but container managed transactions were not (but I was able to retrieve data and to manualy manage transactions).
Then I added <property name="eclipselink.target-server" value="SunAS9"/> to persistence.xml. Then this error occured.

source code is below,
stack trace is here:

compile:
compile-test-single:
Testsuite: clinttest.junit.TestEJB
        java.rmi.RemoteException: null; nested exception is:
        java.lang.NoClassDefFoundError: javax/transaction/Synchronization)
Tests run: 1, Failures: 0, Errors: 1, Time elapsed: 4,42 sec

Testcase: testEJBUpdate(clinttest.junit.TestEJB):    Caused an ERROR
nested exception is: java.rmi.ServerException: RemoteException occurred in server thread; nested exception is:
        java.rmi.RemoteException: null; nested exception is:
        java.lang.NoClassDefFoundError: javax/transaction/Synchronization
javax.ejb.EJBException: nested exception is: java.rmi.ServerException: RemoteException occurred in server thread; nested exception is:
        java.rmi.RemoteException: null; nested exception is:
        java.lang.NoClassDefFoundError: javax/transaction/Synchronization
java.rmi.ServerException: RemoteException occurred in server thread; nested exception is:
        java.rmi.RemoteException: null; nested exception is:
        java.lang.NoClassDefFoundError: javax/transaction/Synchronization
        at com.sun.corba.ee.impl.javax.rmi.CORBA.Util.mapSystemException(Util.java:243)
        at com.sun.corba.ee.impl.presentation.rmi.StubInvocationHandlerImpl.privateInvoke(StubInvocationHandlerImpl.java:205)
        at com.sun.corba.ee.impl.presentation.rmi.StubInvocationHandlerImpl.invoke(StubInvocationHandlerImpl.java:152)
        at com.sun.corba.ee.impl.presentation.rmi.bcel.BCELStubBase.invoke(BCELStubBase.java:225)
        at org.testejb.toplink.__CompaniesFacadeRemote_Remote_DynamicStub.find(org/testejb/toplink/__CompaniesFacadeRemote_Remote_DynamicStub.java)
        at org.testejb.toplink._CompaniesFacadeRemote_Wrapper.find(org/testejb/toplink/_CompaniesFacadeRemote_Wrapper.java)
        at clinttest.junit.TestEJB.setUp(TestEJB.java:37)
Caused by: java.rmi.RemoteException: null; nested exception is:
        java.lang.NoClassDefFoundError: javax/transaction/Synchronization
        at com.sun.enterprise.iiop.POAProtocolMgr.mapException(POAProtocolMgr.java:251)
        at com.sun.ejb.containers.BaseContainer.postInvoke(BaseContainer.java:1386)
        at com.sun.ejb.containers.BaseContainer.postInvoke(BaseContainer.java:1316)
        at com.sun.ejb.containers.EJBObjectInvocationHandler.invoke(EJBObjectInvocationHandler.java:210)
        at com.sun.ejb.containers.EJBObjectInvocationHandlerDelegate.invoke(EJBObjectInvocationHandlerDelegate.java:117)
        at $Proxy54.find(Unknown Source)
        at com.sun.corba.ee.impl.presentation.rmi.ReflectiveTie._invoke(ReflectiveTie.java:154)
        at com.sun.corba.ee.impl.protocol.CorbaServerRequestDispatcherImpl.dispatchToServant(CorbaServerRequestDispatcherImpl.java:687)
        at com.sun.corba.ee.impl.protocol.CorbaServerRequestDispatcherImpl.dispatch(CorbaServerRequestDispatcherImpl.java:227)
        at com.sun.corba.ee.impl.protocol.CorbaMessageMediatorImpl.handleRequestRequest(CorbaMessageMediatorImpl.java:1846)
        at com.sun.corba.ee.impl.protocol.CorbaMessageMediatorImpl.handleRequest(CorbaMessageMediatorImpl.java:1706)
        at com.sun.corba.ee.impl.protocol.CorbaMessageMediatorImpl.handleInput(CorbaMessageMediatorImpl.java:1088)
        at com.sun.corba.ee.impl.protocol.giopmsgheaders.RequestMessage_1_2.callback(RequestMessage_1_2.java:223)
        at com.sun.corba.ee.impl.protocol.CorbaMessageMediatorImpl.handleRequest(CorbaMessageMediatorImpl.java:806)
        at com.sun.corba.ee.impl.protocol.CorbaMessageMediatorImpl.dispatch(CorbaMessageMediatorImpl.java:563)
        at com.sun.corba.ee.impl.protocol.CorbaMessageMediatorImpl.doWork(CorbaMessageMediatorImpl.java:2567)
        at com.sun.corba.ee.impl.orbutil.threadpool.ThreadPoolImpl$WorkerThread.run(ThreadPoolImpl.java:555)
Caused by: java.lang.NoClassDefFoundError: javax/transaction/Synchronization
        at java.lang.ClassLoader.defineClass1(Native Method)
        at java.lang.ClassLoader.defineClass(ClassLoader.java:620)
        at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:124)
        at java.net.URLClassLoader.defineClass(URLClassLoader.java:260)
        at java.net.URLClassLoader.access$100(URLClassLoader.java:56)
        at java.net.URLClassLoader$1.run(URLClassLoader.java:195)
        at java.security.AccessController.doPrivileged(Native Method)
        at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
        at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:268)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
        at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:319)
        at org.eclipse.persistence.transaction.JTATransactionController.<init>(JTATransactionController.java:60)
        at org.eclipse.persistence.transaction.sunas.SunAS9TransactionController.<init>(SunAS9TransactionController.java:36)
        at java.lang.reflect.Constructor.newInstance(Constructor.java:494)
        at java.lang.Class.newInstance0(Class.java:350)
        at java.lang.Class.newInstance(Class.java:303)
        at org.eclipse.persistence.internal.security.PrivilegedAccessHelper.newInstanceFromClass(PrivilegedAccessHelper.java:331)
        at org.eclipse.persistence.platform.server.ServerPlatformBase.initializeExternalTransactionController(ServerPlatformBase.java:241)
        at org.eclipse.persistence.internal.sessions.DatabaseSessionImpl.preConnectDatasource(DatabaseSessionImpl.java:628)
        at org.eclipse.persistence.internal.sessions.DatabaseSessionImpl.loginAndDetectDatasource(DatabaseSessionImpl.java:567)
        at org.eclipse.persistence.internal.jpa.EntityManagerFactoryProvider.login(EntityManagerFactoryProvider.java:209)
        at org.eclipse.persistence.internal.jpa.EntityManagerSetupImpl.deploy(EntityManagerSetupImpl.java:246)
        at org.eclipse.persistence.internal.jpa.EntityManagerFactoryImpl.getServerSession(EntityManagerFactoryImpl.java:69)
        at org.eclipse.persistence.internal.jpa.EntityManagerFactoryImpl.createEntityManagerImpl(EntityManagerFactoryImpl.java:118)
        at org.eclipse.persistence.internal.jpa.EntityManagerFactoryImpl.createEntityManager(EntityManagerFactoryImpl.java:108)
        at com.sun.enterprise.util.EntityManagerWrapper._getDelegate(EntityManagerWrapper.java:326)
        at com.sun.enterprise.util.EntityManagerWrapper.find(EntityManagerWrapper.java:546)
        at org.testejb.toplink.CompaniesFacade.find(CompaniesFacade.java:35)
        at com.sun.enterprise.security.application.EJBSecurityManager.runMethod(EJBSecurityManager.java:1067)
        at com.sun.enterprise.security.SecurityUtil.invoke(SecurityUtil.java:176)
        at com.sun.ejb.containers.BaseContainer.invokeTargetBeanMethod(BaseContainer.java:2895)
        at com.sun.ejb.containers.BaseContainer.intercept(BaseContainer.java:3986)
        at com.sun.ejb.containers.EJBObjectInvocationHandler.invoke(EJBObjectInvocationHandler.java:203)
javax.ejb.EJBException: nested exception is: java.rmi.ServerException: RemoteException occurred in server thread; nested exception is:
        java.rmi.RemoteException: null; nested exception is:
        java.lang.NoClassDefFoundError: javax/transaction/Synchronization
        at org.testejb.toplink._CompaniesFacadeRemote_Wrapper.find(org/testejb/toplink/_CompaniesFacadeRemote_Wrapper.java)
        at clinttest.junit.TestEJB.setUp(TestEJB.java:37)


Test clinttest.junit.TestEJB FAILED

----------------------------------------
----- session facade file is here:
----------------------------------------

package org.testejb.toplink;

import java.util.List;
import javax.ejb.Stateless;
import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;

@Stateless
public class CompaniesFacade implements CompaniesFacadeRemote {
    @PersistenceContext
    private EntityManager em;
   
    public void create(Companies companies) {
        em.persist(companies);
    }
   
    public void edit(Companies companies) {
        em.merge(companies);
    }

    public void remove(Companies companies) {
        em.remove(em.merge(companies));
    }

    public Companies find(Object id) {
        return em.find(org.testejb.toplink.Companies.class, id);
    }

    public List<Companies> findAll() {
        return em.createQuery("select object(o) from Companies as o").getResultList();
    }

}

--------------------------------------
---------------------junit test file:
--------------------------------------

package clinttest.junit;

import org.junit.After;
import org.junit.AfterClass;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;
import javax.naming.InitialContext;
import junit.framework.TestCase;
import org.junit.Assert;
import org.testejb.toplink.Companies;
import org.testejb.toplink.CompaniesFacadeRemote;

/**
 *
 * @author kubicekm
 */
public class TestEJB extends TestCase{
private CompaniesFacadeRemote compFacade;
private Companies c46;

    public TestEJB() {
    }

    @BeforeClass
    public static void setUpClass() throws Exception {
    }

    @AfterClass
    public static void tearDownClass() throws Exception {
    }

    @Before
    public void setUp() throws Exception{
        InitialContext ctx = new InitialContext();
        compFacade = (CompaniesFacadeRemote) ctx.lookup("org.testejb.toplink.CompaniesFacadeRemote");
        c46 = compFacade.find(46);
    }

    @After
    public void tearDown() {
    }
   
    @Test
    public void testEJBUpdate (){
        String oldNotes = c46.getNotes();
        c46.setNotes(oldNotes.concat(" edited"));
        compFacade.edit(c46);
        Companies c46edited = compFacade.find(46);
        Assert.assertTrue(!oldNotes.equals(c46edited.getNotes()));
        Assert.assertEquals(c46, c46edited); //should still equal, ids equal
    }
}



On Mon, Sep 22, 2008 at 3:42 PM, James Sutherland <jamesssss@xxxxxxxxx> wrote:

Ensure you have the JTA or JavaEE jar on your classpath, including your
client classpath.

Also ensure it is visible to EclipseLink, where did you put the
eclipselink.jar in your server?  Is the error raised from EclipseLink or
somewhere else, include the full stack and enable logging in EclipseLink to
see the error on the server side.



miroslav. wrote:
>
> Hello,
>
> please could anyone help me - I am receiving this error:
>
>         java.rmi.RemoteException: null; nested exception is:
>         java.lang.NoClassDefFoundError: javax/transaction/Synchronization
>
> I'm using glassfish 2u2, eclipselink, Oracle db and NetBeans 6.1 as IDE.
> I've got a simple application: an entity and a stateless session facade.
> It does work when using default TopLink, but when I swich to Eclipselink,
> container managed transactions stop working and I get this error. The
> error is fired when I invoke first EntityManager.find method.
>
> my persistence.xml:
>
> <?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="TestEJB_TLPU" transaction-type="JTA">
>     <provider>org.eclipse.persistence.jpa.PersistenceProvider</provider>
>     <jta-data-source>hpd</jta-data-source>
>     <properties>
>       <property name="eclipselink.target-server" value="SunAS9"/>
>     </properties>
>   </persistence-unit>
> </persistence>
>
> Thanks very much in advance
> Rgds
> Miroslav
>
>


-----
---
http://wiki.eclipse.org/User:James.sutherland.oracle.com James Sutherland
http://www.eclipse.org/eclipselink/
 EclipseLink ,  http://www.oracle.com/technology/products/ias/toplink/
TopLink
Wiki:  http://wiki.eclipse.org/EclipseLink EclipseLink ,
http://wiki.oracle.com/page/TopLink TopLink
Forums:  http://forums.oracle.com/forums/forum.jspa?forumID=48 TopLink ,
http://www.nabble.com/EclipseLink-f26430.html EclipseLink
Book:  http://en.wikibooks.org/wiki/Java_Persistence Java Persistence
--
View this message in context: http://www.nabble.com/NoClassDefFoundError%3A-javax-transaction-Synchronization-tp19604774p19608204.html
Sent from the EclipseLink - Users mailing list archive at Nabble.com.

_______________________________________________
eclipselink-users mailing list
eclipselink-users@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/eclipselink-users


Back to the top