Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 01-31-2009, 01:11 PM
Member
 
Join Date: Jan 2009
Location: Taiwan
Posts: 4
Rep Power: 0
kiyoharatakuya is on a distinguished road
Send a message via MSN to kiyoharatakuya
Unhappy Access Remote Session Bean from an separate web app
Hello Everyone!

I'm new here, and this is my first post, hope i get some help ..

I build a Remote EJB Session Bean :

@Stateless
public class MyEJB implements MyEJBRemote
{
public void sayHello(){ //implement ...
System.out.println("HELLO");
}
}

I deploy it on GlassFish 2 and want to access it from a servlet in an separate web application on another server.


the servlet looks like this...:
public class MyServlet extends HttpServlet
{
@EJB
MyEJBRemote bean;

public void doGet(HttpServletRequest request,
HttpServletResponse response)
throws ServletException, IOException
{
bean.sayHello();
}
}

and I deploy on tomcat server.

then I access the servlet, but the exception has thrown:

嚴重的: Allocate exception for servlet CallRemoteEJB
java.lang.IllegalAccessException: Class org.apache.catalina.core.StandardWrapper can not access a member of class com.kiyo.ejb.web.servlet.MyServlet with modifiers ""
at sun.reflect.Reflection.ensureMemberAccess(Reflecti on.java:65)
at java.lang.Class.newInstance0(Class.java:349)
at java.lang.Class.newInstance(Class.java:308)
at org.apache.catalina.core.StandardWrapper.loadServl et(StandardWrapper.java:1104)
at org.apache.catalina.core.StandardWrapper.allocate( StandardWrapper.java:806)
at org.apache.catalina.core.StandardWrapperValve.invo ke(StandardWrapperValve.java:129)
at org.apache.catalina.core.StandardContextValve.invo ke(StandardContextValve.java:175)
at org.apache.catalina.core.StandardHostValve.invoke( StandardHostValve.java:128)
at org.apache.catalina.valves.ErrorReportValve.invoke (ErrorReportValve.java:104)
at org.apache.catalina.core.StandardEngineValve.invok e(StandardEngineValve.java:109)
at org.apache.catalina.connector.CoyoteAdapter.servic e(CoyoteAdapter.java:261)
at org.apache.coyote.http11.Http11Processor.process(H ttp11Processor.java:844)
at org.apache.coyote.http11.Http11Protocol$Http11Conn ectionHandler.process(Http11Protocol.java:581)
at org.apache.tomcat.util.net.JIoEndpoint$Worker.run( JIoEndpoint.java:447)
at java.lang.Thread.run(Thread.java:619)


It seems that there need some properties to specify the address of the server where the Session Bean is on, and I searched and found nothing but using InitialContext.lookup.

Can I access the remote Session Bean just using Annotation @EJB ?

Thanks very much
Bookmark Post in Technorati
Reply With Quote
  #2 (permalink)  
Old 02-05-2009, 06:05 AM
Member
 
Join Date: Jan 2009
Location: Taiwan
Posts: 4
Rep Power: 0
kiyoharatakuya is on a distinguished road
Send a message via MSN to kiyoharatakuya
Default
Problem Resolved.
Bookmark Post in Technorati
Reply With Quote
  #3 (permalink)  
Old 02-05-2009, 06:14 AM
Member
 
Join Date: Jan 2009
Location: Taiwan
Posts: 4
Rep Power: 0
kiyoharatakuya is on a distinguished road
Send a message via MSN to kiyoharatakuya
Default
add
%GLASSFISH_HOME%/lib/appsrv-rt.jar
%GLASSFISH_HOME%/lib/appsrv-deployment-client.jar
%GLASSFISH_HOME%/lib/appsrv-ext.jar
%GLASSFISH_HOME%/lib/appsrv-admin.jar
%GLASSFISH_HOME%/lib/appsrv-launch.jar
In /WEB-INF/lib and copy
%GLASSFISH_HOME%/lib/javaee.jar
into /TOMCAT_HOME/lib

then call the servlet again, it works!
Bookmark Post in Technorati
Reply With Quote
  #4 (permalink)  
Old 02-05-2009, 06:33 AM
Member
 
Join Date: Jan 2009
Location: Taiwan
Posts: 4
Rep Power: 0
kiyoharatakuya is on a distinguished road
Send a message via MSN to kiyoharatakuya
Default
But instead of using Dependency Injection, I tried and success using InitialContext
Bookmark Post in Technorati
Reply With Quote
  #5 (permalink)  
Old 04-24-2009, 04:46 PM
Member
 
Join Date: Apr 2009
Posts: 1
Rep Power: 0
Caio Isikawa is on a distinguished road
Default
Hi kiyoharatakuya, I'm trying to do the same thing you did. Could you post your code using InitialContext ?

Thanks.
Bookmark Post in Technorati
Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
remote access Omarero NetBeans 1 11-03-2008 08:36 AM
How to get Mouse and keboard events via HTTP for remote access shahzadcreative Networking 1 10-24-2008 05:00 AM
UREGENT-accessing session bean ok but entity bean parimal Enterprise JavaBeans 1 08-28-2008 02:34 PM
remote file access problem kib_tse New To Java 2 08-14-2008 07:04 PM
Remote interface for entity bean Java Tip Java Tips 0 12-28-2007 11:40 AM


All times are GMT +2. The time now is 07:32 AM.



VBulletin, Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2009, Crawlability, Inc.
Copyright ©2006 - 2007, www.java-forums.org