0 Replies Latest reply on Nov 26, 2013 4:52 AM by Piyush Jain

    Unable to access Seam bean from different ear.

    Piyush Jain Newbie

      I have two ears:

       

      A.ear:

           common-ejb3-0.1.jar --> this has all ejb and seam classes.  common-ejb is its ejb name.

       

      B.ear: -> from this I want to access seam beans of A.ear:

       

                 jboss-deployment-structure.xml

       

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

      <jboss-deployment-structure>

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

          <deployment>

              <dependencies>

             

                  <module name="A.ear" export="true" />

              </dependencies>

          </deployment>

        

          <sub-deployment name="B-webapp-0.1.war">

        <dependencies>

        <module name="deployment.A.ear.common-ejb3-0.1.jar" />

        <module name="deployment.A.ear.jboss-seam-2.3.1.Final.jar" />

        </dependencies>

        </sub-deployment>

      </jboss-deployment-structure>

       

      application.xml

       

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

      <application xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/application_6.xsd" version="6">

        <description>Time Policies</description>

        <display-name>timepolicies-ear</display-name>

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

        <module>

          <ejb>jboss-seam-2.3.1.Final.jar</ejb>

        </module>

        <module>

          <web>

            <web-uri>B-webapp-0.1.war</web-uri>

            <context-root>/BWeb</context-root>

          </web>

        </module>

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

      </application>

       

      components.xml of B-webapp-0.1.war

       

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

      <components xmlns="http://jboss.org/schema/seam/components" xmlns:cache="http://jboss.org/schema/seam/cache" xmlns:core="http://jboss.org/schema/seam/core" xmlns:drools="http://jboss.org/schema/seam/drools" xmlns:mail="http://jboss.org/schema/seam/mail" xmlns:persistence="http://jboss.org/schema/seam/persistence" xmlns:security="http://jboss.org/schema/seam/security" xmlns:theme="http://jboss.org/schema/seam/theme" xmlns:transaction="http://jboss.org/schema/seam/transaction" xmlns:web="http://jboss.org/schema/seam/web" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="                 http://jboss.org/schema/seam/core http://jboss.org/schema/seam/core-2.3.xsd                 http://jboss.org/schema/seam/persistence http://jboss.org/schema/seam/persistence-2.3.xsd                 http://jboss.org/schema/seam/drools http://jboss.org/schema/seam/drools-2.3.xsd                 http://jboss.org/schema/seam/security http://jboss.org/schema/seam/security-2.3.xsd                 http://jboss.org/schema/seam/theme http://jboss.org/schema/seam/theme-2.3.xsd                 http://jboss.org/schema/seam/cache http://jboss.org/schema/seam/cache-2.3.xsd                 http://jboss.org/schema/seam/web http://jboss.org/schema/seam/web-2.3.xsd                 http://jboss.org/schema/seam/transaction http://jboss.org/schema/seam/transaction-2.3.xsd                 http://jboss.org/schema/seam/mail http://jboss.org/schema/seam/mail-2.3.xsd                 http://jboss.org/schema/seam/components http://jboss.org/schema/seam/components-2.3.xsd">

       

        <persistence:managed-persistence-context auto-create="true" name="entityManager" persistence-unit-jndi-name="java:/B-EntityManagerFactory"/>

       

        <security:identity authenticate-method="#{ORAuthenticator.login}"/>

        

              <core:resource-loader>

        <core:bundle-names>

        <value>messages</value>

        </core:bundle-names>

        </core:resource-loader>

       

       

      <component class="com.test.testBean" jndi-name="java:app/common-ejb/testBean"/>

       

      </components>

       

      ERROR LOG:

       

      I am using below code to look for bean and I try for all jndi option available ( showing in starting of server.log)

       

      InitialContext  context = new InitialContext();

      Object result = context.lookup(fullBeanName)

         

      Error : javax.naming.NamingException: JBAS011052: Failed to instantiate component view [Root exception is java.lang.IllegalStateException: JBAS011052: Failed to instantiate component view]

       

       

      Please let me know if any confusion or more information required.