JBoss Community

Jboss5.1 Migration to JBoss7.1 Custom-JNDI-Handling

created by Gary Dux in EJB3 Development - View the full discussion
Hello together,

in our applications we used to define jndi-mappings in jboss.xml:
<?xml version="1.0" encoding="UTF-8"?>
<jboss>
   <enterprise-beans>
     <session>
       <ejb-name>ContractPortfolioProcessServiceBean</ejb-name>
       <jndi-name>com/fja/ipl/customer/ilis/contractportfolio/ContractPortfolioProcessService</jndi-name>
     </session>
   </enterprise-beans>
</jboss>

ithis jboss.xml was placed then in META-INF of that ejb-jar

So it was easy to lookup for that bean like:

public static ContractPortfolioProcessService lookupContractPortfolioProcessService()
               throws NamingException {
                 final Context context = new InitialContext();
          return (ContractPortfolioProcessService ) context.lookup("com/fja/ipl/customer/ilis/contractportfolio/ContractPortfolioProcessService");
}
jndi.properties{
#JBoss
java.naming.factory.initial=org.jnp.interfaces.NamingContextFactory
java.naming.provider.url=jnp://localhost:1099
java.naming.factory.url.pkgs=org.jboss.naming http://cache-www.coderanch.com/images/smilies/jr-redface.gif rg.jnp.interfaces
}

How can it be made on JBOSS7?

Due ejb3-spec  in JBOSS7 they can also define jboss-ejb3.xml like this:
<jboss:ejb-jar xmlns:jboss="http://www.jboss.com/xml/ns/javaee"
                xmlns="http://java.sun.com/xml/ns/javaee"
                xmlns:iiop="urn:iiop"
                xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
                xsi:schemaLocation="http://www.jboss.com/xml/ns/javaee http://www.jboss.org/j2ee/schema/jboss-ejb3-2_0.xsd
                   http://java.sun.com/xml/ns/javaee http://www.jboss.org/j2ee/schema/jboss-ejb3-spec-2_0.xsd
                   urn:iiop jboss-ejb-iiop_1_0.xsd"
                version="3.1"
                impl-version="2.0">
     <enterprise-beans>
          <session>
             <ejb-name>CounterBean</ejb-name>
             <mapped-name>org/jboss/as/quickstarts/ejb/remote/stateful/CounterBean</mapped-name>
               </session>
     </enterprise-beans>

     <assembly-descriptor>
         <iiop:iiop>
             <ejb-name>CounterBean</ejb-name>
             <iiop:binding-name>org/jboss/as/quickstarts/ejb/remote/stateful/CounterBean</iiop:binding-name>
         </iiop:iiop>
     </assembly-descriptor>
</jboss:ejb-jar>

It deploys also errorless. But i did not find any dokumentation to lookup my ejb like in example above.

Who can help me giving a hint in this case?

How is the jndi.properties-Configuration would be in this case?

Reply to this message by going to Community

Start a new discussion in EJB3 Development at Community