I use JBoss AS 4.0.3RC1 and I have two session beans with the following classes:

@Local public interface MyManager
@Stateless public class MyManagerBean implements MyManager
@Remote public interface Tester
@Stateless public class TesterBean implements Tester

The first session bean just have one business method that returns a string.
The second session bean also have one business method that calls the method on 
the first bean.

My question is: In the Tester bean, why doesn't
@PersistenceContext private static MyManager myManager;
work for me? I get the following exception:
Exception in thread "main" java.lang.RuntimeException: Failed in setting 
EntityManager on setter field: private static mytest.bean.MyManager 
mytest.bean.TesterBean.myManager

However, the following construct works:
private static MyManager myManager;
  | static
  | {
  |     try
  |     {
  |         InitialContext ctx = new InitialContext();
  |         myManager = (MyManager) ctx.lookup(MyManager.class.getName());
  |     }
  |     catch (NamingException e)
  |     {
  |         e.printStackTrace();
  |     }
  | }


Anybody knows?
/Patrik

View the original post : 
http://www.jboss.org/index.html?module=bb&op=viewtopic&p=3885085#3885085

Reply to the post : 
http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=3885085


-------------------------------------------------------
SF.Net email is sponsored by: Discover Easy Linux Migration Strategies
from IBM. Find simple to follow Roadmaps, straightforward articles,
informative Webcasts and more! Get everything you need to get up to
speed, fast. http://ads.osdn.com/?ad_id=7477&alloc_id=16492&op=click
_______________________________________________
JBoss-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/jboss-user

Reply via email to