我正在尝试从Java SE(简单类)调用一个简单的无状态会话bean。
这是我的豆子
import javax.ejb.Stateless;
/**
*
* @author MMRUser
*/
@Stateless
public class CapitalBean implements CapitalBeanRemote {
public String greetingsEjb(String name) {
return "Hello " + name;
}
}
远程界面
import javax.ejb.Remote;
/**
*
* @author MMRUser
*/
@Remote
public interface CapitalBeanRemote {
public String greetingsEjb(String name);
}
从我的客户端,我使用独立的java类来使用JNDI调用会话bean,如下所示
import ejb.CapitalBeanRemote;
import javax.naming.Context;
import javax.naming.InitialContext;
import javax.naming.NamingException;
/**
*
* @author MMRUser
*/
public class CallEjbClass {
public static void main(String[] args) {
try {
Context context = new InitialContext();
CapitalBeanRemote bean = (CapitalBeanRemote)
context.lookup("java:global/CapitalApplication/CapitalBean");
context.close();
} catch (NamingException ex) {
ex.printStackTrace();
}
}
}
事情非常简单,但是当我运行这个应用程序时,我得到一个例外
avax.naming.NameNotFoundException: CapitalBean not found
我使用Glassfish 3.1.1作为我的应用程序服务器,使用Netbeans 7.0.1作为我的IDE。已经将这些jar文件添加到我的类路径中:
CapitalApplication-ejb.jar
的appserv-rt.jar中
GF-client.jar中
我还尝试了不同的JNDI命名约定,如:
java:global / CapitalApplication!ejb.CapitalBean
但似乎没有什么工作在这里。
这是完整的堆栈跟踪
run:
Nov 20, 2011 6:14:58 PM com.sun.enterprise.iiop.security.SecurityMechanismSelector postConstruct
SEVERE: IIOP1005: An exception has occured in the ejb security initialization.
org.jvnet.hk2.component.ComponentException: injection failed on org.glassfish.api.invocation.InvocationManagerImpl.invHandlers with class [Lorg.glassfish.api.invocation.ComponentInvocationHandler;
at org.jvnet.hk2.component.InjectionManager.error_injectionException(InjectionManager.java:277)
at org.jvnet.hk2.component.InjectionManager.inject(InjectionManager.java:159)
at org.jvnet.hk2.component.InjectionManager.inject(InjectionManager.java:91)
at com.sun.hk2.component.AbstractCreatorImpl.inject(AbstractCreatorImpl.java:126)
at com.sun.hk2.component.ConstructorCreator.initialize(ConstructorCreator.java:91)
at com.sun.hk2.component.AbstractCreatorImpl.get(AbstractCreatorImpl.java:82)
at com.sun.hk2.component.SingletonInhabitant.get(SingletonInhabitant.java:67)
at com.sun.hk2.component.EventPublishingInhabitant.get(EventPublishingInhabitant.java:139)
at com.sun.hk2.component.AbstractInhabitantImpl.get(AbstractInhabitantImpl.java:76)
at org.jvnet.hk2.component.Habitat.getByContract(Habitat.java:1042)
at org.jvnet.hk2.component.Habitat.getComponent(Habitat.java:777)
at com.sun.enterprise.iiop.security.SecurityMechanismSelector.postConstruct(SecurityMechanismSelector.java:166)
at com.sun.hk2.component.AbstractCreatorImpl.inject(AbstractCreatorImpl.java:131)
at com.sun.hk2.component.ConstructorCreator.initialize(ConstructorCreator.java:91)
at com.sun.hk2.component.AbstractCreatorImpl.get(AbstractCreatorImpl.java:82)
at com.sun.hk2.component.SingletonInhabitant.get(SingletonInhabitant.java:67)
at com.sun.hk2.component.EventPublishingInhabitant.get(EventPublishingInhabitant.java:139)
at com.sun.hk2.component.AbstractInhabitantImpl.get(AbstractInhabitantImpl.java:76)
at org.jvnet.hk2.component.Habitat.getBy(Habitat.java:1048)
at org.jvnet.hk2.component.Habitat.getByType(Habitat.java:1029)
at com.sun.hk2.component.InjectInjectionResolver.getComponentInjectValue(InjectInjectionResolver.java:159)
at com.sun.hk2.component.InjectInjectionResolver.getValue(InjectInjectionResolver.java:90)
at org.jvnet.hk2.component.InjectionManager.inject(InjectionManager.java:141)
at org.jvnet.hk2.component.InjectionManager.inject(InjectionManager.java:91)
at com.sun.hk2.component.AbstractCreatorImpl.inject(AbstractCreatorImpl.java:126)
at com.sun.hk2.component.ConstructorCreator.initialize(ConstructorCreator.java:91)
at com.sun.hk2.component.AbstractCreatorImpl.get(AbstractCreatorImpl.java:82)
at com.sun.hk2.component.SingletonInhabitant.get(SingletonInhabitant.java:67)
at com.sun.hk2.component.EventPublishingInhabitant.get(EventPublishingInhabitant.java:139)
at com.sun.hk2.component.AbstractInhabitantImpl.get(AbstractInhabitantImpl.java:76)
at org.jvnet.hk2.component.Habitat.getBy(Habitat.java:1048)
at org.jvnet.hk2.component.Habitat.getByType(Habitat.java:1029)
at org.jvnet.hk2.component.Habitat.getComponent(Habitat.java:779)
at com.sun.enterprise.iiop.security.Lookups._getSecurityContextUtil(Lookups.java:97)
at com.sun.enterprise.iiop.security.Lookups.getSecurityContextUtil(Lookups.java:92)
at com.sun.enterprise.iiop.security.SecClientRequestInterceptor.<init>(SecClientRequestInterceptor.java:119)
at com.sun.enterprise.security.appclient.AppclientIIOPInterceptorFactory.getClientInterceptorInstance(AppclientIIOPInterceptorFactory.java:127)
at com.sun.enterprise.security.appclient.AppclientIIOPInterceptorFactory.createClientRequestInterceptor(AppclientIIOPInterceptorFactory.java:96)
at org.glassfish.enterprise.iiop.impl.GlassFishORBInitializer.post_init(GlassFishORBInitializer.java:132)
at com.sun.corba.ee.impl.interceptors.PIHandlerImpl.postInitORBInitializers(PIHandlerImpl.java:915)
at com.sun.corba.ee.impl.interceptors.PIHandlerImpl.initialize(PIHandlerImpl.java:265)
at com.sun.corba.ee.impl.orb.ORBImpl.postInit(ORBImpl.java:643)
at com.sun.corba.ee.impl.orb.ORBImpl.set_parameters(ORBImpl.java:704)
at com.sun.corba.ee.impl.orb.ORBImpl.setParameters(ORBImpl.java:691)
at com.sun.corba.ee.spi.osgi.ORBFactory.initialize(ORBFactory.java:107)
at org.glassfish.enterprise.iiop.impl.GlassFishORBManager.initORB(GlassFishORBManager.java:581)
at org.glassfish.enterprise.iiop.impl.GlassFishORBManager.getORB(GlassFishORBManager.java:263)
at org.glassfish.enterprise.iiop.impl.GlassFishORBFactoryImpl.createORB(GlassFishORBFactoryImpl.java:93)
at org.glassfish.enterprise.iiop.api.GlassFishORBHelper.getORB(GlassFishORBHelper.java:152)
at com.sun.enterprise.naming.impl.SerialContext.getORB(SerialContext.java:365)
at com.sun.enterprise.naming.impl.SerialContext.getProviderCacheKey(SerialContext.java:372)
at com.sun.enterprise.naming.impl.SerialContext.getRemoteProvider(SerialContext.java:402)
at com.sun.enterprise.naming.impl.SerialContext.getProvider(SerialContext.java:347)
at com.sun.enterprise.naming.impl.SerialContext.lookup(SerialContext.java:504)
at com.sun.enterprise.naming.impl.SerialContext.lookup(SerialContext.java:455)
at javax.naming.InitialContext.lookup(InitialContext.java:411)
at firstjavaapp.CallEjbClass.main(CallEjbClass.java:21)
Caused by: org.jvnet.hk2.component.ComponentException: Failed to create class com.sun.enterprise.resource.pool.PoolManagerImpl
at com.sun.hk2.component.ConstructorCreator.create(ConstructorCreator.java:71)
at com.sun.hk2.component.AbstractCreatorImpl.get(AbstractCreatorImpl.java:80)
at com.sun.hk2.component.SingletonInhabitant.get(SingletonInhabitant.java:67)
at com.sun.hk2.component.EventPublishingInhabitant.get(EventPublishingInhabitant.java:139)
at com.sun.hk2.component.AbstractInhabitantImpl.get(AbstractInhabitantImpl.java:76)
at org.jvnet.hk2.component.Habitat$5.get(Habitat.java:701)
at java.util.AbstractList$Itr.next(AbstractList.java:358)
at java.util.AbstractCollection.toArray(AbstractCollection.java:188)
at com.sun.hk2.component.InjectInjectionResolver.getArrayInjectValue(InjectInjectionResolver.java:113)
at com.sun.hk2.component.InjectInjectionResolver.getValue(InjectInjectionResolver.java:81)
at org.jvnet.hk2.component.InjectionManager.inject(InjectionManager.java:141)
... 55 more
Caused by: java.lang.ClassFormatError: Absent Code attribute in method that is not native or abstract in class file javax/resource/ResourceException
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:791)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:449)
at java.net.URLClassLoader.access$100(URLClassLoader.java:71)
at java.net.URLClassLoader$1.run(URLClassLoader.java:361)
at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
at java.lang.ClassLoader.loadClass(ClassLoader.java:423)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
at java.lang.ClassLoader.loadClass(ClassLoader.java:356)
at java.lang.Class.getDeclaredConstructors0(Native Method)
at java.lang.Class.privateGetDeclaredConstructors(Class.java:2404)
at java.lang.Class.getConstructor0(Class.java:2714)
at java.lang.Class.newInstance0(Class.java:343)
at java.lang.Class.newInstance(Class.java:325)
at com.sun.hk2.component.ConstructorCreator.create(ConstructorCreator.java:65)
... 65 more
javax.naming.NamingException: Lookup failed for 'java:global/CapitalApplication/CapitalBean' in SerialContext[myEnv={java.naming.factory.initial=com.sun.enterprise.naming.impl.SerialInitContextFactory, java.naming.factory.url.pkgs=com.sun.enterprise.naming, java.naming.factory.state=com.sun.corba.ee.impl.presentation.rmi.JNDIStateFactoryImpl} [Root exception is javax.naming.NameNotFoundException: CapitalBean not found]
at com.sun.enterprise.naming.impl.SerialContext.lookup(SerialContext.java:518)
at com.sun.enterprise.naming.impl.SerialContext.lookup(SerialContext.java:455)
at javax.naming.InitialContext.lookup(InitialContext.java:411)
at firstjavaapp.CallEjbClass.main(CallEjbClass.java:21)
Caused by: javax.naming.NameNotFoundException: CapitalBean not found
at com.sun.enterprise.naming.impl.TransientContext.doLookup(TransientContext.java:248)
at com.sun.enterprise.naming.impl.TransientContext.lookup(TransientContext.java:215)
at com.sun.enterprise.naming.impl.TransientContext.lookup(TransientContext.java:219)
at com.sun.enterprise.naming.impl.TransientContext.lookup(TransientContext.java:219)
at com.sun.enterprise.naming.impl.SerialContextProviderImpl.lookup(SerialContextProviderImpl.java:77)
at com.sun.enterprise.naming.impl.RemoteSerialContextProviderImpl.lookup(RemoteSerialContextProviderImpl.java:94)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:601)
at com.sun.corba.ee.impl.presentation.rmi.ReflectiveTie.dispatchToMethod(ReflectiveTie.java:144)
at com.sun.corba.ee.impl.presentation.rmi.ReflectiveTie._invoke(ReflectiveTie.java:174)
at com.sun.corba.ee.impl.protocol.CorbaServerRequestDispatcherImpl.dispatchToServant(CorbaServerRequestDispatcherImpl.java:528)
at com.sun.corba.ee.impl.protocol.CorbaServerRequestDispatcherImpl.dispatch(CorbaServerRequestDispatcherImpl.java:199)
at com.sun.corba.ee.impl.protocol.CorbaMessageMediatorImpl.handleRequestRequest(CorbaMessageMediatorImpl.java:1624)
at com.sun.corba.ee.impl.protocol.CorbaMessageMediatorImpl.handleRequest(CorbaMessageMediatorImpl.java:1486)
at com.sun.corba.ee.impl.protocol.CorbaMessageMediatorImpl.handleInput(CorbaMessageMediatorImpl.java:990)
at com.sun.corba.ee.impl.protocol.giopmsgheaders.RequestMessage_1_2.callback(RequestMessage_1_2.java:214)
at com.sun.corba.ee.impl.protocol.CorbaMessageMediatorImpl.handleRequest(CorbaMessageMediatorImpl.java:742)
at com.sun.corba.ee.impl.protocol.CorbaMessageMediatorImpl.dispatch(CorbaMessageMediatorImpl.java:539)
at com.sun.corba.ee.impl.protocol.CorbaMessageMediatorImpl.doWork(CorbaMessageMediatorImpl.java:2324)
at com.sun.corba.ee.impl.orbutil.threadpool.ThreadPoolImpl$WorkerThread.performWork(ThreadPoolImpl.java:497)
at com.sun.corba.ee.impl.orbutil.threadpool.ThreadPoolImpl$WorkerThread.run(ThreadPoolImpl.java:540)
BUILD SUCCESSFUL (total time: 3 seconds)
更新
尝试将JNDI命名约定更改为:
java:global/CapitalApplication/CapitalApplication-ejb/CapitalBean!ejb.CapitalBeanRemote
现在我得到了一个不同的例外:
run:
Nov 20, 2011 7:08:52 PM com.sun.enterprise.iiop.security.SecurityMechanismSelector postConstruct
SEVERE: IIOP1005: An exception has occured in the ejb security initialization.
org.jvnet.hk2.component.ComponentException: injection failed on org.glassfish.api.invocation.InvocationManagerImpl.invHandlers with class [Lorg.glassfish.api.invocation.ComponentInvocationHandler;
at org.jvnet.hk2.component.InjectionManager.error_injectionException(InjectionManager.java:277)
at org.jvnet.hk2.component.InjectionManager.inject(InjectionManager.java:159)
at org.jvnet.hk2.component.InjectionManager.inject(InjectionManager.java:91)
at com.sun.hk2.component.AbstractCreatorImpl.inject(AbstractCreatorImpl.java:126)
at com.sun.hk2.component.ConstructorCreator.initialize(ConstructorCreator.java:91)
at com.sun.hk2.component.AbstractCreatorImpl.get(AbstractCreatorImpl.java:82)
at com.sun.hk2.component.SingletonInhabitant.get(SingletonInhabitant.java:67)
at com.sun.hk2.component.EventPublishingInhabitant.get(EventPublishingInhabitant.java:139)
at com.sun.hk2.component.AbstractInhabitantImpl.get(AbstractInhabitantImpl.java:76)
at org.jvnet.hk2.component.Habitat.getByContract(Habitat.java:1042)
at org.jvnet.hk2.component.Habitat.getComponent(Habitat.java:777)
at com.sun.enterprise.iiop.security.SecurityMechanismSelector.postConstruct(SecurityMechanismSelector.java:166)
at com.sun.hk2.component.AbstractCreatorImpl.inject(AbstractCreatorImpl.java:131)
at com.sun.hk2.component.ConstructorCreator.initialize(ConstructorCreator.java:91)
at com.sun.hk2.component.AbstractCreatorImpl.get(AbstractCreatorImpl.java:82)
at com.sun.hk2.component.SingletonInhabitant.get(SingletonInhabitant.java:67)
at com.sun.hk2.component.EventPublishingInhabitant.get(EventPublishingInhabitant.java:139)
at com.sun.hk2.component.AbstractInhabitantImpl.get(AbstractInhabitantImpl.java:76)
at org.jvnet.hk2.component.Habitat.getBy(Habitat.java:1048)
at org.jvnet.hk2.component.Habitat.getByType(Habitat.java:1029)
at com.sun.hk2.component.InjectInjectionResolver.getComponentInjectValue(InjectInjectionResolver.java:159)
at com.sun.hk2.component.InjectInjectionResolver.getValue(InjectInjectionResolver.java:90)
at org.jvnet.hk2.component.InjectionManager.inject(InjectionManager.java:141)
at org.jvnet.hk2.component.InjectionManager.inject(InjectionManager.java:91)
at com.sun.hk2.component.AbstractCreatorImpl.inject(AbstractCreatorImpl.java:126)
at com.sun.hk2.component.ConstructorCreator.initialize(ConstructorCreator.java:91)
at com.sun.hk2.component.AbstractCreatorImpl.get(AbstractCreatorImpl.java:82)
at com.sun.hk2.component.SingletonInhabitant.get(SingletonInhabitant.java:67)
at com.sun.hk2.component.EventPublishingInhabitant.get(EventPublishingInhabitant.java:139)
at com.sun.hk2.component.AbstractInhabitantImpl.get(AbstractInhabitantImpl.java:76)
at org.jvnet.hk2.component.Habitat.getBy(Habitat.java:1048)
at org.jvnet.hk2.component.Habitat.getByType(Habitat.java:1029)
at org.jvnet.hk2.component.Habitat.getComponent(Habitat.java:779)
at com.sun.enterprise.iiop.security.Lookups._getSecurityContextUtil(Lookups.java:97)
at com.sun.enterprise.iiop.security.Lookups.getSecurityContextUtil(Lookups.java:92)
at com.sun.enterprise.iiop.security.SecClientRequestInterceptor.<init>(SecClientRequestInterceptor.java:119)
at com.sun.enterprise.security.appclient.AppclientIIOPInterceptorFactory.getClientInterceptorInstance(AppclientIIOPInterceptorFactory.java:127)
at com.sun.enterprise.security.appclient.AppclientIIOPInterceptorFactory.createClientRequestInterceptor(AppclientIIOPInterceptorFactory.java:96)
at org.glassfish.enterprise.iiop.impl.GlassFishORBInitializer.post_init(GlassFishORBInitializer.java:132)
at com.sun.corba.ee.impl.interceptors.PIHandlerImpl.postInitORBInitializers(PIHandlerImpl.java:915)
at com.sun.corba.ee.impl.interceptors.PIHandlerImpl.initialize(PIHandlerImpl.java:265)
at com.sun.corba.ee.impl.orb.ORBImpl.postInit(ORBImpl.java:643)
at com.sun.corba.ee.impl.orb.ORBImpl.set_parameters(ORBImpl.java:704)
at com.sun.corba.ee.impl.orb.ORBImpl.setParameters(ORBImpl.java:691)
at com.sun.corba.ee.spi.osgi.ORBFactory.initialize(ORBFactory.java:107)
at org.glassfish.enterprise.iiop.impl.GlassFishORBManager.initORB(GlassFishORBManager.java:581)
at org.glassfish.enterprise.iiop.impl.GlassFishORBManager.getORB(GlassFishORBManager.java:263)
at org.glassfish.enterprise.iiop.impl.GlassFishORBFactoryImpl.createORB(GlassFishORBFactoryImpl.java:93)
at org.glassfish.enterprise.iiop.api.GlassFishORBHelper.getORB(GlassFishORBHelper.java:152)
at com.sun.enterprise.naming.impl.SerialContext.getORB(SerialContext.java:365)
at com.sun.enterprise.naming.impl.SerialContext.getProviderCacheKey(SerialContext.java:372)
at com.sun.enterprise.naming.impl.SerialContext.getRemoteProvider(SerialContext.java:402)
at com.sun.enterprise.naming.impl.SerialContext.getProvider(SerialContext.java:347)
at com.sun.enterprise.naming.impl.SerialContext.lookup(SerialContext.java:504)
at com.sun.enterprise.naming.impl.SerialContext.lookup(SerialContext.java:455)
at javax.naming.InitialContext.lookup(InitialContext.java:411)
at firstjavaapp.CallEjbClass.main(CallEjbClass.java:20)
Caused by: org.jvnet.hk2.component.ComponentException: Failed to create class com.sun.enterprise.resource.pool.PoolManagerImpl
at com.sun.hk2.component.ConstructorCreator.create(ConstructorCreator.java:71)
at com.sun.hk2.component.AbstractCreatorImpl.get(AbstractCreatorImpl.java:80)
at com.sun.hk2.component.SingletonInhabitant.get(SingletonInhabitant.java:67)
at com.sun.hk2.component.EventPublishingInhabitant.get(EventPublishingInhabitant.java:139)
at com.sun.hk2.component.AbstractInhabitantImpl.get(AbstractInhabitantImpl.java:76)
at org.jvnet.hk2.component.Habitat$5.get(Habitat.java:701)
at java.util.AbstractList$Itr.next(AbstractList.java:358)
at java.util.AbstractCollection.toArray(AbstractCollection.java:188)
at com.sun.hk2.component.InjectInjectionResolver.getArrayInjectValue(InjectInjectionResolver.java:113)
at com.sun.hk2.component.InjectInjectionResolver.getValue(InjectInjectionResolver.java:81)
at org.jvnet.hk2.component.InjectionManager.inject(InjectionManager.java:141)
... 55 more
Caused by: java.lang.ClassFormatError: Absent Code attribute in method that is not native or abstract in class file javax/resource/ResourceException
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:791)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:449)
at java.net.URLClassLoader.access$100(URLClassLoader.java:71)
at java.net.URLClassLoader$1.run(URLClassLoader.java:361)
at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
at java.lang.ClassLoader.loadClass(ClassLoader.java:423)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
at java.lang.ClassLoader.loadClass(ClassLoader.java:356)
at java.lang.Class.getDeclaredConstructors0(Native Method)
at java.lang.Class.privateGetDeclaredConstructors(Class.java:2404)
at java.lang.Class.getConstructor0(Class.java:2714)
at java.lang.Class.newInstance0(Class.java:343)
at java.lang.Class.newInstance(Class.java:325)
at com.sun.hk2.component.ConstructorCreator.create(ConstructorCreator.java:65)
... 65 more
Exception in thread "main" java.lang.ClassFormatError: Absent Code attribute in method that is not native or abstract in class file javax/ejb/RemoveException
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:791)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:449)
at java.net.URLClassLoader.access$100(URLClassLoader.java:71)
at java.net.URLClassLoader$1.run(URLClassLoader.java:361)
at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
at java.lang.ClassLoader.loadClass(ClassLoader.java:423)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
at java.lang.ClassLoader.loadClass(ClassLoader.java:356)
at java.lang.Class.getDeclaredMethods0(Native Method)
at java.lang.Class.privateGetDeclaredMethods(Class.java:2442)
at java.lang.Class.privateGetPublicMethods(Class.java:2562)
at java.lang.Class.privateGetPublicMethods(Class.java:2572)
at java.lang.Class.privateGetPublicMethods(Class.java:2572)
at java.lang.Class.getMethods(Class.java:1427)
at com.sun.corba.ee.impl.presentation.rmi.IDLTypesUtil.validateRemoteInterface(IDLTypesUtil.java:96)
at com.sun.corba.ee.impl.presentation.rmi.IDLNameTranslatorImpl.<init>(IDLNameTranslatorImpl.java:226)
at com.sun.corba.ee.impl.presentation.rmi.IDLNameTranslatorImpl.<init>(IDLNameTranslatorImpl.java:65)
at com.sun.corba.ee.impl.presentation.rmi.IDLNameTranslatorImpl$2.run(IDLNameTranslatorImpl.java:169)
at com.sun.corba.ee.impl.presentation.rmi.IDLNameTranslatorImpl$2.run(IDLNameTranslatorImpl.java:167)
at java.security.AccessController.doPrivileged(Native Method)
at com.sun.corba.ee.impl.presentation.rmi.IDLNameTranslatorImpl.get(IDLNameTranslatorImpl.java:166)
at com.sun.corba.ee.impl.presentation.rmi.PresentationManagerImpl$ClassDataImpl.<init>(PresentationManagerImpl.java:153)
at com.sun.corba.ee.impl.presentation.rmi.PresentationManagerImpl$1.lookup(PresentationManagerImpl.java:103)
at com.sun.corba.ee.impl.presentation.rmi.PresentationManagerImpl$1.lookup(PresentationManagerImpl.java:100)
at com.sun.corba.ee.spi.orbutil.misc.WeakCache.get(WeakCache.java:114)
at com.sun.corba.ee.impl.presentation.rmi.PresentationManagerImpl.getClassData(PresentationManagerImpl.java:131)
at com.sun.corba.ee.impl.presentation.rmi.StubFactoryFactoryDynamicBase.createStubFactory(StubFactoryFactoryDynamicBase.java:91)
at com.sun.corba.ee.impl.util.Utility.loadStub(Utility.java:835)
at com.sun.corba.ee.impl.javax.rmi.PortableRemoteObject.narrow(PortableRemoteObject.java:252)
at javax.rmi.PortableRemoteObject.narrow(PortableRemoteObject.java:153)
at com.sun.ejb.EJBUtils.lookupRemote30BusinessObject(EJBUtils.java:406)
at com.sun.ejb.containers.RemoteBusinessObjectFactory.getObjectInstance(RemoteBusinessObjectFactory.java:75)
at javax.naming.spi.NamingManager.getObjectInstance(NamingManager.java:321)
at com.sun.enterprise.naming.impl.SerialContext.getObjectInstance(SerialContext.java:556)
at com.sun.enterprise.naming.impl.SerialContext.lookup(SerialContext.java:514)
at com.sun.enterprise.naming.impl.SerialContext.lookup(SerialContext.java:455)
at javax.naming.InitialContext.lookup(InitialContext.java:411)
at firstjavaapp.CallEjbClass.main(CallEjbClass.java:20)
Java Result: 1
BUILD SUCCESSFUL (total time: 3 seconds)
答案 0 :(得分:6)
我遇到了同样的问题,刚刚找到solution here。
检查最后的帖子。似乎关键是类路径中JAR文件的顺序。确保在javaee-api-6.0.jar之前包含gf-client.jar。