-----Urspr�ngliche Nachricht-----Hi Dragos,
Von: Larry Hohm [mailto:[EMAIL PROTECTED]]
Gesendet: Freitag, 12. Oktober 2001 18:00
An: Dragos Haiduc
Betreff: Re: AW: [JBoss-user] Problem JNDI lookup, EJB is not boundThank you for your prompt reply. Yes, the <ejb-name> in my ejb-jar.xml matches the <ejb-name> in my jboss.xml -- both are set to "SessionProxyManager". Below is the ejb-jar.xml file I am using.
The application I am trying to deploy in JBoss has 25 EJBs. When I search the log for "bound" I find that only one is bound. I am studying the code and DDs, trying to find some difference between the EJB that gets bound and the others that don't. Any ideas?
------- EJB-JAR.XML ------------------------------------------------
<?xml version="1.0"?>
<!DOCTYPE ejb-jar PUBLIC '-//Sun Microsystems, Inc.//DTD Enterprise JavaBeans 1.1//EN' 'http://java.sun.com/j2ee/dtds/ejb-jar_1_1.dtd'>
<ejb-jar>
<enterprise-beans>
<session>
<display-name></display-name>
<ejb-name>SessionProxyManager</ejb-name>
<home>com.epicedge.sun.eduport.server.sessionbeans.proxy.SessionProxyManagerHome</home>
<remote>com.epicedge.sun.eduport.server.sessionbeans.proxy.SessionProxyManager</remote>
<ejb-class>com.epicedge.sun.eduport.server.sessionbeans.proxy.SessionProxyManagerBean</ejb-class>
<session-type>Stateless</session-type>
<transaction-type>Container</transaction-type>
<resource-ref>
<description></description>
<res-ref-name>jdbc/Eduport</res-ref-name>
<res-type>javax.sql.DataSource</res-type>
<res-auth>Container</res-auth>
</resource-ref>
</session>
</enterprise-beans>
<assembly-descriptor>
</assembly-descriptor>
</ejb-jar>
Dragos Haiduc wrote:
Sorry for asking stupid questions, have you provided also the other needed deployment descriptor, ejb-jar.xml?In that one you specify your EJB classes, plus the home and remote interfaces.PLEASE MAKE SURE that the <ejb-name> element, which is present in both DDs(ejb-jar.xml and jboss.xml) contains the same "value", which is SessionProxyManager in your case.Hope this helps,Best,Dragos-----Urspr�ngliche Nachricht-----I am having trouble with a simple EJB tester trying to test a session bean deployed in JBoss 2.2.2. I can get a JNDI context, but not a reference to the EJB. I double-checked the JNDI name in the jboss.xml file, and it matches the name I am trying to lookup. Below is the error message and the source code. Any ideas?
Von: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]Im Auftrag von Larry Hohm
Gesendet: Donnerstag, 11. Oktober 2001 23:49
An: [EMAIL PROTECTED]
Betreff: [JBoss-user] Problem JNDI lookup, EJB is not bound------- ERROR MESSAGE --------------------------------------------------------
E:\devroot\suneduport\classes>java test.ShoppingCartTester
Got context
javax.naming.NameNotFoundException: SessionProxyManagerHome.SessionProxyManager not bound
at sun.rmi.transport.StreamRemoteCall.exceptionReceivedFromServer(StreamRemoteCall.java:245)at sun.rmi.transport.StreamRemoteCall.executeCall(StreamRemoteCall.java:220)
at sun.rmi.server.UnicastRef.invoke(UnicastRef.java:122)
at org.jnp.server.NamingServer_Stub.lookup(Unknown Source)
at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:349)
at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:333)
at javax.naming.InitialContext.lookup(InitialContext.java:350)
at test.ShoppingCartTester.main(Unknown Source)
-------- JBOSS.XML --------------------------------------------------------
<jboss>
<enterprise-beans>
<session>
<ejb-name>SessionProxyManager</ejb-name>
<jndi-name>SessionProxyManagerHome.SessionProxyManager</jndi-name>
<resource-ref>
<res-ref-name>jdbc/Eduport</res-ref-name>
<resource-name>eduport</resource-name>
</resource-ref>
</session>
</enterprise-beans><resource-managers>
<resource-manager res-class="javax.sql.DataSource">
<res-name>eduport</res-name>
<res-jndi-name>java:/eduport</res-jndi-name>
</resource-manager>
</resource-managers>
</jboss>-------- SOURCE CODE --------------------------------------------------------
package test;
import java.util.Properties;
import javax.rmi.PortableRemoteObject;
import javax.naming.*;
import com.epicedge.sun.eduport.server.sessionbeans.shoppingcart.*;
import com.epicedge.sun.eduport.server.sessionbeans.proxy.SessionProxyManagerHome;
import com.epicedge.sun.eduport.server.sessionbeans.proxy.SessionProxyManager;
import com.epicedge.sun.eduport.dataobject.ShoppingCartData;
import com.epicedge.sun.eduport.cache.*;
/**
*
*/
public class ShoppingCartTester extends java.lang.Object
{/** Creates new ShoppingCartTester */
public ShoppingCartTester()
{
}/** This method does all the work. */
public static void main(String[] args)
{
// Set up the naming provider; this may not always be necessary, depending
// on how your Java system is configured.
com.epicedge.sun.eduport.cache.EduportStaticDataHelper.setStaticDataHolder(new EduportStaticDataHolder());Properties env = new Properties();
env.setProperty("java.naming.factory.initial", "org.jnp.interfaces.NamingContextFactory");
env.setProperty("java.naming.provider.url", "localhost:1099");
env.setProperty("java.naming.factory.url.pkgs", "org.jboss.naming");// Enclosing the whole process in a single `try' block is not an ideal way
// to do exception handling, but I don't want to clutter the program up
// with catch blocks
try
{
// Get a naming context
InitialContext jndiContext = new InitialContext(env);
System.out.println("Got context");// Get a reference to the SessionProxyManager Bean
Object ref = jndiContext.lookup("SessionProxyManagerHome.SessionProxyManager");
System.out.println("Got reference");// Get a reference to the Bean's Home interface
SessionProxyManagerHome home = (SessionProxyManagerHome)
PortableRemoteObject.narrow (ref, SessionProxyManagerHome.class);
System.out.println("Got home interface");// Create a SessionProxyManager object from the Home interface
SessionProxyManager proxy = home.create();
System.out.println("Got remote interface");ShoppingCartData cart = proxy.getUserShoppingCart("hohm");
System.out.println("Got shopping cart");if (cart == null)
{
System.out.println("Cart is null");
System.exit(1);
}System.out.println("main: cartID = " + cart.getCartID());
System.out.println("main: creationDate = " + cart.getCreationDate());
System.out.println("main: userID = " + cart.getUserID());
System.out.println("main: isAbandonedByUser = " + cart.isAbandonedByUser());
System.out.println("main: isActive = " + cart.isActive());}
catch(Exception e)
{
e.printStackTrace();
}
System.exit(0);
}
}
It's
normal to be only one EJB bound, you only mention one EJB in your
DD.
