Hi everybody.
I have a very intersting problem.
I used @Resource to inject a SLSB in ACC,like this:
===============================================================
public class Main {
@Resource(mappedName="hello")
static HelloWorldRemote helloWorld;//SLSB
@Resource(name="hello")
static String hello;
public static void main(String[] args) {
System.out.println(helloWorld.hello());
System.out.println(hello);
}
}
=============================================================
When I run the ACC, I get the right result but with some
Exception,like this:
=============================================================
2009/01/14 14:25:45
com.sun.enterprise.naming.NamingManagerImpl bindObjects
ÖÂÃüµÄ: NAM0006: JMS Destination object not found: hello
2009/01/14 14:25:45
com.sun.enterprise.naming.NamingManagerImpl bindObjects
ÖÂÃüµÄ: javax.naming.NamingException
javax.naming.NamingException: ejb ref resolution error for
remote business interfaceejb.HelloWorldRemote [Root
exception is java.lang.ClassNotFoundException:
ejb.HelloWorldRemote]
at
com.sun.ejb.EJBUtils.lookupRemote30BusinessObject(EJBUtils.java:425)
at
com.sun.ejb.containers.RemoteBusinessObjectFactory.getObjectInstance(RemoteBusinessObjectFactory.java:74)
at
javax.naming.spi.NamingManager.getObjectInstance(NamingManager.java:304)
at
com.sun.enterprise.naming.SerialContext.lookup(SerialContext.java:403)
at
javax.naming.InitialContext.lookup(InitialContext.java:392)
at
com.sun.enterprise.naming.NamingManagerImpl.bindObjects(NamingManagerImpl.java:391)
at
com.sun.enterprise.appclient.AppContainer.preInvoke(AppContainer.java:146)
at
com.sun.enterprise.appclient.MainWithModuleSupport.<init>(MainWithModuleSupport.java:383)
at
com.sun.enterprise.appclient.MainWithModuleSupport.<init>(MainWithModuleSupport.java:259)
at com.sun.enterprise.appclient.Main.main(Main.java:200)
Caused by: java.lang.ClassNotFoundException:
ejb.HelloWorldRemote
at
java.net.URLClassLoader$1.run(URLClassLoader.java:200)
at
java.security.AccessController.doPrivileged(Native Method)
at
java.net.URLClassLoader.findClass(URLClassLoader.java:188)
at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
at
sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
at java.lang.ClassLoader.loadClass(ClassLoader.java:252)
at
com.sun.ejb.EJBUtils.getBusinessIntfClassLoader(EJBUtils.java:679)
at
com.sun.ejb.EJBUtils.lookupRemote30BusinessObject(EJBUtils.java:348)
... 9 more
helloworld
hello
===========================================================
As I know ,_at_Resource can't be used to inject SLSB.
The behavior of GlassFish V2 is correct?
Any idea ?
Thank you...