3 Replies Latest reply on Nov 25, 2011 6:04 AM by ylemoigne

    JBAS7 entities in module not working

    osnetwork

      Hello everyone,

       

      I have a EAR application where I have a couple of jars and wars. The EJB layer is composed by 2 jar, one containing the Beans (service layer) and another containing the Entities (model/persistence layer).

      The entity jar has been deployed as a module in jboss following the new structure under the folder modules. This is working fine.

      However, the persistence.xml file is in the Beans jar and at the startup is giving the following output:

      09:29:41,284 INFO  [org.hibernate.Version] (MSC service thread 1-7) HHH00412:Hibernate Core {4.0.0.CR2}

      09:29:41,287 INFO  [org.hibernate.cfg.Environment] (MSC service thread 1-7) HHH00206:hibernate.properties not found

      09:29:41,288 INFO  [org.hibernate.cfg.Environment] (MSC service thread 1-7) HHH00021:Bytecode provider name : javassist

      09:29:41,312 INFO  [org.hibernate.ejb.Ejb3Configuration] (MSC service thread 1-7) HHH00204:Processing PersistenceUnitInfo [

              name: mypersistence

              ...]

      09:29:41,472 INFO  [org.hibernate.service.jdbc.connections.internal.ConnectionProviderInitiator] (MSC service thread 1-7) HHH00130:Instantiating explicit connection provider: org.hibernate.ejb.connection.InjectedDataSourceConnectionProvider

      Here there are no error, but later on I get errors like this:

      Caused by: java.lang.IllegalArgumentException: Named query not found: sysprop.findAll

      where sysprop.findAll is a named query which is defined in the entity jar.

       

      This kind of schema was working fine under JBoss5 and 6 but here it seems that when is processing the persistence unit it is not readying the entities from the model jar.

      Am I doing something wrong or JBoss7 does not allow anymore this project structure?

       

      Thanks in advance,

      LM

        • 1. Re: JBAS7 entities in module not working
          osnetwork

          I have tried to move the persistence.xml from the bean jar to the entity jar. This should be more correct.

          Also, according to the https://docs.jboss.org/author/display/AS7/JPA+Reference+Guide I have tried to copy my entity jar into the EAR's lib folder.

          Now I can see that JBoss is trying to validate the entities, but I get this error:

          10:28:34,081 INFO  [org.hibernate.engine.transaction.internal.TransactionFactoryInitiator] (MSC service thread 1-7) HHH00268:Transaction strategy: org.hibernate.engine.transaction.internal.jta.CMTTransactionFactory

          10:28:34,084 INFO  [org.hibernate.hql.internal.ast.ASTQueryTranslatorFactory] (MSC service thread 1-7) HHH00397:Using ASTQueryTranslatorFactory

          10:28:34,123 INFO  [org.hibernate.validator.util.Version] (MSC service thread 1-7) Hibernate Validator 4.2.0.Final

          10:28:34,393 ERROR [org.hibernate.proxy.pojo.javassist.JavassistLazyInitializer] (MSC service thread 1-7) HHH00142:Javassist Enhancement failed: org.test.common.persistence.User: java.lang.RuntimeException: by java.lang.NoClassDefFoundError: org/hibernate/proxy/HibernateProxy

           

          I'm not sure here if I should check the dependencies in the entity jar which I have deployed as jboss module or if there is something wrong.

          In fact now I have 2 copies of that entity jar. 1 in the modules folder and 1 in the EAR's lib folder

          • 2. Re: JBAS7 entities in module not working
            ylemoigne

            Hi, I have quite the same error here.

             

            If I include the hibernate jar(s) in my deployement, I have a linkage error because classes are not coming from the same jar.

            If I remove the hibernate jar(s) from my deployement, I have error on serialization :

             

            java.lang.ClassNotFoundException: org.hibernate.collection.internal.PersistentSet

             

            In jbossAS 5.1, not providing hibernate jar on service side was ok.

             

            If someone can take a look to know if there is something we doing wrong or if it's a bug...

             

            (I paste you the complete trace :

             

            11:16:25,367 ERROR [stderr] (Remoting "lemoigne-laptop" task-3) Exception in thread "Remoting "lemoigne-laptop" task-3" java.lang.RuntimeException: java.lang.ClassNotFoundException: org.hibernate.collection.internal.PersistentSet from [Module "XXXX" from Service Module Loader]

             

            11:16:25,368 ERROR [stderr] (Remoting "lemoigne-laptop" task-3)     at org.jboss.as.ejb3.remote.protocol.versionone.MethodInvocationMessageHandler.processMessage(MethodInvocationMessageHandler.java:151)

             

            11:16:25,368 ERROR [stderr] (Remoting "lemoigne-laptop" task-3)     at org.jboss.as.ejb3.remote.protocol.versionone.VersionOneProtocolChannelReceiver.handleMessage(VersionOneProtocolChannelReceiver.java:146)

             

            11:16:25,368 ERROR [stderr] (Remoting "lemoigne-laptop" task-3)     at org.jboss.remoting3.remote.RemoteConnectionChannel$5.run(RemoteConnectionChannel.java:409)

             

            11:16:25,368 ERROR [stderr] (Remoting "lemoigne-laptop" task-3)     at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110)

             

            11:16:25,368 ERROR [stderr] (Remoting "lemoigne-laptop" task-3)     at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603)

             

            11:16:25,368 ERROR [stderr] (Remoting "lemoigne-laptop" task-3)     at java.lang.Thread.run(Thread.java:722)

             

            11:16:25,369 ERROR [stderr] (Remoting "lemoigne-laptop" task-3) Caused by: java.lang.ClassNotFoundException: org.hibernate.collection.internal.PersistentSet from [Module "XXXX" from Service Module Loader]

             

            11:16:25,369 ERROR [stderr] (Remoting "lemoigne-laptop" task-3)     at org.jboss.modules.ConcurrentClassLoader.performLoadClassChecked(ConcurrentClassLoader.java:471)

             

            11:16:25,369 ERROR [stderr] (Remoting "lemoigne-laptop" task-3)     at org.jboss.modules.ConcurrentClassLoader.performLoadClass(ConcurrentClassLoader.java:421)

             

            11:16:25,369 ERROR [stderr] (Remoting "lemoigne-laptop" task-3)     at org.jboss.modules.ConcurrentClassLoader.loadClass(ConcurrentClassLoader.java:143)

             

            11:16:25,369 ERROR [stderr] (Remoting "lemoigne-laptop" task-3)     at java.lang.Class.forName0(Native Method)

             

            11:16:25,370 ERROR [stderr] (Remoting "lemoigne-laptop" task-3)     at java.lang.Class.forName(Class.java:264)

             

            11:16:25,370 ERROR [stderr] (Remoting "lemoigne-laptop" task-3)     at org.jboss.marshalling.AbstractClassResolver.loadClass(AbstractClassResolver.java:135)

             

            11:16:25,370 ERROR [stderr] (Remoting "lemoigne-laptop" task-3)     at org.jboss.marshalling.AbstractClassResolver.resolveClass(AbstractClassResolver.java:116)

             

            11:16:25,370 ERROR [stderr] (Remoting "lemoigne-laptop" task-3)     at org.jboss.marshalling.river.RiverUnmarshaller.doReadClassDescriptor(RiverUnmarshaller.java:888)

             

            11:16:25,370 ERROR [stderr] (Remoting "lemoigne-laptop" task-3)     at org.jboss.marshalling.river.RiverUnmarshaller.doReadNewObject(RiverUnmarshaller.java:1200)

             

            11:16:25,370 ERROR [stderr] (Remoting "lemoigne-laptop" task-3)     at org.jboss.marshalling.river.RiverUnmarshaller.doReadObject(RiverUnmarshaller.java:272)

             

            11:16:25,370 ERROR [stderr] (Remoting "lemoigne-laptop" task-3)     at org.jboss.marshalling.river.RiverUnmarshaller.doReadObject(RiverUnmarshaller.java:209)

             

            11:16:25,370 ERROR [stderr] (Remoting "lemoigne-laptop" task-3)     at org.jboss.marshalling.river.RiverUnmarshaller.readFields(RiverUnmarshaller.java:1673)

             

            11:16:25,371 ERROR [stderr] (Remoting "lemoigne-laptop" task-3)     at org.jboss.marshalling.river.RiverUnmarshaller.doInitSerializable(RiverUnmarshaller.java:1589)

             

            11:16:25,371 ERROR [stderr] (Remoting "lemoigne-laptop" task-3)     at org.jboss.marshalling.river.RiverUnmarshaller.doInitSerializable(RiverUnmarshaller.java:1553)

             

            11:16:25,371 ERROR [stderr] (Remoting "lemoigne-laptop" task-3)     at org.jboss.marshalling.river.RiverUnmarshaller.doInitSerializable(RiverUnmarshaller.java:1553)

             

            11:16:25,371 ERROR [stderr] (Remoting "lemoigne-laptop" task-3)     at org.jboss.marshalling.river.RiverUnmarshaller.doReadNewObject(RiverUnmarshaller.java:1231)

             

            11:16:25,371 ERROR [stderr] (Remoting "lemoigne-laptop" task-3)     at org.jboss.marshalling.river.RiverUnmarshaller.doReadObject(RiverUnmarshaller.java:272)

             

            11:16:25,371 ERROR [stderr] (Remoting "lemoigne-laptop" task-3)     at org.jboss.marshalling.river.RiverUnmarshaller.doReadObject(RiverUnmarshaller.java:209)

             

            11:16:25,371 ERROR [stderr] (Remoting "lemoigne-laptop" task-3)     at org.jboss.marshalling.river.RiverUnmarshaller.doReadMapObject(RiverUnmarshaller.java:195)

             

            11:16:25,372 ERROR [stderr] (Remoting "lemoigne-laptop" task-3)     at org.jboss.marshalling.river.RiverUnmarshaller.readMapData(RiverUnmarshaller.java:791)

             

            11:16:25,372 ERROR [stderr] (Remoting "lemoigne-laptop" task-3)     at org.jboss.marshalling.river.RiverUnmarshaller.doReadObject(RiverUnmarshaller.java:682)

             

            11:16:25,372 ERROR [stderr] (Remoting "lemoigne-laptop" task-3)     at org.jboss.marshalling.river.RiverUnmarshaller.doReadObject(RiverUnmarshaller.java:209)

             

            11:16:25,372 ERROR [stderr] (Remoting "lemoigne-laptop" task-3)     at org.jboss.marshalling.river.RiverUnmarshaller.readFields(RiverUnmarshaller.java:1673)

             

            11:16:25,372 ERROR [stderr] (Remoting "lemoigne-laptop" task-3)     at org.jboss.marshalling.river.RiverUnmarshaller.doInitSerializable(RiverUnmarshaller.java:1589)

             

            11:16:25,372 ERROR [stderr] (Remoting "lemoigne-laptop" task-3)     at org.jboss.marshalling.river.RiverUnmarshaller.doReadNewObject(RiverUnmarshaller.java:1231)

             

            11:16:25,372 ERROR [stderr] (Remoting "lemoigne-laptop" task-3)     at org.jboss.marshalling.river.RiverUnmarshaller.doReadObject(RiverUnmarshaller.java:272)

             

            11:16:25,372 ERROR [stderr] (Remoting "lemoigne-laptop" task-3)     at org.jboss.marshalling.river.RiverUnmarshaller.doReadObject(RiverUnmarshaller.java:209)

             

            11:16:25,373 ERROR [stderr] (Remoting "lemoigne-laptop" task-3)     at org.jboss.marshalling.river.RiverUnmarshaller.doReadMapObject(RiverUnmarshaller.java:195)

             

            11:16:25,373 ERROR [stderr] (Remoting "lemoigne-laptop" task-3)     at org.jboss.marshalling.river.RiverUnmarshaller.readMapData(RiverUnmarshaller.java:791)

             

            11:16:25,373 ERROR [stderr] (Remoting "lemoigne-laptop" task-3)     at org.jboss.marshalling.river.RiverUnmarshaller.doReadObject(RiverUnmarshaller.java:682)

             

            11:16:25,373 ERROR [stderr] (Remoting "lemoigne-laptop" task-3)     at org.jboss.marshalling.river.RiverUnmarshaller.doReadObject(RiverUnmarshaller.java:209)

             

            11:16:25,373 ERROR [stderr] (Remoting "lemoigne-laptop" task-3)     at org.jboss.marshalling.river.RiverUnmarshaller.readFields(RiverUnmarshaller.java:1673)

             

            11:16:25,373 ERROR [stderr] (Remoting "lemoigne-laptop" task-3)     at org.jboss.marshalling.river.RiverUnmarshaller.doInitSerializable(RiverUnmarshaller.java:1589)

             

            11:16:25,373 ERROR [stderr] (Remoting "lemoigne-laptop" task-3)     at org.jboss.marshalling.river.RiverUnmarshaller.doReadNewObject(RiverUnmarshaller.java:1231)

             

            11:16:25,374 ERROR [stderr] (Remoting "lemoigne-laptop" task-3)     at org.jboss.marshalling.river.RiverUnmarshaller.doReadObject(RiverUnmarshaller.java:272)

             

            11:16:25,374 ERROR [stderr] (Remoting "lemoigne-laptop" task-3)     at org.jboss.marshalling.river.RiverUnmarshaller.doReadObject(RiverUnmarshaller.java:209)

             

            11:16:25,374 ERROR [stderr] (Remoting "lemoigne-laptop" task-3)     at org.jboss.marshalling.AbstractObjectInput.readObject(AbstractObjectInput.java:37)

             

            11:16:25,374 ERROR [stderr] (Remoting "lemoigne-laptop" task-3)     at org.jboss.as.ejb3.remote.protocol.versionone.MarshallerFactory$JBossUnMarshaller.readObject(MarshallerFactory.java:148)

             

            11:16:25,374 ERROR [stderr] (Remoting "lemoigne-laptop" task-3)     at org.jboss.as.ejb3.remote.protocol.versionone.MethodInvocationMessageHandler.processMessage(MethodInvocationMessageHandler.java:148)

             

            11:16:25,374 ERROR [stderr] (Remoting "lemoigne-laptop" task-3)     ... 5 more

            • 3. Re: JBAS7 entities in module not working
              ylemoigne

              Ok, this is not a bug !

              https://docs.jboss.org/author/display/AS7/Class+Loading+in+AS7

               

              I added to my service pom, and it work.

              <manifestEntries>
              <Dependencies>org.hibernate, org.hibernate.validator, org.javassist</Dependencies>
              </manifestEntries>