This content has been marked as final.
Show 6 replies
-
1. Re: Accessing method from another class
shane.bryzak May 5, 2008 11:41 AM (in response to rocco82)Can you post the code for StatelessComponent?
-
2. Re: Accessing method from another class
rocco82 May 5, 2008 11:55 AM (in response to rocco82)As you can see, there is no business logic yet, it just should print out the message. But it doesnt work. The method is declared in the interface too. I also tried to put a @AutoCreate annotation on top, but won't work either. Thanks for any help :-)
@Stateless @Name("statelessComponent") public class StatelessComponent implements IStatelessComponent { StatelessComponent() {} @Logger private Log log; /** * Do something */ public void someMethod() { log.info("a message"); } }
-
3. Re: Accessing method from another class
shane.bryzak May 5, 2008 12:08 PM (in response to rocco82)Your component name is
statelessComponent
, but you're trying to inject it asstcp
. Try this instead:@In StatelessComponent statelessComponent;
-
4. Re: Accessing method from another class
rocco82 May 5, 2008 12:27 PM (in response to rocco82)Ok I tried that.
Caused by: java.lang.IllegalArgumentException: Can not set StatelessComponent field StatefulComponent.statelessComponent to org.javassist.tmp.java.lang.Object_$$_javassist_4
I think the injected statelessComponent cannot be set into the field.
-
5. Re: Accessing method from another class
shane.bryzak May 5, 2008 12:32 PM (in response to rocco82)Ah, try declaring it as the local interface type (IStatelessComponent) instead.
-
6. Re: Accessing method from another class
rocco82 May 5, 2008 12:36 PM (in response to rocco82)Thanks very much for helping Shane :-)