[jboss-user] [EJB 3.0] - Re: Doing BMP with EJB3. JNDI problems?

JGF1 do-not-reply at jboss.com
Fri Mar 7 19:22:20 EST 2008


"JGF1" wrote : "JGF1" wrote : 
  |   | I'm hoping the typo in the DTD for application was the reason JNDI lookup wasn't working.
  |   | 
  | I am afraid things still aren't working.
  | 
  | Still saying beans_2x.Stock not bound arising from call to getStockHome() in StockListBean...
  | 1) Should JNDI entries have appeared when the original EAR is deployed?
  | 2) Should I change the headers for:
  | jboss.xml        javaee -> j2ee
  | ejb-jar.xml        3.0 -> 2.1
  | application.xml v5 -> 1.4
  | Or do you think this is going to be irrelevant?
  | 

When I did 2 everything fell into place....
Application.xml becomes:

  | <?xml version="1.0" encoding="UTF-8"?>
  | <application xmlns="http://java.sun.com/xml/ns/j2ee" version="1.4"
  |  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
  |  xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/application_1.4.xsd">
  |   <display-name>StockListBmpApp</display-name>
  |   <description>Application description</description>
  |   <module>
  |    <ejb>StockList2xBmp.jar</ejb>
  |   </module>
  | </application>
  | 

ejb-jar.xml becomes:

  | <?xml version="1.0" encoding="UTF-8"?>
  | <ejb-jar xmlns="http://java.sun.com/xml/ns/j2ee" version="2.1"
  |  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
  |  xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/ejb-jar_2_1.xsd">
  |   <display-name>StockListBmpJar</display-name>
  |   <enterprise-beans>
  |     <entity>
  |       <ejb-name>StockEjb</ejb-name>
  |       <home>beans_2x.StockHome</home>
  |       <remote>beans_2x.Stock</remote>
  |       <ejb-class>beans_2x.StockBean</ejb-class>
  |       <persistence-type>Bean</persistence-type>
  |       <prim-key-class>java.lang.String</prim-key-class>
  |       <reentrant>false</reentrant>
  |       <resource-ref>
  |         <res-ref-name>jdbc/StockDB</res-ref-name>
  |         <res-type>javax.sql.DataSource</res-type>
  |         <res-auth>Container</res-auth>
  |         <res-sharing-scope>Shareable</res-sharing-scope>
  |       </resource-ref>
  |       <security-identity>
  |         <use-caller-identity/>
  |       </security-identity>
  |     </entity>
  |   </enterprise-beans>
  |   <assembly-descriptor>
  |     <container-transaction>
  |       <method>
  |         <ejb-name>StockEjb</ejb-name>
  |         <method-intf>Remote</method-intf>
  |         <method-name>setName</method-name>
  |         <method-params>
  |           <method-param>java.lang.String</method-param>
  |         </method-params>
  |       </method>
  |       <trans-attribute>Required</trans-attribute>
  |     </container-transaction>
  |     <container-transaction>
  |       <method>
  |         <ejb-name>StockEjb</ejb-name>
  |         <method-intf>Remote</method-intf>
  |         <method-name>getName</method-name>
  |       </method>
  |       <trans-attribute>Required</trans-attribute>
  |     </container-transaction>
  |     <container-transaction>
  |       <method>
  |         <ejb-name>StockEjb</ejb-name>
  |         <method-intf>Remote</method-intf>
  |         <method-name>remove</method-name>
  |       </method>
  |       <trans-attribute>Required</trans-attribute>
  |     </container-transaction>
  |     <container-transaction>
  |       <method>
  |         <ejb-name>StockEjb</ejb-name>
  |         <method-intf>Remote</method-intf>
  |         <method-name>getTickerSymbol</method-name>
  |       </method>
  |       <trans-attribute>Required</trans-attribute>
  |     </container-transaction>
  |   </assembly-descriptor>
  | </ejb-jar>
  | 

jboss.xml becomes:

  | <!DOCTYPE jboss PUBLIC
  |           "-//JBoss//DTD JBOSS 4.0//EN"
  |           "http://www.jboss.org/j2ee/dtd/jboss_4_0.dtd">
  | <jboss>
  |   <enterprise-beans>
  |     <entity>
  |       <ejb-name>StockEjb</ejb-name>
  |       <jndi-name>beans_2x.Stock</jndi-name>
  |       <resource-ref>
  |         <res-ref-name>jdbc/StockDB</res-ref-name>
  |         <jndi-name>java:/DefaultDS</jndi-name>
  |       </resource-ref>
  |     </entity>
  |   </enterprise-beans>
  | </jboss>
  | 

What tipped me of was the fact that there was no file at:
http://www.jboss.org/javaee/dtd/jboss_4_0.dtd
This is one point where JBoss 4.2.2 GA is still pointing to legacy stuff.

When these changes were made (Can't just do in jboss.xml, others have to be downgraded too), suddenly when I looked at the JNDI registry in JMX Console, after deploying ear, a whole lot of new stuff appeared on a search for Stock.
Now I have:

Ejb Module: StockList2xBmp.jar
java:comp namespace of the StockEjb bean:
  +- HandleDelegate (class: org.jboss.proxy.ejb.handle.HandleDelegateImpl)
  +- ORB (class: org.jacorb.orb.ORB)
  +- env (class: org.jnp.interfaces.NamingContext)
  |   +- jdbc (class: org.jnp.interfaces.NamingContext)
  |   |   +- StockDB[link -> java:/DefaultDS] (class: javax.naming.LinkRef)

Global JNDI Namespace
beans_2x.Stock (proxy: $Proxy71 implements interface beans_2x.StockHome,interface javax.ejb.Handle)


(The following appears as before when ejb3 file gets deployed.
  +- StockListBean (class: org.jnp.interfaces.NamingContext)
  |   +- remote (proxy: $Proxy81 implements interface beans.StockList,interface org.jboss.ejb3.JBossProxy)

Suddenly everything works. Who'd of thunk it!

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

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4135014



More information about the jboss-user mailing list