谁解决了,我以身相许!
Myeclipse6.6+weblogic9.2开发EJB第一个Helloworld程序时出现这个问题:
javax.naming.NameNotFoundException: Unable to resolve 'HelloWorld'. Resolved '' [Root exception is javax.naming.NameNotFoundException: Unable to resolve 'HelloWorld'. Resolved '']; remaining name 'HelloWorld'
at weblogic.rjvm.ResponseImpl.unmarshalReturn(ResponseImpl.java:195)
at weblogic.rmi.cluster.ClusterableRemoteRef.invoke(ClusterableRemoteRef.java:338)
at weblogic.rmi.cluster.ClusterableRemoteRef.invoke(ClusterableRemoteRef.java:252)
at weblogic.jndi.internal.ServerNamingNode_920_WLStub.lookup(Unknown Source)
at weblogic.jndi.internal.WLContextImpl.lookup(WLContextImpl.java:374)
at weblogic.jndi.internal.WLContextImpl.lookup(WLContextImpl.java:362)
at javax.naming.InitialContext.lookup(Unknown Source)
at com.ejb.TestEJB.main(TestEJB.java:24)
TestEJB客户端程序是:
package com.ejb;
import java.util.Properties;
import javax.naming.Context;
import javax.naming.InitialContext;
import javax.naming.NamingException;
import com.interfaces.HelloWorldHome;
public class TestEJB {
/**
* @param args
* @throws NamingException
*/
public static void main(String[] args) throws NamingException {
// TODO Auto-generated method stub
Properties properties=new Properties();
properties.put(Context.INITIAL_CONTEXT_FACTORY, "weblogic.jndi.WLInitialContextFactory");
properties.put(Context.PROVIDER_URL,"t3://localhost:7001");
try{
Context context=new InitialContext(properties);
HelloWorldHome home=(HelloWorldHome)context.lookup("HelloWorld");
HelloWorld hello=(HelloWorld) home.create();
System.out.println(hello.hello());
}
catch(Exception e)
{
e.printStackTrace();
}
}
}
问题到底错在哪里啊!
小女子这厢有礼了?