InitialContext lContext = new InitialContext(??);

解决方案 »

  1.   

    问题解决了,原因在于用xdoclet生成的配置文件ejb-jar.jar文件中,对一个bean的配置:
          <session >
             <description><![CDATA[Session Bean Template  ATTENTION: Some of the XDoclet tags are hidden from XDoclet by adding a "--" between @ and the namespace.]]></description>
             <display-name>Bug TestSession Bean</display-name>         <ejb-name>test/TestSession</ejb-name>         <home>test.interfaces.TestSessionHome</home>
             <remote>test.interfaces.TestSession</remote>/**
    *说明:
    *原文件中,生成了local-home以及local两个元素,但是,test.interfaces.TestSessionLocalHome和test.interfaces.TestSessionLocal并没有生成.当往jboss上配置ejb时,jndi名字ejb/test/TestSession绑定类是test.interfaces.TestSessionLocalHome,
    当然就绑定不成功,运行也就是test 未绑定了!当把该两个元素隐藏,并用jar命令重新打包后,发布就成功了.
    */         <!--local-home>test.interfaces.TestSessionLocalHome</local-home>
             <local>test.interfaces.TestSessionLocal</local-->         <ejb-class>test.session.TestSessionBean</ejb-class>
             <session-type>Stateful</session-type>
             <transaction-type>Container</transaction-type>         <ejb-ref >
                <ejb-ref-name>ejb/mytest/TestEntity</ejb-ref-name>
                <ejb-ref-type>Entity</ejb-ref-type>
                <home>test.interfaces.TestEntityHome</home>
                <remote>test.interfaces.TestEntity</remote>
                <ejb-link>test/TestEntity</ejb-link>
             </ejb-ref>         <resource-ref>
                <res-ref-name>test/Mail</res-ref-name>
                <res-type>javax.mail.Session</res-type>
                <res-auth>Container</res-auth>
             </resource-ref>      </session>但是,有谁知道?xdoclet为什么要生成这两个无用的元素?该怎样配置才不会生成他们?