Is it possible to access an EJB remote interface method from a GWT client module write with RPC? The gwt application is on an server with Tomcat and the EJB is deployed in a Jboss server. If is it possibile, where i can find example code?
相关问题
- Tomcat and SSL Client certificate
- Can't configure nginx as a proxy for tomcat wi
- How to run GWT in production mode
- Tomcat 8 how to remove sessionCookieName from URL
- Google Guava 15.0 Error with GWT 2.5.1?
相关文章
- Tomcat的User信息可以存储到数据库中吗?
- tomcat的server.xml支持从Oracle中获取数据吗?
- web项目,Resonse Header发生解析错误,请大牛帮忙看看究竟是哪里的问题?
- Apache+Tomcat+JK实现的集群,如果Apache挂了,是不是整个服务就挂了?
- linux环境部署jpress,创建数据库时提提示连接失败
- Intermittent “sslv3 alert handshake failure” under
- Spring NamespaceHandler issue when launching Maven
- Making a two way SSL authentication between apache
The tutorial you've provided looks fine, and though it's for a command line app, the same concept should work for an application deployed on Tomcat. What problems have you found with it?
Here you've a simpler example: let's suppose you've an EJB with this simple interface deployed on JBoss:
The code to access to the EJB remotely should be something similar to:
Things to take in mind:
A. As it's said in the tutorial, instead of hardcode the the context properties in the source code, you could define them in a jndi.properties file, something like this:
this file should be placed in the classpath, and so, in the code you'd only have to call:
this solution is prefered and more elegant (it allows you to change the values without recompiling the client)
B. Pay attention to the context.lookup("ExampleBean/remote") statement: by default JBoss assigns the JNDI of the interfaces as the name of the class Bean (the implementation) with the sufix "/remote" or "/local" depending on the kind of the interface. That's for EJB deployed directly in a jar file, in case the EJB it's placed inside an EAR it adds the name of the ear file as a prefix (for example you've your EJB-jar inside an ear called myapp.ear the name you should lookup for would be: "myapp/ExampleBean/remote"). And of course, you may have changed the JNDI name in the EJB (with anotations or using its deployment descriptors), in that case, you'll have to use these names.
C. On the other hand, you'll also need to have the JBoss client libraries, which are also listed in the tutorial, in the classpath (you could place them in the wEB-INF/lib folder of your war).
D. And finally, you'll also need the remote interface in your classpath.
I hope it helps!