可能没有配置好,我的也是jbuilder7.0+weblogic7.0,运行正常

解决方案 »

  1.   

    String homeName = (String)httpServletRequest.getParameter("jNDIHomeName");    String homeInterfaceName = (String)httpServletRequest.getParameter("ejbHome");
        Class homeInterface = null;
        if (homeInterfaceName != null) {
          try {
            homeInterface = Class.forName(homeInterfaceName);
          } catch (ClassNotFoundException ex) {
          }
        }    EJBHome home = null;
        try {
          Object homeObject = getInitialContext().lookup(homeName);
          if (homeInterface == null) {
            homeInterface = homeObject.getClass();
          }
          home = (EJBHome)PortableRemoteObject.narrow(homeObject, homeInterface);
        } catch (NamingException ex) {
        }    Method homeMethod = home.getClass().getMethod("create", new Class[]{});    EJBObject remote =  (EJBObject)homeMethod.invoke(home, new Object[]{});
        List list = null;
        if (remote instanceof ejbsample) {
          list = ((ejbsample)remote).selectData(httpServletRequest);
        }
        httpServletRequest.setAttribute("result" ,list);
      

  2.   

    private Context getInitialContext() throws NamingException {
        try {
          // Get an InitialContext
          String url = servletConfig.getInitParameter("EJBProviderURL");
          String EJBInitialContextFactory = servletConfig.getInitParameter("EJBInitialContextFactory");
          Properties h = new Properties();
          h.put(Context.INITIAL_CONTEXT_FACTORY, EJBInitialContextFactory);
          h.put(Context.PROVIDER_URL, url);
          return new InitialContext(h);
        } catch (NamingException ne) {
          throw ne;
        }
      }
      

  3.   

    再web.xml中配置<web-app>
      <context-param>
        <param-name>EJBProviderURL</param-name>
        <param-value>http://localhost:7001</param-value>
        <description>url</description>
      </context-param>
      <context-param>
        <param-name>EJBInitialContextFactory</param-name>
        <param-value>weblogic.jndi.WLInitialContextFactory</param-value>
        <description>contextFactory</description>
      </context-param>
      
      <servlet>
        <servlet-name>commonServlet</servlet-name>
        <servlet-class>examples.servlets.CommonServlet</servlet-class>
        <init-param>
          <param-name>EJBProviderURL</param-name>
          <param-value>http://localhost:7001</param-value>
        </init-param>
        <init-param>
          <param-name>EJBInitialContextFactory</param-name>
          <param-value>weblogic.jndi.WLInitialContextFactory</param-value>
        </init-param>
      </servlet>
      
      <servlet-mapping>
        <servlet-name>commonServlet</servlet-name>
        <url-pattern>/commonServlet/*</url-pattern>
      </servlet-mapping>
      
      <taglib>
        <taglib-uri>
          mytaglib
        </taglib-uri>
        <taglib-location>
          /WEB-INF/taglib/MyTaglib.tld
        </taglib-location>
      </taglib></web-app>