Glassfish 无法从其他主机进行远程ejb访问

Glassfish 无法从其他主机进行远程ejb访问,glassfish,Glassfish,我们使用servlet访问部署在不同主机上的远程ejb,并获得 下面stacktrace中提到的异常 如果servlet客户端和远程ejb war部署在不同的域和同一主机上,则远程访问可以工作 如果它们部署在同一主机和同一域上,则可以正常工作 部署在两个不同主机上时不工作 查看异常“CORBA.NO_PERMISSION:vmcid:0x0次要代码:0 completed:NO”,我们认为这可能是安全问题。 但是测试ejb应用程序没有任何安全配置。已尝试将“”详细信息添加到sun-ejb-jar

我们使用servlet访问部署在不同主机上的远程ejb,并获得 下面stacktrace中提到的异常

  • 如果servlet客户端和远程ejb war部署在不同的域和同一主机上,则远程访问可以工作
  • 如果它们部署在同一主机和同一域上,则可以正常工作

  • 部署在两个不同主机上时不工作

  • 查看异常“CORBA.NO_PERMISSION:vmcid:0x0次要代码:0 completed:NO”,我们认为这可能是安全问题。 但是测试ejb应用程序没有任何安全配置。已尝试将“”详细信息添加到sun-ejb-jar.xml 并使用programmaticologinapi。我们也有同样的例外。但不确定安全配置是否正确
  • glassfish corba日志级别在部署ejb应用程序的服务器中设置为finest。然后我们得到了这个例外。” org.omg.CORBA.BAD_INV_ORDER:FINE:IOP01600015:portable interceptor中的服务上下文添加失败,因为id为15的服务上下文已存在vmcid:SUN次要代码:15已完成:否”。 下面在服务器日志中提到了完整的堆栈跟踪
  • 尝试使用Glassfish bug:中的前端后端测试用例。我们是 得到相同的异常
  • Glassfish版本:3.1构建43

    不知道我们哪里出了问题。请帮忙。谢谢

    客户端日志: 原因:javax.naming.NamingException:解析“远程Ejb ref name=TestService,远程3.x interface=com.medallion.test.service.TestService,Ejb link=null,lookup=,mappedName=,jndi name=corbaname:iiop:50.57.150.62:3700 35; TestService,refType=Session”的Ejb异常。用于查找的实际(可能是内部)远程JNDI名称是“corbaname:iiop:50.57.150.62:3700#TestService_uuu3_x_uinternal_uremotebusinesshome”[根异常为org.omg.CORBA.BAD_PARAM:FINE:IOP000100009:string_到_对象转换失败,原因是名称TestService_u3_x_Internal_RemoteBusinessHome_uVMCID:SUN次要代码:9已完成:否] 在com.sun.ejb.ejbNameReferenceManager impl.ResolveEJB引用中(ejbNameReferenceManager impl.java:178) 位于com.sun.enterprise.container.common.impl.ComponentEnvManagerImpl$EjbReferenceProxy.create(ComponentEnvManagerImpl.java:1106) 位于com.sun.enterprise.naming.impl.GlassfishNamingManagerImpl.lookup(GlassfishNamingManagerImpl.java:776) 位于com.sun.enterprise.naming.impl.GlassfishNamingManagerImpl.lookup(GlassfishNamingManagerImpl.java:744) 位于com.sun.enterprise.naming.impl.JavaURLContext.lookup(JavaURLContext.java:172) 在com.sun.enterprise.naming.impl.SerialContext.lookup(SerialContext.java:498)上 …还有38个 原因:org.omg.CORBA.BAD_参数:FINE:IOP000100009:string_到_对象转换失败,原因是名称TestService_u3_x_Internal_RemoteBusinessHome_uuuVMCID:SUN次要代码:9已完成:否 位于sun.reflect.NativeConstructorAccessorImpl.newInstance0(本机方法) 位于sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39) 在sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27) 位于java.lang.reflect.Constructor.newInstance(Constructor.java:513) 位于com.sun.corba.ee.spi.orbutil.logex.corba.CorbaExtension.makeException(CorbaExtension.java:248) 位于com.sun.corba.ee.spi.orbutil.logex.corba.CorbaExtension.makeException(CorbaExtension.java:95) 位于com.sun.corba.ee.spi.orbutil.logex.WrapperGenerator.handleFullLogging(WrapperGenerator.java:387) com.sun.corba.ee.spi.orbutil.logex.WrapperGenerator.access$400(WrapperGenerator.java:107) 位于com.sun.corba.ee.spi.orbutil.logex.WrapperGenerator$2.invoke(WrapperGenerator.java:511) 位于com.sun.corba.ee.spi.orbutil.proxy.CompositeInvocationHandlerImpl.invoke(CompositeInvocationHandlerImpl.java:99) 价格为$Proxy142.soBadSchemaSpecific(来源不明) 位于com.sun.corba.ee.impl.resolver.insureLopeOptionImpl.resolveCorbaname(insureLopeOptionImpl.java:227) 在com.sun.corba.ee.impl.resolver.insureLopeOptionImpl.resolveSureL(insureLopeOptionImpl.java:154) 位于com.sun.corba.ee.impl.resolver.insureLopeOptionImpl.operative(insureLopeOptionImpl.java:145) 在com.sun.corba.ee.impl.orb.orbempl.string_to_对象(orbempl.java:976)上 位于com.sun.ejb.ejbNameReferenceManager impl.ResolveEJB引用(ejbNameReferenceManager impl.java:171) …还有43个 原因:org.omg.CORBA.NO_权限:-------------开始服务器端堆栈跟踪---------- org.omg.CORBA.NO_权限:vmcid:0x0次要代码:0已完成:否 位于com.sun.enterprise.iiop.security.SecServerRequestInterceptor.handle\u null\u service\u上下文(SecServerRequestInterceptor.java:421) 位于com.sun.enterprise.iiop.security.SecServerRequestInterceptor.receive_request(SecServerRequestInterceptor.java:443) 在com.sun.corba.ee.impl.interceptors.InterceptorInvoker.invokeServerInterceptorIntermediatePoint(InterceptorInvoker.java:612) 位于com.sun.corba.ee.impl.interceptors.PIHandlerImpl.InvokeServerPiMediatePoint(PIHandlerImpl.java:612) 位于com.sun.corba.ee.impl.protocol.CorbaServerRequestDispatcherImpl.getServantWithPI(CorbaServerRequestDispatcherImpl.java:333) 位于com.sun.corba.ee.impl.protocol.CorbaServerRequestDispatcherImpl.dispatch(CorbaServerRequestDispatcherImpl.java:196) 位于com.sun.corba.ee.impl.protocol.CorbaMessageMediatorImpl.HandlerRequest(CorbaMessageMediatorImpl.java:1624) 位于com.sun.corba.ee.impl.protocol.CorbaMessageMediatorImpl.handleRequest(CorbaMessageMediatorImpl.java:1486) com.sun.corba.ee.impl.protocol.CorbaMessageMediatorImpl.handleInput(CorbaMessageMediatorImpl.java:990) 位于com.sun.corba.ee.impl.protocol.giopmsgheaders.RequestMessage_1_2.callback(RequestMessage_1_2.java:214) 位于com.sun.corba.ee.impl.protocol.CorbaMessageMediatorImpl.handleRequest(CorbaMessageMediatorImpl.java:742)
    @EJB(name = "TestService")
    private TestService testService;
    
    /**
     * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response)
     */
    protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
    
        PrintWriter w = response.getWriter();
    
        try {
            w.write("Test o/p: " + testService.testEJB("This is a test msg") + "\n");
    
        } catch (Exception e) {
            e.printStackTrace(w);
        }
    
    }
    
    <ejb-ref>
        <ejb-ref-name>TestService</ejb-ref-name>
        <!-- <jndi-name>corbaname:iiop:localhost:3700#TestService</jndi-name> -->
        <jndi-name>corbaname:iiop:<ip>:3700#TestService</jndi-name>
    </ejb-ref>
    
    private static final long serialVersionUID = 1L;
    private static final Logger logger = Logger.getLogger(TestServiceImpl.class.getName());
    
    @Resource EJBContext ejbContext;
    
    @Override
    public String testEJB(String testStr) {
    
        String userName = ejbContext.getCallerPrincipal().getName();
    
        System.out.println("Username: " + userName);
    
        return "Msg Recieved: " + testStr;
    
    }
    
    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE sun-ejb-jar PUBLIC "-//Sun Microsystems, Inc.//DTD Application Server 9.0 EJB 3.0//EN" "http://www.sun.com/software/appserver/dtds/sun-ejb-jar_3_0-0.dtd">
    <sun-ejb-jar>
    <enterprise-beans>
        <ejb>
            <ejb-name>TestServiceImpl</ejb-name>
            <jndi-name>TestService</jndi-name>
            <!--<ior-security-config>
                <as-context>
                    <auth-method>USERNAME_PASSWORD</auth-method>
                    <realm>database-realm</realm>
                    <required>true</required>
                </as-context>
                <sas-context>
                    <caller-propagation>supported</caller-propagation>
                </sas-context>
                <transport-config>
                    <establish-trust-in-client>supported</establish-trust-in-client>
                </transport-config>
            </ior-security-config>-->
        </ejb>
    </enterprise-beans>
    <security-role-mapping>
    </security-role-mapping>
      </sun-ejb-jar>