包装ejb3 swing客户端

时间:2010-06-06 00:54:56

标签: jboss ejb-3.0 executable-jar

我得到了“java.lang.ClassNotFoundException:org.jnp.interfaces.NamingContextFac “运行我的打包的ejb3 swing客户端jar时出错”。这是堆栈跟踪。

G:\Courses\OSUMC\Installables\June 5\New>java -jar MetaDB-Client.jar
javax.naming.NoInitialContextException: Cannot instantiate class: org.jnp.interf
aces.NamingContextFactory [Root exception is java.lang.ClassNotFoundException: o
rg.jnp.interfaces.NamingContextFactory]
        at javax.naming.spi.NamingManager.getInitialContext(Unknown Source)
        at javax.naming.InitialContext.getDefaultInitCtx(Unknown Source)
        at javax.naming.InitialContext.init(Unknown Source)
        at javax.naming.InitialContext.<init>(Unknown Source)
        at net.massmatrix.metadb.ui.facade.BaseEJBFacade.getInitialContext(BaseE
JBFacade.java:26)
        at net.massmatrix.metadb.ui.facade.UserManagerFacade.getUserManager(User
ManagerFacade.java:24)
        at net.massmatrix.metadb.ui.facade.UserManagerFacade.isUserNameAvailable
(UserManagerFacade.java:44)
        at net.massmatrix.metadb.ui.MainFrame.main(MainFrame.java:269)
Caused by: java.lang.ClassNotFoundException: org.jnp.interfaces.NamingContextFac
tory
        at java.net.URLClassLoader$1.run(Unknown Source)
        at java.security.AccessController.doPrivileged(Native Method)
        at java.net.URLClassLoader.findClass(Unknown Source)
        at java.lang.ClassLoader.loadClass(Unknown Source)
        at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
        at java.lang.ClassLoader.loadClass(Unknown Source)
        at java.lang.Class.forName0(Native Method)
        at java.lang.Class.forName(Unknown Source)
        at com.sun.naming.internal.VersionHelper12.loadClass(Unknown Source)
        ... 8 more
Exception in thread "main" java.lang.NullPointerException
        at net.massmatrix.metadb.ui.facade.UserManagerFacade.isUserNameAvailable
(UserManagerFacade.java:44)
        at net.massmatrix.metadb.ui.MainFrame.main(MainFrame.java:269)

以下是我打包的swing客户端Jar内容: -

MetaDB-Client.jar
  \net\.. - contains class files(from both client and server)
  META-INF
    MANIFEST.MF
  jndi.properties

这是我的jndi.properties: -

java.naming.factory.initial=org.jnp.interfaces.NamingContextFactory
java.naming.factory.url.pkgs=org.jboss.naming:org.jnp.interfaces
java.naming.provider.url=localhost:1099

这是我的MANIFEST.MF: -

Manifest-Version: 1.0
Main-Class: net.massmatrix.metadb.ui.MainFrame
Class-Path: jbossall-client.jar

从我的jar中显示内容: -

Manifest-Version: 1.0
Created-By: 1.6.0_18 (Sun Microsystems Inc.)
Main-Class: net.massmatrix.metadb.ui.MainFrame

用于创建jar的命令: -

jar cfm MetaDB-Client.jar MANIFEST.MF net\* jndi.properties

用于运行jar的命令: -

java -jar MetaDB-Client.jar

我的classpath中有jbossall-client.jar

G:\Courses\OSUMC\Installables\June 5\New>echo %CLASSPATH%
.;G:\Courses\OSUMC\WORK\Software - New\jboss-5.0.1.GA\client

我还缺少什么?

感谢。

1 个答案:

答案 0 :(得分:0)

您所要做的就是将jbossall-client.jar库添加到客户端lib文件夹中 MANIFEST中的ClassPath不能包含* {JAR清单类路径的Here is the tutorial