servlet中的访问代码:
customerHome = (CustomerLocalHome)context.lookup
( "CustomerLocal ");
抛出javax.naming.NameNotFoundException:CustomerLocal not bound .问题有两天都还没解决!
web.xml:
<ejb-local-ref>
<ejb-ref-name> CustomerLocal </ejb-ref-name>
<ejb-ref-type> Entity </ejb-ref-type>
<local-home> libman.CustomerLocalHome </local-home>
<local> libman.CustomerLocal </local>
</ejb-local-ref>
jboss-web.xml:
<ejb-local-ref>
<ejb-ref-name> CustomerLocal </ejb-ref-name>
<local-jndi-name> CustomerLocal </local-jndi-name>
</ejb-local-ref>
jobss.xml:
<entity>
<ejb-name> Customer </ejb-name>
<local-jndi-name> CustomerLocal </local-jndi-name>
<method-attributes>
</method-attributes>
</entity>
ejb-jar.xml:
<entity >
<description> <![CDATA[Customer details EJB.]]> </description>
<ejb-name> Customer </ejb-name>
<local-home> libman.CustomerLocalHome </local-home>
<local> libman.CustomerLocal </local>
<ejb-class> libman.CustomerCMP </ejb-class>
<persistence-type> Container </persistence-type>
<prim-key-class> java.lang.String </prim-key-class>
<reentrant> false </reentrant>
<cmp-version> 2.x </cmp-version>
<abstract-schema-name> Customer </abstract-schema-name>
<cmp-field >
<description> <![CDATA[Gets the Customer 's ID number.]]> </description>
<field-name> custID </field-name>
</cmp-field>
<cmp-field >
<description> <![CDATA[Gets the customer 's name.]]> </description>
<field-name> custName </field-name>
</cmp-field>
<primkey-field> custID </primkey-field>
</entity>
------解决方法--------------------------------------------------------
找不到CustomerLocal,没看出什么毛病,建议你把 <ejb-ref-name> CustomerLocal </ejb-ref-name>
<local-jndi-name> CustomerLocal </local-jndi-name> 这里个中的一个改成别的名字试试
------解决方法--------------------------------------------------------
WEB配置和EJB的配置不是同一个应用,只能使用远程调用,所以要用REMOTE方式