10 Replies Latest reply on Jun 27, 2008 12:29 PM by chris wang

    Is this a JBoss bug?

    Duc Nguyen Newbie

      I'm try to create an EJB3, hosted with JBoss. This is the steps that I have been taking by now:

      JBoss 4.2.2 GA
      J2EE 5 U3 with JDK 1.6
      MyEclipse 5.5
      MS SQL 2005 Express

      Step 1: Create a new EJB Project AdminEJB with MyEclipse, Choose J2EE 5.0, setup connection driver and schema

      Step 2: Use MyEclipse Derby to browse the database

      Step 3: Use EJB3 Reverse Engineering to generate Beans from a table Admin [Username nvarchar(20) Pk, Password nvarchar(20)] (see the generated class)

      /*****************************
      * Admin Entity bean
      ******************************/
      
      /**
       * Admin generated by MyEclipse Persistence Tools
       */
      @Entity
      @Table(name = "Admin", schema = "dbo", catalog = "TungaRestaurant", uniqueConstraints = {})
      public class Admin implements java.io.Serializable {
      
       private String username;
       private String password;
      
       /** default constructor */
       public Admin() {
       }
      
       /** full constructor */
       public Admin(String username, String password) {
       this.username = username;
       this.password = password;
       }
      
       // Property accessors
       @Id
       @Column(name = "Username", unique = true, nullable = false, insertable = true, updatable = true, length = 20)
       public String getUsername() {
       return this.username;
       }
      
       public void setUsername(String username) {
       this.username = username;
       }
      
       @Column(name = "Password", unique = false, nullable = false, insertable = true, updatable = true, length = 20)
       public String getPassword() {
       return this.password;
       }
      
       public void setPassword(String password) {
       this.password = password;
       }
      
      }
      
      /*****************************
      * Admin Facade
      ******************************/
      
      /**
       * Facade for entity Admin.
       */
      @Stateless
      public class AdminFacade implements AdminFacadeLocal, AdminFacadeRemote {
       // property constants
       public static final String PASSWORD = "password";
      
       @PersistenceContext
       private EntityManager entityManager;
      
       public void save(Admin transientInstance) {
       EntityManagerHelper.log("saving Admin instance", Level.INFO, null);
       try {
       entityManager.persist(transientInstance);
       EntityManagerHelper.log("save successful", Level.INFO, null);
       } catch (RuntimeException re) {
       EntityManagerHelper.log("save failed", Level.SEVERE, re);
       throw re;
       }
       }
      
       public void delete(Admin persistentInstance) {
       EntityManagerHelper.log("deleting Admin instance", Level.INFO, null);
       try {
       entityManager.remove(persistentInstance);
       EntityManagerHelper.log("delete successful", Level.INFO, null);
       } catch (RuntimeException re) {
       EntityManagerHelper.log("delete failed", Level.SEVERE, re);
       throw re;
       }
       }
      
       public Admin update(Admin detachedInstance) {
       EntityManagerHelper.log("updating Admin instance", Level.INFO, null);
       try {
       Admin result = entityManager.merge(detachedInstance);
       EntityManagerHelper.log("update successful", Level.INFO, null);
       return result;
       } catch (RuntimeException re) {
       EntityManagerHelper.log("update failed", Level.SEVERE, re);
       throw re;
       }
       }
      
       public Admin findById(String id) {
       EntityManagerHelper.log("finding Admin instance with id: " + id,
       Level.INFO, null);
       try {
       Admin instance = entityManager.find(Admin.class, id);
       return instance;
       } catch (RuntimeException re) {
       EntityManagerHelper.log("find failed", Level.SEVERE, re);
       throw re;
       }
       }
      
       @SuppressWarnings("unchecked")
       public List<Admin> findByProperty(String propertyName, Object value) {
       EntityManagerHelper.log("finding Admin instance with property: "
       + propertyName + ", value: " + value, Level.INFO, null);
       try {
       String queryString = "select model from Admin model where model."
       + propertyName + "= :propertyValue";
       return entityManager.createQuery(queryString).setParameter(
       "propertyValue", value).getResultList();
       } catch (RuntimeException re) {
       EntityManagerHelper.log("find by property name failed",
       Level.SEVERE, re);
       throw re;
       }
       }
      
       public List<Admin> findByPassword(Object password) {
       return findByProperty(PASSWORD, password);
       }
      
       @SuppressWarnings("unchecked")
       public List<Admin> findAll() {
       EntityManagerHelper
       .log("finding all Admin instances", Level.INFO, null);
       try {
       String queryString = "select model from Admin model";
       return entityManager.createQuery(queryString).getResultList();
       } catch (RuntimeException re) {
       EntityManagerHelper.log("find all failed", Level.SEVERE, re);
       throw re;
       }
       }
      }
      
      /*****************************
      * Local and Remote interfaces
      ******************************/
      
      @Local
      public interface AdminFacadeLocal {
       public void save(Admin transientInstance);
       public void delete(Admin persistentInstance);
       public Admin update(Admin detachedInstance);
       public Admin findById(String id);
       public List findByProperty(String propertyName, Object value);
       public List findByPassword(Object password);
      }
      
      @Remote
      public interface AdminFacadeRemote {
       public void save(Admin transientInstance);
       public void delete(Admin persistentInstance);
       public Admin update(Admin detachedInstance);
       public Admin findById(String id);
       public List findByProperty(String propertyName, Object value);
       public List findByPassword(Object password);
      }


      Step 3.1: Create persistence.xml

      <?xml version="1.0" encoding="UTF-8"?>
      <persistence 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" version="1.0">
      
       <persistence-unit name="AdminEJB" transaction-type="JTA">
       <jta-data-source>java:/MyDB</jta-data-source>
       </persistence-unit>
      
      </persistence>


      Step 4: Config Application Server JBoss 4.x

      Step 4.1: copy sqljdbc.jar to server/default/lib

      Step 4.2: Create datasource file: mssql-ds.xml
      <?xml version="1.0" encoding="UTF-8"?>
      
      <datasources>
       <local-tx-datasource>
      
       <jndi-name>MyDB</jndi-name>
      
       <connection-url>jdbc:sqlserver://DUCNGUYEN-PC\\SQLEXPRESS:49378;database=AdventureWorks;</connection-url>
      
       <!-- The driver class -->
       <driver-class>com.microsoft.sqlserver.jdbc.SQLServerDriver</driver-class>
      
       <!-- The login and password -->
       <user-name>sa</user-name>
       <password></password>
      
       </local-tx-datasource>
      </datasources>


      Step 5: Deloy AdminEJB within JBoss, start server (Everything is ok)

      Step 6: Create a new Java Project with MyEclipse
      referenced build path all the jar file in JBOSS_HOME\client
      reference the deploy jar file con server/default/deploy

      Step 7: Create jndi.properties in src folder with the following content:
      java.naming.factory.initial=org.jnp.interfaces.NamingContextFactory
      java.naming.factory.url.pkgs=org.jboss.naming:org.jnp.interfaces
      java.naming.provider.url=localhost:1099

      Step 8: Create log4j.properties in src folder with the following content
      log4j.appender.stdout=org.apache.log4j.ConsoleAppender
      log4j.appender.stdout.Target=System.out
      log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
      log4j.appender.stdout.layout.ConversionPattern=%d{ABSOLUTE} %5p %c{1}:%L - %m%n
      log4j.rootLogger=debug, stdout

      Step 9: create TestClient.java

      public class TestClient {
      
       /**
       * @param args
       */
       public static void main(String[] args) {
       Context context;
       try
       {
       context = new InitialContext();
      
       AdminFacadeRemote adminMan = (AdminFacadeRemote)context.lookup(AdminFacade.RemoteJNDIName);
      
       Admin admin = new Admin("admin","123");
       adminMan.save(admin);
      
       } catch (NamingException e)
       {
       e.printStackTrace();
       }
      
       }
      }


      Step 10: Run the client, this is when the funny thing happened, the first time when client runs, it gets java.lang.ExceptionInInitializerError
      Please look at the stack trace
      Exception in thread "main" javax.ejb.EJBException: java.lang.RuntimeException: java.lang.ExceptionInInitializerError
       at org.jboss.ejb3.tx.Ejb3TxPolicy.handleExceptionInOurTx(Ejb3TxPolicy.java:63)
       at org.jboss.aspects.tx.TxPolicy.invokeInOurTx(TxPolicy.java:83)
       at org.jboss.aspects.tx.TxInterceptor$Required.invoke(TxInterceptor.java:191)
       at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
       at org.jboss.aspects.tx.TxPropagationInterceptor.invoke(TxPropagationInterceptor.java:76)
       at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
       at org.jboss.ejb3.stateless.StatelessInstanceInterceptor.invoke(StatelessInstanceInterceptor.java:62)
       at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
       at org.jboss.aspects.security.AuthenticationInterceptor.invoke(AuthenticationInterceptor.java:77)
       at org.jboss.ejb3.security.Ejb3AuthenticationInterceptor.invoke(Ejb3AuthenticationInterceptor.java:106)
       at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
       at org.jboss.ejb3.ENCPropagationInterceptor.invoke(ENCPropagationInterceptor.java:46)
       at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
       at org.jboss.ejb3.asynchronous.AsynchronousInterceptor.invoke(AsynchronousInterceptor.java:106)
       at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
       at org.jboss.ejb3.stateless.StatelessContainer.dynamicInvoke(StatelessContainer.java:278)
       at org.jboss.aop.Dispatcher.invoke(Dispatcher.java:106)
       at org.jboss.aspects.remoting.AOPRemotingInvocationHandler.invoke(AOPRemotingInvocationHandler.java:82)
       at org.jboss.remoting.ServerInvoker.invoke(ServerInvoker.java:734)
       at org.jboss.remoting.transport.socket.ServerThread.processInvocation(ServerThread.java:560)
       at org.jboss.remoting.transport.socket.ServerThread.dorun(ServerThread.java:369)
       at org.jboss.remoting.transport.socket.ServerThread.run(ServerThread.java:165)
      Caused by: java.lang.RuntimeException: java.lang.ExceptionInInitializerError
       at org.jboss.ejb3.interceptor.InvocationContextImpl.proceed(InvocationContextImpl.java:174)
       at org.jboss.ejb3.interceptor.EJB3InterceptorsInterceptor.invoke(EJB3InterceptorsInterceptor.java:63)
       at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
       at org.jboss.ejb3.entity.TransactionScopedEntityManagerInterceptor.invoke(TransactionScopedEntityManagerInterceptor.java:54)
       at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
       at org.jboss.ejb3.AllowedOperationsInterceptor.invoke(AllowedOperationsInterceptor.java:47)
       at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
       at org.jboss.aspects.tx.TxPolicy.invokeInOurTx(TxPolicy.java:79)
       at org.jboss.aspects.tx.TxInterceptor$Required.invoke(TxInterceptor.java:191)
       at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
       at org.jboss.aspects.tx.TxPropagationInterceptor.invoke(TxPropagationInterceptor.java:76)
       at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
       at org.jboss.ejb3.stateless.StatelessInstanceInterceptor.invoke(StatelessInstanceInterceptor.java:62)
       at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
       at org.jboss.aspects.security.AuthenticationInterceptor.invoke(AuthenticationInterceptor.java:77)
       at org.jboss.ejb3.security.Ejb3AuthenticationInterceptor.invoke(Ejb3AuthenticationInterceptor.java:106)
       at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
       at org.jboss.ejb3.ENCPropagationInterceptor.invoke(ENCPropagationInterceptor.java:46)
       at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
       at org.jboss.ejb3.asynchronous.AsynchronousInterceptor.invoke(AsynchronousInterceptor.java:106)
       at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
       at org.jboss.ejb3.stateless.StatelessContainer.dynamicInvoke(StatelessContainer.java:278)
       at org.jboss.aop.Dispatcher.invoke(Dispatcher.java:106)
       at org.jboss.aspects.remoting.AOPRemotingInvocationHandler.invoke(AOPRemotingInvocationHandler.java:82)
       at org.jboss.remoting.ServerInvoker.invoke(ServerInvoker.java:734)
       at org.jboss.remoting.transport.socket.ServerThread.processInvocation(ServerThread.java:560)
       at org.jboss.remoting.transport.socket.ServerThread.dorun(ServerThread.java:369)
       at org.jboss.remoting.transport.socket.ServerThread.run(ServerThread.java:165)
       at org.jboss.remoting.MicroRemoteClientInvoker.invoke(MicroRemoteClientInvoker.java:163)
       at org.jboss.remoting.Client.invoke(Client.java:1550)
       at org.jboss.remoting.Client.invoke(Client.java:530)
       at org.jboss.aspects.remoting.InvokeRemoteInterceptor.invoke(InvokeRemoteInterceptor.java:62)
       at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
       at org.jboss.aspects.tx.ClientTxPropagationInterceptor.invoke(ClientTxPropagationInterceptor.java:61)
       at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
       at org.jboss.aspects.security.SecurityClientInterceptor.invoke(SecurityClientInterceptor.java:53)
       at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
       at org.jboss.ejb3.remoting.IsLocalInterceptor.invoke(IsLocalInterceptor.java:72)
       at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
       at org.jboss.ejb3.stateless.StatelessRemoteProxy.invoke(StatelessRemoteProxy.java:103)
       at $Proxy0.save(Unknown Source)
       at com.tungadb.testclient.TestClient.main(TestClient.java:26)
       at org.jboss.aspects.remoting.InvokeRemoteInterceptor.invoke(InvokeRemoteInterceptor.java:74)
       at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
       at org.jboss.aspects.tx.ClientTxPropagationInterceptor.invoke(ClientTxPropagationInterceptor.java:61)
       at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
       at org.jboss.aspects.security.SecurityClientInterceptor.invoke(SecurityClientInterceptor.java:53)
       at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
       at org.jboss.ejb3.remoting.IsLocalInterceptor.invoke(IsLocalInterceptor.java:72)
       at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
       at org.jboss.ejb3.stateless.StatelessRemoteProxy.invoke(StatelessRemoteProxy.java:103)
       at $Proxy0.save(Unknown Source)
       at com.tungadb.testclient.TestClient.main(TestClient.java:26)
      Caused by: java.lang.ExceptionInInitializerError
       at com.tungadb.admin.AdminFacade.save(AdminFacade.java:27)
       at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
       at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
       at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
       at java.lang.reflect.Method.invoke(Unknown Source)
       at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:112)
       at org.jboss.ejb3.interceptor.InvocationContextImpl.proceed(InvocationContextImpl.java:166)
       at org.jboss.ejb3.interceptor.EJB3InterceptorsInterceptor.invoke(EJB3InterceptorsInterceptor.java:63)
       at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
       at org.jboss.ejb3.entity.TransactionScopedEntityManagerInterceptor.invoke(TransactionScopedEntityManagerInterceptor.java:54)
       at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
       at org.jboss.ejb3.AllowedOperationsInterceptor.invoke(AllowedOperationsInterceptor.java:47)
       at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
       at org.jboss.aspects.tx.TxPolicy.invokeInOurTx(TxPolicy.java:79)
       at org.jboss.aspects.tx.TxInterceptor$Required.invoke(TxInterceptor.java:191)
       at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
       at org.jboss.aspects.tx.TxPropagationInterceptor.invoke(TxPropagationInterceptor.java:76)
       at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
       at org.jboss.ejb3.stateless.StatelessInstanceInterceptor.invoke(StatelessInstanceInterceptor.java:62)
       at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
       at org.jboss.aspects.security.AuthenticationInterceptor.invoke(AuthenticationInterceptor.java:77)
       at org.jboss.ejb3.security.Ejb3AuthenticationInterceptor.invoke(Ejb3AuthenticationInterceptor.java:106)
       at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
       at org.jboss.ejb3.ENCPropagationInterceptor.invoke(ENCPropagationInterceptor.java:46)
       at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
       at org.jboss.ejb3.asynchronous.AsynchronousInterceptor.invoke(AsynchronousInterceptor.java:106)
       at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
       at org.jboss.ejb3.stateless.StatelessContainer.dynamicInvoke(StatelessContainer.java:278)
       at org.jboss.aop.Dispatcher.invoke(Dispatcher.java:106)
       at org.jboss.aspects.remoting.AOPRemotingInvocationHandler.invoke(AOPRemotingInvocationHandler.java:82)
       at org.jboss.remoting.ServerInvoker.invoke(ServerInvoker.java:734)
       at org.jboss.remoting.transport.socket.ServerThread.processInvocation(ServerThread.java:560)
       at org.jboss.remoting.transport.socket.ServerThread.dorun(ServerThread.java:369)
       at org.jboss.remoting.transport.socket.ServerThread.run(ServerThread.java:165)
      Caused by: javax.persistence.PersistenceException: org.hibernate.HibernateException: The chosen transaction strategy requires access to the JTA TransactionManager
       at org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Configuration.java:720)
       at org.hibernate.ejb.HibernatePersistence.createEntityManagerFactory(HibernatePersistence.java:121)
       at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:51)
       at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:33)
       at com.tungadb.admin.EntityManagerHelper.<clinit>(EntityManagerHelper.java:20)
       ... 34 more
      Caused by: org.hibernate.HibernateException: The chosen transaction strategy requires access to the JTA TransactionManager
       at org.hibernate.impl.SessionFactoryImpl.<init>(SessionFactoryImpl.java:329)
       at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1294)
       at org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Configuration.java:713)
       ... 38 more
      


      Step 11: do nothing, just try to run the client again, it gets java.lang.NoClassDefFoundError
      Please look at the stack trace
      Exception in thread "main" javax.ejb.EJBException: java.lang.RuntimeException: java.lang.NoClassDefFoundError
       at org.jboss.ejb3.tx.Ejb3TxPolicy.handleExceptionInOurTx(Ejb3TxPolicy.java:63)
       at org.jboss.aspects.tx.TxPolicy.invokeInOurTx(TxPolicy.java:83)
       at org.jboss.aspects.tx.TxInterceptor$Required.invoke(TxInterceptor.java:191)
       at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
       at org.jboss.aspects.tx.TxPropagationInterceptor.invoke(TxPropagationInterceptor.java:76)
       at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
       at org.jboss.ejb3.stateless.StatelessInstanceInterceptor.invoke(StatelessInstanceInterceptor.java:62)
       at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
       at org.jboss.aspects.security.AuthenticationInterceptor.invoke(AuthenticationInterceptor.java:77)
       at org.jboss.ejb3.security.Ejb3AuthenticationInterceptor.invoke(Ejb3AuthenticationInterceptor.java:106)
       at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
       at org.jboss.ejb3.ENCPropagationInterceptor.invoke(ENCPropagationInterceptor.java:46)
       at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
       at org.jboss.ejb3.asynchronous.AsynchronousInterceptor.invoke(AsynchronousInterceptor.java:106)
       at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
       at org.jboss.ejb3.stateless.StatelessContainer.dynamicInvoke(StatelessContainer.java:278)
       at org.jboss.aop.Dispatcher.invoke(Dispatcher.java:106)
       at org.jboss.aspects.remoting.AOPRemotingInvocationHandler.invoke(AOPRemotingInvocationHandler.java:82)
       at org.jboss.remoting.ServerInvoker.invoke(ServerInvoker.java:734)
       at org.jboss.remoting.transport.socket.ServerThread.processInvocation(ServerThread.java:560)
       at org.jboss.remoting.transport.socket.ServerThread.dorun(ServerThread.java:369)
       at org.jboss.remoting.transport.socket.ServerThread.run(ServerThread.java:165)
      Caused by: java.lang.RuntimeException: java.lang.NoClassDefFoundError
       at org.jboss.ejb3.interceptor.InvocationContextImpl.proceed(InvocationContextImpl.java:174)
       at org.jboss.ejb3.interceptor.EJB3InterceptorsInterceptor.invoke(EJB3InterceptorsInterceptor.java:63)
       at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
       at org.jboss.ejb3.entity.TransactionScopedEntityManagerInterceptor.invoke(TransactionScopedEntityManagerInterceptor.java:54)
       at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
       at org.jboss.ejb3.AllowedOperationsInterceptor.invoke(AllowedOperationsInterceptor.java:47)
       at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
       at org.jboss.aspects.tx.TxPolicy.invokeInOurTx(TxPolicy.java:79)
       at org.jboss.aspects.tx.TxInterceptor$Required.invoke(TxInterceptor.java:191)
       at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
       at org.jboss.aspects.tx.TxPropagationInterceptor.invoke(TxPropagationInterceptor.java:76)
       at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
       at org.jboss.ejb3.stateless.StatelessInstanceInterceptor.invoke(StatelessInstanceInterceptor.java:62)
       at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
       at org.jboss.aspects.security.AuthenticationInterceptor.invoke(AuthenticationInterceptor.java:77)
       at org.jboss.ejb3.security.Ejb3AuthenticationInterceptor.invoke(Ejb3AuthenticationInterceptor.java:106)
       at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
       at org.jboss.ejb3.ENCPropagationInterceptor.invoke(ENCPropagationInterceptor.java:46)
       at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
       at org.jboss.ejb3.asynchronous.AsynchronousInterceptor.invoke(AsynchronousInterceptor.java:106)
       at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
       at org.jboss.ejb3.stateless.StatelessContainer.dynamicInvoke(StatelessContainer.java:278)
       at org.jboss.aop.Dispatcher.invoke(Dispatcher.java:106)
       at org.jboss.aspects.remoting.AOPRemotingInvocationHandler.invoke(AOPRemotingInvocationHandler.java:82)
       at org.jboss.remoting.ServerInvoker.invoke(ServerInvoker.java:734)
       at org.jboss.remoting.transport.socket.ServerThread.processInvocation(ServerThread.java:560)
       at org.jboss.remoting.transport.socket.ServerThread.dorun(ServerThread.java:369)
       at org.jboss.remoting.transport.socket.ServerThread.run(ServerThread.java:165)
       at org.jboss.remoting.MicroRemoteClientInvoker.invoke(MicroRemoteClientInvoker.java:163)
       at org.jboss.remoting.Client.invoke(Client.java:1550)
       at org.jboss.remoting.Client.invoke(Client.java:530)
       at org.jboss.aspects.remoting.InvokeRemoteInterceptor.invoke(InvokeRemoteInterceptor.java:62)
       at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
       at org.jboss.aspects.tx.ClientTxPropagationInterceptor.invoke(ClientTxPropagationInterceptor.java:61)
       at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
       at org.jboss.aspects.security.SecurityClientInterceptor.invoke(SecurityClientInterceptor.java:53)
       at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
       at org.jboss.ejb3.remoting.IsLocalInterceptor.invoke(IsLocalInterceptor.java:72)
       at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
       at org.jboss.ejb3.stateless.StatelessRemoteProxy.invoke(StatelessRemoteProxy.java:103)
       at $Proxy0.save(Unknown Source)
       at com.tungadb.testclient.TestClient.main(TestClient.java:25)
       at org.jboss.aspects.remoting.InvokeRemoteInterceptor.invoke(InvokeRemoteInterceptor.java:74)
       at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
      09:34:06,184 DEBUG InvokerRegistry:595 - removed SocketClientInvoker[1d86fd3, socket://127.0.0.1:3873] from registry
      09:34:06,185 DEBUG MicroSocketClientInvoker:277 - SocketClientInvoker[1d86fd3, socket://127.0.0.1:3873] disconnecting ...
      09:34:06,186 DEBUG SocketWrapper:123 - ClientSocketWrapper[Socket[addr=/127.0.0.1,port=3873,localport=50336].476128] closing
       at org.jboss.aspects.tx.ClientTxPropagationInterceptor.invoke(ClientTxPropagationInterceptor.java:61)
       at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
       at org.jboss.aspects.security.SecurityClientInterceptor.invoke(SecurityClientInterceptor.java:53)
       at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
       at org.jboss.ejb3.remoting.IsLocalInterceptor.invoke(IsLocalInterceptor.java:72)
       at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
       at org.jboss.ejb3.stateless.StatelessRemoteProxy.invoke(StatelessRemoteProxy.java:103)
       at $Proxy0.save(Unknown Source)
       at com.tungadb.testclient.TestClient.main(TestClient.java:25)
      Caused by: java.lang.NoClassDefFoundError
       at com.tungadb.admin.AdminFacade.save(AdminFacade.java:27)
       at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
       at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
       at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
       at java.lang.reflect.Method.invoke(Unknown Source)
       at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:112)
       at org.jboss.ejb3.interceptor.InvocationContextImpl.proceed(InvocationContextImpl.java:166)
       at org.jboss.ejb3.interceptor.EJB3InterceptorsInterceptor.invoke(EJB3InterceptorsInterceptor.java:63)
       at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
       at org.jboss.ejb3.entity.TransactionScopedEntityManagerInterceptor.invoke(TransactionScopedEntityManagerInterceptor.java:54)
       at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
       at org.jboss.ejb3.AllowedOperationsInterceptor.invoke(AllowedOperationsInterceptor.java:47)
       at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
       at org.jboss.aspects.tx.TxPolicy.invokeInOurTx(TxPolicy.java:79)
       at org.jboss.aspects.tx.TxInterceptor$Required.invoke(TxInterceptor.java:191)
       at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
       at org.jboss.aspects.tx.TxPropagationInterceptor.invoke(TxPropagationInterceptor.java:76)
       at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
       at org.jboss.ejb3.stateless.StatelessInstanceInterceptor.invoke(StatelessInstanceInterceptor.java:62)
       at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
       at org.jboss.aspects.security.AuthenticationInterceptor.invoke(AuthenticationInterceptor.java:77)
       at org.jboss.ejb3.security.Ejb3AuthenticationInterceptor.invoke(Ejb3AuthenticationInterceptor.java:106)
       at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
       at org.jboss.ejb3.ENCPropagationInterceptor.invoke(ENCPropagationInterceptor.java:46)
       at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
       at org.jboss.ejb3.asynchronous.AsynchronousInterceptor.invoke(AsynchronousInterceptor.java:106)
       at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
       at org.jboss.ejb3.stateless.StatelessContainer.dynamicInvoke(StatelessContainer.java:278)
       at org.jboss.aop.Dispatcher.invoke(Dispatcher.java:106)
       at org.jboss.aspects.remoting.AOPRemotingInvocationHandler.invoke(AOPRemotingInvocationHandler.java:82)
       at org.jboss.remoting.ServerInvoker.invoke(ServerInvoker.java:734)
       at org.jboss.remoting.transport.socket.ServerThread.processInvocation(ServerThread.java:560)
       at org.jboss.remoting.transport.socket.ServerThread.dorun(ServerThread.java:369)
       at org.jboss.remoting.transport.socket.ServerThread.run(ServerThread.java:165)
      


      Anyone, please help

        • 1. Re: Is this a JBoss bug?
          Duc Nguyen Newbie

          I made a little change to persistence.xml, and now the client rung without error, but when I call save (which in turn call entityManager.persist), no change was made to the database

          I can find Admin object by using find method, but cannot insert new, or update, the method return no error, but the data in the database is not updated...

          • 2. Re: Is this a JBoss bug?
            Duc Nguyen Newbie

            what I change in persistence.xml is

            from

            <persistence-unit name="AdminEJB" transaction-type="JTA">
             <jta-data-source>java:/MyDB</jta-data-source>
             </persistence-unit>


            to
            <persistence-unit name="AdminEJB" transaction-type="RESOURCE_LOCAL">
             <non-jta-data-source>java:/MyDB</non-jta-data-source>


            • 3. Re: Is this a JBoss bug?
              s Reddy Newbie

              I have a same set up and same problem.

              Were you able to solve this?

              Could you please reply if you have?

              If you have not could please let me know what alternative path did you take?

              Thanks and regards.

              • 4. Re: Is this a JBoss bug?
                Duc Nguyen Newbie

                Well, as I said, instead of using transaction-type JTA, I'm using RESOURCE_LOCAL and a non-jta-data-source. I think it's something about the security, the transaction manager of hibernate (which is the persistence provider for JBoss) cannot join with the JTA, which is managed by JBoss, and the Database Server's own transaction manager.

                Anyway, changing to RESOURCE_LOCAL and non-jta-data-source may help, but be sure to provide the right hibernate.dialect property in persistence.xml. In my case, I used SQL Server, so my properties elements in persistence.xml should look like this:

                <properties>
                 <property name="hibernate.dialect"
                 value="org.hibernate.dialect.SQLServerDialect" />
                 <property name="hibernate.hbm2ddl.auto" value="update" />
                </properties>
                


                For your right dialect, please have a look at hibernate project's website. About the property hibernate.hbm2ddl.auto, which value is update, it means that if there're any changes in the Entity Bean, update those changes to the database. It can have other values, once again, you should refer to the documents of hibernate.

                • 5. Re: Is this a JBoss bug?
                  Jeroen Wenting Newbie

                  doesn't look like this has anything to do with JBoss.
                  Looks like it's either something with Hibernate, the JDBC driver, the database, or a combination of them.

                  Can you use the same versions of Hibernate and your JDBC driver to talk to that database using JPA from outside JBoss?

                  • 6. Re: Is this a JBoss bug?
                    Heiko Dähn Newbie

                    Hi,
                    I have not read the message in detail but
                    may it is a wrong java version.

                    Do not run jboss 4.x with jdk 6!
                    jboss 4.x don't supports this.

                    • 7. Re: Is this a JBoss bug?
                      ge fa Newbie

                      I have the same problem. I use JBoss 4.2.2 GA and JDK5.No matter JTA or RESOURCE_LOCAL which I use,this error always presents when Junit case executing. please help me!

                      • 8. Re: Is this a JBoss bug?
                        chris wang Newbie

                        Have you guys resolved this issue? I encounted the exactly same issue, Please help!

                        • 9. Re: Is this a JBoss bug?
                          Carlo de Wolf Master

                          EntityManagerHelper is trying to create an EntityManagerFactory. This is not allowed within a JavaEE container.

                          • 10. Re: Is this a JBoss bug?
                            chris wang Newbie

                            wolfc:

                            My issue (posted at http://www.jboss.com/index.html?module=bb&op=viewtopic&t=138204) is that I am able to do jndi remote look up. but when I do jndi local look up, the bean is found, but upon invocation, exactly same error ocurred as described above. I didn't got what you mean, Can you be more specific?