1 Reply Latest reply on Sep 25, 2006 7:26 PM by Jason Holmes

    jboss-app.xml issues and @EJB injection

    Jason Holmes Newbie

      Having a small problem in deploying my app.

      We have an ear file, that contains a bunch of ejb2.1 session/entity beans, and a ejb3 session bean, as well as 10 ejb3 entity beans.

      The ejb3 entity beans are in geoFeature.par.
      The ejb3 session beans are in motionbased.ejb3.
      The ejb2.1 stuff have their own jars w/ the old-school descriptors.

      The persistence.xml file in the geoFeature.par file looks like so ...

      <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="GeoFeature" transaction-type="JTA">
       <provider>org.hibernate.ejb.HibernatePersistence</provider>
       <jta-data-source>java:/com.free2be.datasource.GeoDataSource</jta-data-source>
       <properties>
       <property name="hibernate.dialect" value="org.hibernate.dialect.MySQLDialect"/>
       <property name="hibernate.connection.driver_class" value="com.mysql.jdbc.Driver"/>
       <property name="hibernate.connection.username" value="xxx"/>
       <property name="hibernate.connection.password" value="xxx"/>
       <property name="hibernate.max_fetch_depth" value="3"/>
      
       <property name="hibernate.c3p0.min_size" value="5"/>
       <property name="hibernate.c3p0.max_size" value="20"/>
       <property name="hibernate.c3p0.timeout" value="1800"/>
       <property name="hibernate.c3p0.max_statements" value="50"/>
      
       <property name="hibernate.session_factory_name" value="hibernate/session_factory"/>
       <property name="jta.UserTransaction" value="UserTransaction"/>
      
       <!--<property name="hibernate.transaction.factory_class" value="org.hibernate.transaction.CMTTransactionFactory"/>-->
       <property name="hibernate.transaction.manager_lookup_class" value="org.hibernate.transaction.JBossTransactionManagerLookup"/>
       <property name="hibernate.transaction.flush_before_completion" value="true"/>
      
       <property name="hibernate.cache.provider_class" value="org.hibernate.cache.NoCacheProvider"/>
       <property name="hibernate.show_sql" value="true"/>
       <property name="hibernate.format_sql" value="true"/>
       <property name="hibernate.generate_statistics" value="true"/>
      
       <property name="hibernate.bytecode.use_reflection_optimizer" value="false"/>
       <property name="hibernate.bytecode.provider" value="javassist"/>
      
       <property name="hibernate.ejb.cfgfile" value="/hibernate.cfg.xml"/>
       </properties>
       </persistence-unit>
      </persistence>
      


      In our motionbased.ear/meta-inf folder, we have application.xml and the jboss-app.xml. Our jboss-app.xml is listed here ...

      <?xml version="1.0" encoding="UTF-8"?>
      <!DOCTYPE jboss-app PUBLIC "-//JBoss//DTD J2EE Application 1.4//EN"
       "http://www.jboss.org/j2ee/dtd/jboss-app_4_0.dtd">
      <jboss-app>
       <loader-repository>
       motionbased:archive=motionbased.ear
       </loader-repository>
       <module>
       <service>UpdateBilling.sar</service>
       </module>
       <module>
       <service>ProcessPendingUpload.sar</service>
       </module>
      </jboss-app>


      The loader-repository section is giving me quite the headache.

      With it, I get ...
      [ServiceController] Problem creating service jboss.j2ee:service=EJB3,module=geoFeature.par
      java.lang.IllegalStateException: Failed to parse jacc-policy-config-states.xml

      That file doesn't exist. It's being parsed from JBossPolicyManager. I never asked it too, and I don't know it's doing it now and it wasn't before.


      Without it, I run into issues using DependencyInjection in the EJB3 Session Bean.
      java.lang.RuntimeException: Illegal @PersistenceUnit on private javax.persistence.EntityManager com.garmin.mb.framework.gis.feature.GeoFeatureManagerBean.entityManager :There is no default persistence unit in this deployment.


      The code with the @EJB ...
      @Stateless
      public class GeoFeatureManagerBean implements GeoFeatureManager {
       private static final long serialVersionUID = 6211376611083502502L;
      
       @PersistenceContext(name = "GeoFeature")
       private EntityManager entityManager;
      


      Anybody know how to fix this? Or can explain how to use the jboss-app.xml file properly.