小弟在做ejb的一个小例子,部署可以但是在测试的时候出现这样的异常,搞了一天多了,哪个大哥知道的帮帮忙啊
ejbtest.java
public class EJBTest {
/**
* @param args
*/
public static void main(String[] args) {
Properties properties=new Properties();
properties.setProperty(Context.INITIAL_CONTEXT_FACTORY,"weblogic.jndi.WLInitialContextFactory");
properties.setProperty(Context.PROVIDER_URL,"t3://localhost:7001");
Context context;
try
{
context=new InitialContext(properties);
HelloWorldHome hwh=(HelloWorldHome)context.lookup("ejb/HelloWorld");
HelloWorld hw=(HelloWorld) hwh.create();
System.out.println(hw.Hello());
}
catch(Exception ex)
{
ex.printStackTrace();
}
}
}
-----------------------------------------------------------------------------------
java.lang.NullPointerException
at weblogic.rmi.internal.StubGenerator.getStubOnClient(Lweblogic.rmi.internal.StubInfo;Ljava.lang.ClassLoader;)Ljava.lang.Class;(StubGenerator.java:792)
at weblogic.rmi.internal.StubGenerator.getStubClass(Lweblogic.rmi.internal.StubInfo;Ljava.lang.ClassLoader;Ljava.lang.String;)Ljava.lang.Class;(StubGenerator.java:765)
at weblogic.rmi.internal.StubGenerator.generateStub(Lweblogic.rmi.internal.StubInfo;Ljava.lang.ClassLoader;Ljava.lang.String;)Ljava.lang.Object;(StubGenerator.java:810)
at weblogic.rmi.internal.StubGenerator.generateStub(Lweblogic.rmi.internal.StubInfo;)Ljava.lang.Object;(StubGenerator.java:797)
at weblogic.rmi.extensions.StubFactory.getStub(Lweblogic.rmi.internal.StubInfo;)Ljava.lang.Object;(StubFactory.java:79)
at weblogic.jndi.WLInitialContextFactoryDelegate.newRootNamingNodeStub(Lweblogic.rmi.extensions.server.RemoteReference;)Lweblogic.jndi.internal.NamingNode;(WLInitialContextFactoryDelegate.java:481)
at weblogic.jndi.WLInitialContextFactoryDelegate.newRemoteContext(Lweblogic.rjvm.RJVM;Lweblogic.jndi.Environment;Ljava.lang.String;)Ljavax.naming.Context;(WLInitialContextFactoryDelegate.java:444)
at weblogic.jndi.WLInitialContextFactoryDelegate.newContext(Lweblogic.rjvm.RJVM;Lweblogic.jndi.Environment;Ljava.lang.String;)Ljavax.naming.Context;(WLInitialContextFactoryDelegate.java:350)
at weblogic.jndi.WLInitialContextFactoryDelegate.getInitialContext(Lweblogic.jndi.Environment;Ljava.lang.String;)Ljavax.naming.Context;(WLInitialContextFactoryDelegate.java:313)
at weblogic.jndi.WLInitialContextFactoryDelegate.getInitialContext(Ljava.util.Hashtable;)Ljavax.naming.Context;(WLInitialContextFactoryDelegate.java:239)
at weblogic.jndi.WLInitialContextFactory.getInitialContext(Ljava.util.Hashtable;)Ljavax.naming.Context;(WLInitialContextFactory.java:135)
at javax.naming.spi.NamingManager.getInitialContext(Ljava.util.Hashtable;)Ljavax.naming.Context;(NamingManager.java:662)
at javax.naming.InitialContext.getDefaultInitCtx()Ljavax.naming.Context;(InitialContext.java:243)
at javax.naming.InitialContext.init(Ljava.util.Hashtable;)V(InitialContext.java:219)
at javax.naming.InitialContext. <init>(Ljava.util.Hashtable;)V(InitialContext.java:195)
at EJBTest.main([Ljava.lang.String;)V(EJBTest.java:22)
--------------- nested within: ------------------
weblogic.utils.AssertionError: ***** ASSERTION FAILED *****[ Failed to generate class for weblogic.jndi.internal.ServerNamingNode_813_WLStub ] - with nested exception:
[java.lang.NullPointerException]
at weblogic.rmi.internal.StubGenerator.generateStub(Lweblogic.rmi.internal.StubInfo;Ljava.lang.ClassLoader;Ljava.lang.String;)Ljava.lang.Object;(StubGenerator.java:814)
at weblogic.rmi.internal.StubGenerator.generateStub(Lweblogic.rmi.internal.StubInfo;)Ljava.lang.Object;(StubGenerator.java:797)
at weblogic.rmi.extensions.StubFactory.getStub(Lweblogic.rmi.internal.StubInfo;)Ljava.lang.Object;(StubFactory.java:79)
at weblogic.jndi.WLInitialContextFactoryDelegate.newRootNamingNodeStub(Lweblogic.rmi.extensions.server.RemoteReference;)Lweblogic.jndi.internal.NamingNode;(WLInitialContextFactoryDelegate.java:481)
at weblogic.jndi.WLInitialContextFactoryDelegate.newRemoteContext(Lweblogic.rjvm.RJVM;Lweblogic.jndi.Environment;Ljava.lang.String;)Ljavax.naming.Context;(WLInitialContextFactoryDelegate.java:444)
at weblogic.jndi.WLInitialContextFactoryDelegate.newContext(Lweblogic.rjvm.RJVM;Lweblogic.jndi.Environment;Ljava.lang.String;)Ljavax.naming.Context;(WLInitialContextFactoryDelegate.java:350)
at weblogic.jndi.WLInitialContextFactoryDelegate.getInitialContext(Lweblogic.jndi.Environment;Ljava.lang.String;)Ljavax.naming.Context;(WLInitialContextFactoryDelegate.java:313)
at weblogic.jndi.WLInitialContextFactoryDelegate.getInitialContext(Ljava.util.Hashtable;)Ljavax.naming.Context;(WLInitialContextFactoryDelegate.java:239)