Suppose that you are trying to access remote ejb reference from OpenEJB container, not from the java:comp directory, as GBean is not managed bean, IIRC.
Since the stacktrace shows that OpenEJB related classes could not be loaded from the context classloader, have you tried to add the openejb plugin dependency in your deployment plan ?

在 2011年11月26日 下午9:12,changchang198009 <changchang198009@126.com>写道:
env: win7  64bit   jdk 1.6.29 , geronimo-3 beta1

How to access  ejb in Gbean 's methord???

I have a ejb and i can access it in web and console app;

When I access the ejb in a  GBean, use the following code(the same in console app code)

"

ClassLoader cl = Thread.currentThread().getContextClassLoader(); 
   cl.loadClass("org.apache.openejb.client.EJBObjectProxy"); 

 remoteBusinessIntf = (I4Provider)context.lookup("CodeProviderTestRemote");    //SimpleServerGBean.java:121 line.. 
"

then printStackTrace:
####################
java.lang.IllegalArgumentException: interface org.apache.openejb.client.EJBObjectProxy is not visible from class loader
 at java.lang.reflect.Proxy.getProxyClass(Proxy.java:353)
 at java.lang.reflect.Proxy.newProxyInstance(Proxy.java:581)
 at org.apache.openejb.client.proxy.Jdk13ProxyFactory.newProxyInstance(Jdk13ProxyFactory.java:118)
 at org.apache.openejb.client.proxy.ProxyManager.newProxyInstance(ProxyManager.java:107)
 at org.apache.openejb.client.EJBObjectHandler.createEJBObjectProxy(EJBObjectHandler.java:134)
 at org.apache.openejb.client.JNDIContext.createBusinessObject(JNDIContext.java:193)
 at org.apache.openejb.client.JNDIContext.lookup(JNDIContext.java:234)
 at org.apache.aries.jndi.DelegateContext.lookup(DelegateContext.java:161)
 at javax.naming.InitialContext.lookup(InitialContext.java:392)
 at zzsczz.sample.SimpleServerGBean.doStart(SimpleServerGBean.java:121)
 at org.apache.geronimo.gbean.runtime .GBeanInstance.createInstance(GBeanInstance.java:1000)
 at org.apache.geronimo.gbean.runtime.GBeanInstanceState.attemptFullStart(GBeanInstanceState.java:271)
 at org.apache.geronimo.gbean.runtime.GBeanInstanceState.start(GBeanInstanceState.java:105)
 at org.apache.geronimo.gbean.runtime.GBeanInstanceState.startRecursive(GBeanInstanceState.java:127)
 at org.apache.geronimo.gbean.runtime.GBeanInstance.startRecursive(GBeanInstance.java:569)
 at org.apache.geronimo.kernel.basic.BasicKernel.startRecursiveGBean(BasicKernel.java:386)
 at org.apache.geronimo.kernel.config.ConfigurationUtil.startConfigurationGBeans(ConfigurationUtil.java:462)
 at org.apache.geronimo.kernel.config.KernelConfigurationManager.start(KernelConfigurationManager.java:226)
 at org.apache.geronimo.kernel.config.SimpleConfigurationManager.startConfiguration(SimpleConfigurationManager.java:702 )
 at org.apache.geronimo.kernel.config.SimpleConfigurationManager.startConfiguration(SimpleConfigurationManager.java:681)
 at org.apache.geronimo.deployment.plugin.local.StartCommand.run(StartCommand.java:67)
 at java.lang.Thread.run(Thread.java:662)
##############################

any ideas??





--
Ivan