0 Replies Latest reply on Sep 12, 2013 4:20 PM by Ron Si

    Cannot access Seam Components within JAR from WAR in [JBOSS 7.1.1.FINAL and SEAM 2.2.1.CR2]

    Ron Si Newbie

      Problem: I have an ejb-jar-1.jar which defines EJBs and Entities. The project structure is listed below. During deployment all EJBs are successfully bootstraped > started and their JNDI locations are printed in a log file. There's a class in my WAR file which needs to access a NAMED QUERY defined on an Entity which resides inside ejb-jar-1.jar. When this piece of code is run it throws an illegalArgumentException saying NAMED QUERY cannot be found. On a different note I also cannot get reference to SEAM components that were started when ejb-jar1.jar was deployed. I printed the JNDI tree from app-war.war file and it does not have any JNDI resources from ejb-jar-1.jar. So, I believe this is a context issue where JNDI resources available in ejb-jar-1.jar cannot be seen from app-war.war.

       

      Any suggestions on how to access JNDI resources available in ejb-jar-1.jar from app-war.war?

       

      Deployement Info

      * JBOSS 7.1.1.FINAL

      * Uses seam framework: jboss-seam-2.2.1.CR2.jar

      * Uses Hibernate 3.4.0.GA

       

      main-ear.ear

      |__META-INF

      |   |____jboss-deployment-structure.xml

      |   |____application.xml

      |   |____jboss-app.xml

      |   |____MANIFEST.MF

      |__lib

      |   |____somejar.jar

      |   |____somejar.jar

      |__ejb-jar-1.jar

      |__ejb-jar-2.jar

      |__jboss-seam-2.2.1.CR2.jar

      |__commons-lang-2.4.jar

      |__commons-codec-1.1.jar

      |__jasypt-1.6.jar

      |__app-war.war


      jboss-deployment-structure.xml

      <jboss-deployment-structure xmlns="urn:jboss:deployment-structure:1.0">

          <ear-subdeployments-isolated>false</ear-subdeployments-isolated>

          <deployment>

              <exclusions>

                  <module name="javax.faces.api" slot="1.2"/>

                  <module name="com.sun.jsf-impl" slot="1.2"/>

                  <module name="org.hibernate" slot="main"/>

                  <module name="org.hibernate.validator" slot="main"/>

                  <module name="org.apache.commons.lang"/>

                  <module name="org.apache.commons.collections"/>

                  <module name="org.apache.commons.codec"/>

                  <module name="org.picketlink" slot="main"/>

                  <module name="org.picketbox" slot="main"/>

                  <module name="org.javassist" slot="main"/>

                  <module name="org.dom4j" slot="main"/>

              </exclusions>

              <dependencies>

                  <module name="javax.faces.api" slot="1.2" export="true"/>

                  <module name="com.sun.jsf-impl" slot="1.2" export="true"/>

                  <module name="org.javassist" slot="1" export="true"/>

                  <module name="org.apache.commons.logging" export="true"/>

              </dependencies>

          </deployment>

          <sub-deployment name="app-war.war">

              <exclusions>

                  <module name="javax.faces.api" slot="main"/>

                  <module name="com.sun.jsf-impl" slot="main"/>

              </exclusions>

              <dependencies>

                  <module name="javax.faces.api" slot="1.2"/>

                  <module name="com.sun.jsf-impl" slot="1.2"/>

                  <module name="deployment.main-ear.ear.ejb-jar-1.jar" />

                  <module name="deployment.main-ear.ear.ejb-jar-2.jar" />

                  <module name="deployment.main-ear.ear.jboss-seam-2.2.1.CR2.jar"/>

              </dependencies>

          </sub-deployment>

          <module name="deployment.main-ear.ear.jasypt-1.6.jar" />

          <module name="deployment.main-ear.ear.commons-codec-1.1.jar" />

          <module name="deployment.main-ear.ear.commons-lang-2.4.jar" />

      </jboss-deployment-structure>

       

      application.xml

      <?xml version="1.0" encoding="UTF-8"?>

      <application xmlns="http://java.sun.com/xml/ns/j2ee"

                   xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"

                   xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/javaee/application_6.xsd"

                   version="6">

          <description>myapp</description>

          <display-name>myapp</display-name>

          <initialize-in-order>true</initialize-in-order>

          <library-directory>lib</library-directory>

          <module>

              <ejb>ejb-jar-1.jar</ejb>

          </module>

          <module>

              <ejb>ejb-jar-2.jar</ejb>

          </module>

          <module>

              <ejb>jboss-seam-2.2.1.CR2.jar</ejb>

          </module>

          <module>

              <web>

                  <web-uri>app-war.war</web-uri>

                  <context-root>/app</context-root>

              </web>

          </module>

      </application>