这个异常是在测试EJB的时候,程序执行到ctx.lookup("testEJB")时抛出的。由NamingException捕捉到。打印出栈轨迹是
javax.naming.NameNotFoundException: Unable to resolve 'TestEJB'. Resolved ''; remaining name 'TestEJB'
 at weblogic.jndi.internal.BasicNamingNode.newNameNotFoundException(BasicNamingNode.java:1123)
 at weblogic.jndi.internal.BasicNamingNode.lookupHere(BasicNamingNode.java:250)
 at weblogic.jndi.internal.ServerNamingNode.lookupHere(ServerNamingNode.java:171)
 at weblogic.jndi.internal.BasicNamingNode.lookup(BasicNamingNode.java:204)
 at weblogic.jndi.internal.WLEventContextImpl.lookup(WLEventContextImpl.java:267)
 at weblogic.jndi.internal.WLContextImpl.lookup(WLContextImpl.java:362)
 at javax.naming.InitialContext.lookup(InitialContext.java:351)
 at testejb.servlet.SrvEJB.init(SrvEJB.java:26)
 at javax.servlet.GenericServlet.init(GenericServlet.java:256)
 at weblogic.servlet.internal.StubSecurityHelper$ServletInitAction.run(StubSecurityHelper.java:265)
 at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321)
 at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:121)
 at weblogic.servlet.internal.StubSecurityHelper.createServlet(StubSecurityHelper.java:61)
 at weblogic.servlet.internal.StubLifecycleHelper.createOneInstance(StubLifecycleHelper.java:58)
 at weblogic.servlet.internal.StubLifecycleHelper.<init>(StubLifecycleHelper.java:48)
 at weblogic.servlet.internal.ServletStubImpl.prepareServlet(ServletStubImpl.java:502)
 at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:224)
 at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:165)
 at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(WebAppServletContext.java:3022)
 at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321)
 at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:121)
 at weblogic.servlet.internal.WebAppServletContext.securedExecute(WebAppServletContext.java:1925)
 at weblogic.servlet.internal.WebAppServletContext.execute(WebAppServletContext.java:1848)
 at weblogic.servlet.internal.ServletRequestImpl.run(ServletRequestImpl.java:1288)
 at weblogic.work.ExecuteThread.execute(ExecuteThread.java:207)
 at weblogic.work.ExecuteThread.run(ExecuteThread.java:179)
我的ejb-jar.xml文件描述如下:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE ejb-jar PUBLIC "-//Sun Microsystems, Inc.//DTD Enterprise JavaBeans 2.0//EN" "http://java.sun.com/dtd/ejb-jar_2_0.dtd">

<ejb-jar>
  <display-name>EJB</display-name>
  <enterprise-beans>
    <session>
      <ejb-name>TestEJB</ejb-name>
      <home>testejb.ejb.TestEJBHome</home>
      <remote>testejb.ejb.TestEJBRemote</remote>
      <ejb-class>testejb.ejb.TestEJBBean</ejb-class>
      <session-type>Stateless</session-type>
      <transaction-type>Container</transaction-type>
    </session>
  </enterprise-beans>
  <assembly-descriptor>
    <container-transaction>
      <method>
        <ejb-name>TestEJB</ejb-name>
        <method-name>*</method-name>
      </method>
      <trans-attribute>Required</trans-attribute>
    </container-transaction>
  </assembly-descriptor>
</ejb-jar>

weblogic-ejb-jar.xml文件描述如下:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE weblogic-ejb-jar PUBLIC "-//BEA Systems, Inc.//DTD WebLogic 8.1.0 EJB//EN" "http://www.bea.com/servers/wls810/dtd/weblogic-ejb-jar.dtd">

<weblogic-ejb-jar>
  <weblogic-enterprise-bean>
    <ejb-name>TestEJB</ejb-name>
    <jndi-name>TestEJB</jndi-name>
  </weblogic-enterprise-bean>
</weblogic-ejb-jar>
这些配置我都写了为什么还有名字没有找到的异常呢?
请大家帮忙看看。谢谢! QQ:86322591。MSN:rodney_luo@163.com

posted on 2006-02-20 17:24 rodney 阅读(13761) 评论(2)  编辑  收藏 所属分类: 初学JAVA工作中遇到的问题与解决方式
Comments
  • # re: javax.naming.NameNotFoundException: Unable to resolve 'TestEJB'. Resolved ''; remaining name 'TestEJB'异常
    freeve
    Posted @ 2007-09-13 14:58
    关注 同样的问题!  回复  更多评论   
  • # re: javax.naming.NameNotFoundException: Unable to resolve 'TestEJB'. Resolved ''; remaining name 'TestEJB'异常
    荣婵娟
    Posted @ 2009-10-28 16:56
    你看看有没有布署EJB
    重新布署一下  回复  更多评论   

只有注册用户登录后才能发表评论。


网站导航: