Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

WSAD and EJB problem

 
Shreya Menon
Ranch Hand
Posts: 285
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 3892
5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Make the field public.
Kyle
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic