从 GWT 开发模式到 glassfish v3 的 EJB JNDI 查找
我正在尝试从 GWT devmode 中执行 JNDI 查找。
我有一个本地 glassfishv3 运行我想要查找的 EJB。如果我将 GWT-Webapp 部署到所述 glassfish 中,一切都会按预期工作。但是,如果我尝试从 devmode 中查找 EJB,则会出现此异常:
javax.naming.NamingException: Lookup failed for 'myBean' in SerialContext [Root exception is javax.naming.NamingException: Unable to acquire SerialContextProvider for SerialContext [Root exception is java.lang.NullPointerException]] ... Caused by: javax.naming.NamingException: Unable to acquire SerialContextProvider for SerialContext [Root exception is java.lang.NullPointerException]
at com.sun.enterprise.naming.impl.SerialContext.getProvider (SerialContext.java:276)
at com.sun.enterprise.naming.impl.SerialContext.lookup (SerialContext.java:430)
... 22 more Caused by: java.lang.NullPointerException
at com.sun.enterprise.naming.impl.SerialContext.getRemoteProvider (SerialContext.java:297)
at com.sun.enterprise.naming.impl.SerialContext.getProvider (SerialContext.java:271)
... 23 more
似乎嵌入式码头无法在类路径中找到类“SerialContextProvider”。
我尝试将 gf-client.jar 和 glassfish-naming.jar 添加到类路径(除了将 glassfish v3 添加到 eclipse 中的目标运行时),但无济于事。
我什至整理了一个小样本(在这里找到:http://satansoft.de/jnditest/jnditest.tgz )包含一个简单的 EJB 项目以及一个执行查找的 GWT 项目。 该存档还包含一个小型 CLI 客户端,当在类路径中与 gf-client.jar 一起运行时,该客户端可以正常工作。
我还在官方 gwt 邮件列表上问了这个问题,但那里没有人能够帮助我。
那么:有人能够在 GWT devmode 中对 glassfish v3 执行 JNDI 查找吗?
I am trying to perform a JNDI-lookup from within the GWT devmode.
I have a local glassfishv3 running the EJBs I want to look up. If i deploy the GWT-Webapp into said glassfish everything works as expected. But if I try to look up the EJBs from within devmode I get this Exception:
javax.naming.NamingException: Lookup failed for 'myBean' in SerialContext [Root exception is javax.naming.NamingException: Unable to acquire SerialContextProvider for SerialContext [Root exception is java.lang.NullPointerException]] ... Caused by: javax.naming.NamingException: Unable to acquire SerialContextProvider for SerialContext [Root exception is java.lang.NullPointerException]
at com.sun.enterprise.naming.impl.SerialContext.getProvider (SerialContext.java:276)
at com.sun.enterprise.naming.impl.SerialContext.lookup (SerialContext.java:430)
... 22 more Caused by: java.lang.NullPointerException
at com.sun.enterprise.naming.impl.SerialContext.getRemoteProvider (SerialContext.java:297)
at com.sun.enterprise.naming.impl.SerialContext.getProvider (SerialContext.java:271)
... 23 more
It seems that the embedded jetty can't find the class "SerialContextProvider" in the classpath.
I tried adding gf-client.jar and glassfish-naming.jar to the classpath (in addition to adding glassfish v3 to the target runtimes in eclipse), but to no avail.
I even put together a small sample (found here: http://satansoft.de/jnditest/jnditest.tgz) containing a simple EJB project as well as a GWT project that performs the lookup.
The archive also contains a small CLI client that works perfectly fine when run with gf-client.jar in the classpath.
I also asked this question on the official gwt mailing list, but nobody on there was able to help me.
So: has anybody been able to perform JNDI lookups from within GWT devmode into glassfish v3?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
将 Glassfish 模块目录中的所有 jar 添加到 Eclipse GWT 项目的 war/WEB-INF/lib 目录中。
Add all jars from the Glassfish modules directory into the war/WEB-INF/lib directory of your Eclipse GWT project.
我没有检查,但我不确定 Jetty 是否会获取
gf-client.jar
清单中引用的所有 jar(请参阅 GlassFish EJB 常见问题解答 或 此先前的答案了解更多详细信息)。因此,虽然我确信这个 JAR 在使用独立客户端时运行良好(因为我对此进行了测试),但我没有尝试使用嵌入式 Jetty。因此,请尝试手动添加以下 JAR:
glassfish-naming.jar
、internal-api.jar
、javax.ejb.jar
、hk2-core.jar
、auto-depends.jar
、glassfish-api.jar
。I didn't check that but I'm not sure that Jetty will pick up all the jars that are referenced in the manifest of
gf-client.jar
(refer to the GlassFish EJB FAQ or this previous answer for more details on that). So, while I'm sure that this JAR works well when using a standalone client (because I tested this), I didn't try with an embedded Jetty.So, please try to add the following JARs manually:
glassfish-naming.jar
,internal-api.jar
,javax.ejb.jar
,hk2-core.jar
,auto-depends.jar
,glassfish-api.jar
.我不明白你的设置。要么在 Glassfish 中运行,要么在嵌入式 Jetty 中运行。如果您在 Jetty 中运行,它将无法工作,因为您在错误的服务器中运行。
我还将会话 bean 和其他 J2EE 技术与 GWT 结合使用,效果非常好。
您唯一需要做的就是不要运行 Jetty 服务器。我使用 -noserver 启动开发模式并在 Glassfish 上运行。如果设置正确,您可以使用 DevMode 并且服务器代码在 glassfish 中运行良好。部署有点困难,因为您需要确保 glassfish 服务器是最新的。
I don't understand your setup. Either you run in Glassfish or you run in the embedded Jetty. If you are running in Jetty it will not work since you are running in the wrong server.
I am also using session beans and other J2EE technology in combination with GWT and it works very well.
The only thing you need to do is to NOT run the Jetty server. I start the dev mode with -noserver and run on Glassfish. If you set this up correctly you can use DevMode and the server code is running fine in glassfish. Deployment is a bit more difficult since you need to make sure that the glassfish server is uptodate.