我正在开发一个在 Glassfish v3 上调用一些 EJB 方法的独立客户端。在我将客户端集成到一个 Eclipse 插件中以在我们的 RCP 应用程序中运行之前,这很有效。在此设置中,初始化命名上下文似乎存在类加载器问题,我得到下面列出的异常。(客户端有 gf-client.jar 及其类路径上的所有依赖项。)
它失败了
m_ctx = new InitialContext();
有这个特例
java.lang.NoSuchMethodException: org.eclipse.osgi.internal.baseadaptor.DefaultClassLoader.findResources(java.lang.String)
at java.lang.Class.getMethod(Class.java:1605)
at com.sun.enterprise.module.single.ManifestProxy.<init>(ManifestProxy.java:34)
at com.sun.enterprise.module.single.ProxyModuleDefinition.<init>(ProxyModuleDefinition.java:78)
at com.sun.enterprise.module.single.ProxyModuleDefinition.<init>(ProxyModuleDefinition.java:73)
at com.sun.enterprise.module.single.SingleModulesRegistry.<init>(SingleModulesRegistry.java:42)
at com.sun.enterprise.module.single.SingleModulesRegistry.<init>(SingleModulesRegistry.java:30)
at com.sun.enterprise.module.single.StaticModulesRegistry.<init>(StaticModulesRegistry.java:60)
at org.glassfish.internal.api.Globals.getStaticHabitat(Globals.java:67)
at com.sun.enterprise.naming.impl.SerialContext.<init>(SerialContext.java:183)
at com.sun.enterprise.naming.impl.SerialContext.<init>(SerialContext.java:253)
at com.sun.enterprise.naming.impl.SerialInitContextFactory.createInitialContext(SerialInitContextFactory.java:121)
at com.sun.enterprise.naming.impl.SerialInitContextFactory.getInitialContext(SerialInitContextFactory.java:116)
at javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:667)
at javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:288)
at javax.naming.InitialContext.init(InitialContext.java:223)
at javax.naming.InitialContext.<init>(InitialContext.java:175)
有人知道如何解决这个问题吗?