Hello all

We have a problem depoying a J2EE project under Jboss AS 4.2.2

There is an EAR project with two EJBs JAR with their own entities and 
persistence unit. The 2 persistence.xml files are in the META-INF directories 
of the EJBs' JAR and they bind to two different data stores defined in a 
*-ds.xml file.

Here is the ds file: (deployed directly in server/default/deploy/ )

        <local-tx-datasource>
      <jndi-name>firstDatasource</jndi-name>
      <connection-url>jdbc:mysql://localhost:3306/sometable</connection-url>
      <driver-class>com.mysql.jdbc.Driver</driver-class>
      <user-name>user</user-name>
      password
   </local-tx-datasource>
   <local-tx-datasource>
      <jndi-name>secondDatasource</jndi-name>
      
<connection-url>jdbc:mysql://localhost:3306/someothertable</connection-url>
      <driver-class>com.mysql.jdbc.Driver</driver-class>
      <user-name>user</user-name>
      password
   </local-tx-datasource>


Then the persistence.xml files:

<persistence-unit name="second"  transaction-type="JTA">
   org.hibernate.ejb.HibernatePersistence
   <jta-data-source>java:/secondDatasource</jta-data-source>
   
      
      
      
      
      
   
</persistence-unit>

...

<persistence-unit name="first"  transaction-type="JTA">
   org.hibernate.ejb.HibernatePersistence
   <jta-data-source>java:/firstDatasource</jta-data-source>
   
      
      
      
      
      
   
</persistence-unit>

However when the project is deployed we are getting the following error :

08:44:31,692 WARN  [ServiceController] Problem starting service 
persistence.units:ear=ourproject-ear.ear,jar=ourejb.jar,unitName=second
javax.naming.NoInitialContextException: Need to specify class name in 
environment or system property, or as an applet parameter, or in an application 
resource file:  java.naming.factory.initial
        at 
javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:645)
        at 
javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:288)
        at 
javax.naming.InitialContext.getURLOrDefaultInitCtx(InitialContext.java:325)
        at javax.naming.InitialContext.lookup(InitialContext.java:392)
        at 
org.jboss.ejb3.entity.PersistenceUnitDeployment.start(PersistenceUnitDeployment.java:216)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at 
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
        at 
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:597)
        
        
Following this error message we investigated the initial context parameters in 
the conf folder, and jndi.properties seems to be fine (default values):

java.naming.factory.initial=org.jnp.interfaces.NamingContextFactory
java.naming.factory.url.pkgs=org.jboss.naming:org.jnp.interfaces

Any help would be gladly appreciated !



View the original post : 
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4154155#4154155

Reply to the post : 
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4154155
_______________________________________________
jboss-user mailing list
jboss-user@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/jboss-user

Reply via email to