HI: I installed weblogic6.1 on winNT. I wrote all the EJB code - Hello, I defined the JNDI name Which is 'HelloHome' in weblogic-ejb-jar.xml. but when I run the EJB Client, I got the following error:
javax.naming.NameNotFoundException: Unable to resolve HelloHome. Resolved: '' Un resolved:'HelloHome' ; remaining name '' at weblogic.rmi.internal.BasicOutboundRequest.sendReceive(BasicOutboundR equest.java:85) at weblogic.rmi.cluster.ReplicaAwareRemoteRef.invoke(ReplicaAwareRemoteR ef.java:253) at weblogic.rmi.cluster.ReplicaAwareRemoteRef.invoke(ReplicaAwareRemoteR ef.java:220) at weblogic.rmi.internal.ProxyStub.invoke(ProxyStub.java:35) at $Proxy0.lookup(Unknown Source) at weblogic.jndi.internal.WLContextImpl.lookup(WLContextImpl.java:323) at javax.naming.InitialContext.lookup(Unknown Source) at com.etco.af.tests.hello.HelloTest.main(Unknown Source) I really don't know what happen. Any difference of directories between weblogic6.1 and weblogic6.0? Please help!!! Sarah
Pls post your ejb-jar.xml and weblogic-ejb-jar.xml and the piece of code where you try to recover the jndi context, cause problably something is wrong with it, I use WL6.1 and don�t have problems with jndi. If you post it we�re gonna be able to help you. regards.
Matjaz Juric<br />Author of <a href="http://www.amazon.com/exec/obidos/ASIN/186100544X/qid%3D1008676221/sr%3D8-1/ref%3Dsr%5F8%5F5%5F1/103-4928879-8274265" target="_blank" rel="nofollow">Professional J2EE EAI</a> and <a href="http://www.amazon.com/exec/obidos/ASIN/1861005083/ref=ase_electricporkchop" target="_blank" rel="nofollow">Professional EJB</a>
sarah Marsh
Ranch Hand
Joined: Mar 06, 2001
Posts: 282
posted
0
Thanks a lot! I use MyProxy instead of Hello. Here is the code: 1. 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> <ejb-name>MyProxyEJB</ejb-name> <home>com.etco.af.tests.hello.MyProxyHome</home> <remote>com.etco.af.tests.hello.MyProxy</remote> <ejb-class>com.etco.af.tests.hello.MyProxyBean</ejb-class> <session-type>Stateless</session-type> <transaction-type>Container</transaction-type> </session> </enterprise-beans> <assembly-descriptor> <container-transaction> <method> <ejb-name>MyProxyEJB</ejb-name> <method-intf>Remote</method-intf> <method-name>*</method-name> </method> <trans-attribute>Required</trans-attribute> </container-transaction> </assembly-descriptor> </ejb-jar> 2. weblogic-ejb-jar.xml: <?xml version="1.0"?> < !DOCTYPE weblogic-ejb-jar PUBLIC '-//BEA Systems, Inc.//DTD WebLogic 5.1.0 EJB//EN' 'http://www.bea.com/servers/wls510/dtd/weblogic-ejb-jar.dtd'> <weblogic-ejb-jar> <weblogic-enterprise-bean> <ejb-name>MyProxyEJB</ejb-name> <caching-descriptor> <max-beans-in-cache>100</max-beans-in-cache> </caching-descriptor> <jndi-name>MyProxyHome</jndi-name> </weblogic-enterprise-bean> </weblogic-ejb-jar> 3. piece of Client code: Properties env = new Properties(); env.put(Context.INITIAL_CONTEXT_FACTORY,"weblogic.jndi.WLInitialContextFactory"); env.put(Context.PROVIDER_URL, "t3://localhost:7001"); try { InitialContext ic = new InitialContext(env); System.out.println("Got context"); System.out.println("ic = " + ic); //Error message Here: Object ref = ic.lookup("MyProxyHome"); --error message: javax.naming.NameNotFoundException: Unable to resolve MyProxyHome. Resolved: '' Unresolved:'MyProxyHome' ; remaining name '' at weblogic.rmi.internal.AbstractOutboundRequest.sendReceive(AbstractOut boundRequest.java:90) at weblogic.rmi.cluster.ReplicaAwareRemoteRef.invoke(ReplicaAwareRemoteR ef.java:247) at weblogic.rmi.cluster.ReplicaAwareRemoteRef.invoke(ReplicaAwareRemoteR ef.java:225) at weblogic.jndi.internal.ServerNamingNode_WLStub.lookup(ServerNamingNod e_WLStub.java:121) at weblogic.jndi.internal.WLContextImpl.lookup(WLContextImpl.java:323) at javax.naming.InitialContext.lookup(Unknown Source) at com.etco.af.tests.hello.MyProxyClientTest.main(Unknown Source)
Marcos Maia
Ranch Hand
Joined: Jan 06, 2001
Posts: 977
posted
0
Hi, try to change the DOC type from your weblogic-ejb-jar.xml to: < !DOCTYPE weblogic-ejb-jar PUBLIC <br /> '-//BEA Systems, Inc.//DTD WebLogic 6.0.0 EJB//EN' <br /> 'http://www.bea.com/servers/wls600/dtd/weblogic-ejb-jar.dtd'> and also if it does not work try to make a straigth cast(I know this is out of the specs, but as you know it�s a java type and not a CORBA object you can do so) to the home tipe of your bean in the lookup method as: EJBHome home = (EJBHome) ctx.lookup("JNDI_NAME"); if this doesn�t work you can send me the code at: mmaia@mrbrasilia.com.br or mmaia@linkexpress.com.br and I�ll take a look for you. regards.
sarah Marsh
Ranch Hand
Joined: Mar 06, 2001
Posts: 282
posted
0
Thanks all! Marcos, I modified my code as you suggested but still doesn't work, same error message. Then I wrote a small simple Hello code which works fine. In MyProxy code, I need to use dynamic proxy class, that maybe the reason cause the problem. But I don't know why. Do you have any idea it or some samples of dynamic proxy class? Thanks again!