按照书上的例子,在weblogic8上面部署好了,通过http://localhost:7001/console进去后,看到EJB Modules的内容
Name URI Deployment Order
helloworld_ejb helloworld_ejb.jar 100
可是访问的时候出问题。我的整个目录如下,helloworld是主目录,
-|build.xml
|helloworld_ejb.jar
|ejb-jar.xml
|helloworld_ejb.jar
|weblogic-ejb-jar.xml
|classes
|com
|learnweblogic
|examples
|examples
| BaseClient.java
| BaseClient.class
| ch8
| helloworld
| HelloWorld.class
| HelloWorldBean.class
| HelloWorldClient.class
| HelloWorldHome.class
我在helloworld目录下运行
java -classpath %CLASSPATH%;helloworld_ejb.jar com.learnweblogic.examples.ch8.helloworld.HelloWorldClient
出现:java.lang.NoClassDefFoundError: Files\Java\jdk1/5/0\lib\dt/jar;C:\Program
如果运行java -classpath .;helloworld_ejb.jar com.learnweblogic.examples.ch8.helloworld.HelloWorldClient
出现如下:
** Unable to connect to the server at:http://localhost:7001
javax.naming.NoInitialContextException: Cannot instantiate class: weblogic.jndi.
WLInitialContextFactory [Root exception is java.lang.ClassNotFoundException: web
logic.jndi.WLInitialContextFactory]
at javax.naming.spi.NamingManager.getInitialContext(Ljava.util.Hashtable
;)Ljavax.naming.Context;(NamingManager.java:652)
at javax.naming.InitialContext.getDefaultInitCtx()Ljavax.naming.Context;
(InitialContext.java:243)
at javax.naming.InitialContext.init(Ljava.util.Hashtable;)V(InitialConte
xt.java:219)
at javax.naming.InitialContext.<init>(Ljava.util.Hashtable;)V(InitialCon
text.java:195)
at com.learnweblogic.examples.BaseClient.getInitialContext()Ljavax.namin
g.Context;(BaseClient.java:30)
at com.learnweblogic.examples.ch8.helloworld.HelloWorldClient.<init>([Lj
ava.lang.String;)V(HelloWorldClient.java:18)
at com.learnweblogic.examples.ch8.helloworld.HelloWorldClient.main([Ljav
a.lang.String;)V(HelloWorldClient.java:60)
Caused by: java.lang.ClassNotFoundException: weblogic.jndi.WLInitialContextFacto
ry
at java.lang.Class.forName(Ljava.lang.String;ZLjava.lang.ClassLoader;)Lj
ava.lang.Class;(Unknown Source)
at com.sun.naming.internal.VersionHelper12.loadClass(Ljava.lang.String;)
Ljava.lang.Class;(VersionHelper12.java:42)
at javax.naming.spi.NamingManager.getInitialContext(Ljava.util.Hashtable
;)Ljavax.naming.Context;(NamingManager.java:649)
… 6 more
javax.naming.NoInitialContextException: Cannot instantiate class: weblogic.jndi.
WLInitialContextFactory [Root exception is java.lang.ClassNotFoundException: web
logic.jndi.WLInitialContextFactory]
at javax.naming.spi.NamingManager.getInitialContext(Ljava.util.Hashtable
;)Ljavax.naming.Context;(NamingManager.java:652)
at javax.naming.InitialContext.getDefaultInitCtx()Ljavax.naming.Context;
(InitialContext.java:243)
at javax.naming.InitialContext.init(Ljava.util.Hashtable;)V(InitialConte
xt.java:219)
at javax.naming.InitialContext.<init>(Ljava.util.Hashtable;)V(InitialCon
text.java:195)
at com.learnweblogic.examples.BaseClient.getInitialContext()Ljavax.namin
g.Context;(BaseClient.java:30)
at com.learnweblogic.examples.ch8.helloworld.HelloWorldClient.<init>([Lj
ava.lang.String;)V(HelloWorldClient.java:18)
at com.learnweblogic.examples.ch8.helloworld.HelloWorldClient.main([Ljav
a.lang.String;)V(HelloWorldClient.java:60)
Caused by: java.lang.ClassNotFoundException: weblogic.jndi.WLInitialContextFacto
ry
at java.lang.Class.forName(Ljava.lang.String;ZLjava.lang.ClassLoader;)Lj
ava.lang.Class;(Unknown Source)
at com.sun.naming.internal.VersionHelper12.loadClass(Ljava.lang.String;)
Ljava.lang.Class;(VersionHelper12.java:42)
at javax.naming.spi.NamingManager.getInitialContext(Ljava.util.Hashtable
;)Ljavax.naming.Context;(NamingManager.java:649)
… 6 more
可是我打得开http://localhost:7001 ,我是运行weblogic的launch weblogic server examples
麻烦各位帮我分析一下是什么地方出问题了?运行的参数不对,还是没有部署好?