在JB2005下开发BMP实体BEAN,用WebLogic 8.X服务器,SQL Server200数据库,
那位高人指导一下小妹,这是怎么回事,
javax.ejb.CreateException: java.lang.NullPointerException at weblogic.rjvm.BasicOutboundRequest.sendReceive(BasicOutboundRequest.java:108) at weblogic.rmi.cluster.ReplicaAwareRemoteRef.invoke(ReplicaAwareRemoteRef.java:284) at weblogic.rmi.cluster.ReplicaAwareRemoteRef.invoke(ReplicaAwareRemoteRef.java:244) at empbmpapp.Employee_az16cs_HomeImpl_812_WLStub.create(Unknown Source) at empbmpapp.EmployeeTestClient1.main(EmployeeTestClient1.java:356)Caused by: javax.ejb.CreateException: java.lang.NullPointerException at empbmpapp.EmployeeBean.ejbCreate(EmployeeBean.java:107) at empbmpapp.Employee_az16cs_Impl.ejbCreate(Employee_az16cs_Impl.java:235) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:324) at weblogic.ejb20.manager.DBManager.create(DBManager.java:1121) at weblogic.ejb20.manager.DBManager.remoteCreate(DBManager.java:1091) at weblogic.ejb20.internal.EntityEJBHome.create(EntityEJBHome.java:247) at empbmpapp.Employee_az16cs_HomeImpl.create(Employee_az16cs_HomeImpl.java:98) at empbmpapp.Employee_az16cs_HomeImpl_WLSkel.invoke(Unknown Source) at weblogic.rmi.internal.BasicServerRef.invoke(BasicServerRef.java:477) at weblogic.rmi.cluster.ReplicaAwareServerRef.invoke(ReplicaAwareServerRef.java:108) at weblogic.rmi.internal.BasicServerRef$1.run(BasicServerRef.java:420) at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:353) at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:144) at weblogic.rmi.internal.BasicServerRef.handleRequest(BasicServerRef.java:415) at weblogic.rmi.internal.BasicExecuteRequest.execute(BasicExecuteRequest.java:30) at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:197) at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:170)

解决方案 »

  1.   

     weblogic配置sql数据连接池http://download.csdn.net/source/479958 在jbuilder中开发ejb讲解http://download.csdn.net/source/479882 
      

  2.   

    我用同样的weblogic配置sql数据连接池,做的CMP就没有问题,不知道为什么到了BMP就出了这个问题
      

  3.   

    感觉问题代码是这段:public Connection getConnection() throws Exception {
        try {
          Context ctx = new InitialContext();
          javax.sql.DataSource ds = (javax.sql.DataSource) ctx.lookup("DataSource");
          return ds.getConnection();
        }  catch (Exception e) {
          System.out.println("不能获取数据源");
          e.printStackTrace();
          return null;
        }
      }