This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes EJB and other Java EE Technologies and the fly likes WSAD and EJB problem Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » EJB and other Java EE Technologies
Bookmark "WSAD and EJB problem" Watch "WSAD and EJB problem" New topic
Author

WSAD and EJB problem

Shreya Menon
Ranch Hand

Joined: Jul 31, 2001
Posts: 285
Hi all,
I created a sample session ejb and am trying to call an outside Java class from ejb.
I tried accessing an outside java class from servlet and it works.
Now my java file is like this
public class MyTest{
static String to = "Test";
}

In my session ejb, I wrote a method to access this class and get the value of this String.
public String getValue() throws java.rmi.RemoteException {
MyTest test = new MyTest();
String xyz = null;
xyz = MyTest.to;
return xyz;
}
Now this is the error that I am getting when I run the EJB in websphere test environment
-----------------------------------------------------------------------------
java.rmi.ServerException: RemoteException occurred in server thread; nested exception is:
com.ibm.ejs.container.UncheckedException: ; nested exception is:
java.lang.IllegalAccessError: try to access field com/test/MyTest.to from class com/test/HelloWorldSesionBean
com.ibm.ejs.container.UncheckedException: ; nested exception is:
java.lang.IllegalAccessError: try to access field com/test/MyTest.to from class com/test/HelloWorldSesionBean
-------------------------------------------------------------------------------
Any help is appreciated..
Thanks
Kyle Brown
author
Ranch Hand

Joined: Aug 10, 2001
Posts: 3892
    
    5
Make the field public.
Kyle


Kyle Brown, Author of Persistence in the Enterprise and Enterprise Java Programming with IBM Websphere, 2nd Edition
See my homepage at http://www.kyle-brown.com/ for other WebSphere information.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: WSAD and EJB problem
 
Similar Threads
NoInitialContextException EJB Client (Java main class)
NoInitialContextException EJB Client (Java main class)
Unable to get the home of ejb after certain requests
help me! stateful session bean problem
WSAD Please help