Properties properties = null;
    try {
      properties = new Properties();
      properties.setProperty("java.naming.factory.initial",
                             "org.jnp.interfaces.NamingContextFactory");
      properties.setProperty("java.naming.provider.url",
                             "jnp://" +engineHostLocation + ":1099");
      System.out.println("RSMessageSenderBean========queueHostLocation:"
                         + engineHostLocation);
      properties.setProperty("java.naming.factory.url.pkgs",
                             "org.jnp.interfaces.NamingContextFactory");
      InitialContext ctx = new InitialContext(properties);      Object obj = ctx.lookup(rsMessageSenderJNDI);
      rsmsHome = (RSMessageSenderHome)PortableRemoteObject.narrow(obj,
                                            RSMessageSenderHome.class);      obj = ctx.lookup(driverManagerJNDI);
      dmHome = (DriverManagerHome) PortableRemoteObject.narrow(obj,
                                            DriverManagerHome.class);      obj = ctx.lookup(authenticateCenterJNDI);
      acHome = (AuthenticateCenterHome)PortableRemoteObject.narrow(obj,
                                            AuthenticateCenterHome.class);
    }catch (Exception e) {

解决方案 »

  1.   

    不能用JNP协议,WEBLOGIC是不支持该协议的,只能用JNDI,而且要保证两个应用服务器是运行于同一个JVM中,否则也无能为力
      

  2.   

    可以,需要用JNDI。不需要同一JVM,否则怎么实现分布式啊。jdk的版本要一致,或调用方比提供方高。否则可能出现一些奇怪的后果
      

  3.   

    用jnp还是t3协议,客户端需要包含jboss的哪些包,需要包含EJB模块的哪些类(remotehome,remote)
      

  4.   

    t3是weblogic特有的,jboss不认吧
      

  5.   

    windows2000+jbuilderx+weblogic 8.1+jboss-3.0.4_tomcat-4.0.6测试通过了,老兄说话可算数否^0^jsp代码如下:
    <%@ page contentType="text/html; charset=GBK" %>
    <html>
    <head>
    <title>
    jsp2
    </title>
    </head>
    <body bgcolor="#ffffff">
    <h1>
    JBuilder Generated JSP
    <br />
    <%    Hashtable environment = new Hashtable();
        environment.put(javax.naming.Context.INITIAL_CONTEXT_FACTORY, "org.jnp.interfaces.NamingContextFactory");
        environment.put(javax.naming.Context.URL_PKG_PREFIXES, "org.jboss.naming:org.jnp.interfaces");
        environment.put(javax.naming.Context.PROVIDER_URL, "jnp://localhost:1099");
        javax.naming.Context ctx=new javax.naming.InitialContext(environment);
        untitled9.JBossWeblogicHome h=(untitled9.JBossWeblogicHome) ctx.lookup("JBossWeblogic");
        untitled9.JBossWeblogic l=h.create();
        out.println( l.TestCall());
    %>
    </h1>
    </body>
    </html>//访问结果
    http://lym:7001/WebModule2/jsp2.jsp  显示内容:
    JBuilder Generated JSP 
    this is the test call 
      

  6.   

    package untitled9;import javax.ejb.SessionBean;
    import javax.ejb.SessionContext;
    import javax.ejb.CreateException;public class JBossWeblogicBean
        implements SessionBean {
      SessionContext sessionContext;
      public void ejbCreate() throws CreateException {
      }  public void ejbRemove() {
      }  public void ejbActivate() {
      }  public void ejbPassivate() {
      }  public void setSessionContext(SessionContext sessionContext) {
        this.sessionContext = sessionContext;
      }  public String TestCall() {
        return "this is the test call";
      }
    }
      

  7.   

    jboss client下的库:
    jboss-j2ee.jar
    jboss-common-client.jar
    jbossall-client.jar
    jmx-rmi-connector-client.jar
    jnp-client.jar
    log4j.jar
    版本不一样,可能略有不同,我上面的版本配置有这几个就够了。千万别一古脑全加进去。否则出现问题后删除非常困难,搞不清楚哪里有残留。