[EJB 3.0] - Re: Doing BMP with EJB3. JNDI problems?
by JGF1
"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
18 years, 1 month
[EJB 3.0] - Re: Doing BMP with EJB3. JNDI problems?
by JGF1
"ALRubinger" wrote : I'm not familiar with this book, but I'm not sure about it's aims for you. :)
|
| Application 1.4 is for JEE1.4 == EJB2, Application 5 is for JEE5==EJB3.
|
| S,
| ALR
My aim is to become familar enough with Java EE to hopefully get a job at some point. In the book they show BMP and describe there may be instances when you need to resort to this such as a database that doesn't support JDBC, or legacy database.
I hope I don't need to do this too often, as it seems an awful lot of effort..
But they say EJB3 is still backwardly compatible with EJB2 for the BMP part.
For me the book didn't cover in enough detail the reason for all that XML plumbing and the relationship between all the artifacts.
If you know of a good online reference for this type of stuff, so I can get a better insight, I'd appreciate it.
I'm hoping the typo in the DTD for application was the reason JNDI lookup wasn't working.
I'm going to have to dig a little deeper to understand the relationship between EJBObject, EntityBean and EJBHome base classes/interfaces.
I am particularly interested in understanding the correlation between the ejb-jar.xml entity node and the getStockHome method in StockListBean and how it relates to JBoss.
I'll try redeploing everything with the fixed application.xml and see if it makes more sense...
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4134997#4134997
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4134997
18 years, 1 month