有关第五章的部署问题

05-05-28 luo6327529
org.jboss.deployment.DeploymentInfo@f3f37282{url=file:/c:/jboss-3.2.3/server/default/deploy/cmpweb.war/}

deployer: org.jboss.web.tomcat.tc4.EmbeddedTomcatService@2d59a3

status:Deploryment FAILED reason: Error during deploy; -nested throwable:{javax.naming.NamingException:ejb-local-ref:'ejb/CustomerManager',with web.xml ejb-link:'CustomerManager' failed to resolve to an ejb with a LocalHome}

state:Failed

watch:file:c:/jboss-3.2.3/server/default/deploy/cmpweb.war/WEB-INF/web.xml

web.xml如下:

<?xml version="1.0" encoding="UTF-8"?>

<!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN" "http://java.sun.com/dtd/web-app_2_3.dtd">

<web-app>

<servlet>

<servlet-name>action</servlet-name>

<servlet-class>org.apache.struts.action.ActionServlet</servlet-class>

<init-param>

<param-name>debug</param-name>

<param-value>2</param-value>

</init-param>

<init-param>

<param-name>config</param-name>

<param-value>/WEB-INF/struts-config.xml</param-value>

</init-param>

<load-on-startup>2</load-on-startup>

</servlet>

<servlet-mapping>

<servlet-name>action</servlet-name>

<url-pattern>*.do</url-pattern>

</servlet-mapping>

<taglib>

<taglib-uri>/WEB-INF/struts-bean.tld</taglib-uri>

<taglib-location>/WEB-INF/struts-bean.tld</taglib-location>

</taglib>

<taglib>

<taglib-uri>/WEB-INF/struts-html.tld</taglib-uri>

<taglib-location>/WEB-INF/struts-html.tld</taglib-location>

</taglib>

<taglib>

<taglib-uri>/WEB-INF/struts-logic.tld</taglib-uri>

<taglib-location>/WEB-INF/struts-logic.tld</taglib-location>

</taglib>

<taglib>

<taglib-uri>/WEB-INF/struts-template.tld</taglib-uri>

<taglib-location>/WEB-INF/struts-template.tld</taglib-location>

</taglib>

<taglib>

<taglib-uri>http://java.sun.com/jstl/core</taglib-uri>

<taglib-location>/WEB-INF/c.tld</taglib-location>

</taglib>

<taglib>

<taglib-uri>http://java.sun.com/jstl/core_rt</taglib-uri>

<taglib-location>/WEB-INF/c-rt.tld</taglib-location>

</taglib>

<taglib>

<taglib-uri>http://java.sun.com/jstl/fmt</taglib-uri>

<taglib-location>/WEB-INF/fmt.tld</taglib-location>

</taglib>

<taglib>

<taglib-uri>http://java.sun.com/jstl/fmt_rt</taglib-uri>

<taglib-location>/WEB-INF/fmt-rt.tld</taglib-location>

</taglib>

<taglib>

<taglib-uri>http://java.sun.com/jstl/sql</taglib-uri>

<taglib-location>/WEB-INF/sql.tld</taglib-location>

</taglib>

<taglib>

<taglib-uri>http://java.sun.com/jstl/sql_rt</taglib-uri>

<taglib-location>/WEB-INF/sql-rt.tld</taglib-location>

</taglib>

<taglib>

<taglib-uri>http://java.sun.com/jstl/xml</taglib-uri>

<taglib-location>/WEB-INF/x.tld</taglib-location>

</taglib>

<taglib>

<taglib-uri>http://java.sun.com/jstl/xml_rt</taglib-uri>

<taglib-location>/WEB-INF/x-rt.tld</taglib-location>

</taglib>

<ejb-local-ref>

<ejb-ref-name>ejb/CustomerManager</ejb-ref-name>

<ejb-ref-type>Session</ejb-ref-type>

<local-home>com.jdon.ejb.CustomerManagerLocalHome</local-home>

<local>com.jdon.ejb.CustomerManagerLocal</local>

<ejb-link>CustomerManager</ejb-link>

</ejb-local-ref>

</web-app>

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>

<enterprise-beans>

<session>

<display-name>CustomerManager</display-name>

<ejb-name>CustomerManager</ejb-name>

<local-home>com.jdon.ejb.CustomerManagerLocalHome</local-home>

<local>com.jdon.ejb.CustomerManagerLocal</local>

<ejb-class>com.jdon.ejb.CustomerManagerBean</ejb-class>

<session-type>Stateless</session-type>

<transaction-type>Container</transaction-type>

<ejb-local-ref>

<description />

<ejb-ref-name>ejb/Customer</ejb-ref-name>

<ejb-ref-type>Entity</ejb-ref-type>

<local-home>com.jdon.ejb.CustomerHome</local-home>

<local>com.jdon.ejb.CustomerLocal</local>

<ejb-link>Customer</ejb-link>

</ejb-local-ref>

<ejb-local-ref>

<description />

<ejb-ref-name>ejb/Subscription</ejb-ref-name>

<ejb-ref-type>Entity</ejb-ref-type>

<local-home>com.jdon.ejb.SubscriptionHome</local-home>

<local>com.jdon.ejb.SubscriptionLocal</local>

<ejb-link>Subscription</ejb-link>

</ejb-local-ref>

<ejb-local-ref>

<description />

<ejb-ref-name>ejb/Address</ejb-ref-name>

<ejb-ref-type>Entity</ejb-ref-type>

<local-home>com.jdon.ejb.AddressHome</local-home>

<local>com.jdon.ejb.AddressLocal</local>

<ejb-link>Address</ejb-link>

</ejb-local-ref>

</session>

<session>

<display-name>EJBController</display-name>

<ejb-name>EJBController</ejb-name>

<local-home>com.jdon.controller.ejb.EJBControllerLocalHome</local-home>

<local>com.jdon.controller.ejb.EJBControllerLocal</local>

<ejb-class>com.jdon.controller.ejb.EJBControllerBean</ejb-class>

<session-type>Stateful</session-type>

<transaction-type>Container</transaction-type>

</session>

<entity>

<display-name>Customer</display-name>

<ejb-name>Customer</ejb-name>

<local-home>com.jdon.ejb.CustomerHome</local-home>

<local>com.jdon.ejb.CustomerLocal</local>

<ejb-class>com.jdon.ejb.CustomerBean</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>

<field-name>id</field-name>

</cmp-field>

<cmp-field>

<field-name>firstName</field-name>

</cmp-field>

<cmp-field>

<field-name>lastName</field-name>

</cmp-field>

<primkey-field>id</primkey-field>

<query>

<query-method>

<method-name>findByFN</method-name>

<method-params>

<method-param>java.lang.String</method-param>

</method-params>

</query-method>

<ejb-ql>SELECT OBJECT(s) FROM Customer AS s WHERE s.firstName=?1</ejb-ql>

</query>

<query>

<query-method>

<method-name>findByLN</method-name>

<method-params>

<method-param>java.lang.String</method-param>

</method-params>

</query-method>

<ejb-ql>SELECT OBJECT(s) FROM Customer AS s WHERE s.lastName=?1</ejb-ql>

</query>

</entity>

<entity>

<display-name>Address</display-name>

<ejb-name>Address</ejb-name>

<local-home>com.jdon.ejb.AddressHome</local-home>

<local>com.jdon.ejb.AddressLocal</local>

<ejb-class>com.jdon.ejb.AddressBean</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>Address</abstract-schema-name>

<cmp-field>

<field-name>addressID</field-name>

</cmp-field>

<cmp-field>

<field-name>street</field-name>

</cmp-field>

<cmp-field>

<field-name>city</field-name>

</cmp-field>

<cmp-field>

<field-name>zip</field-name>

</cmp-field>

<cmp-field>

<field-name>state</field-name>

</cmp-field>

<cmp-field>

<field-name>customerID</field-name>

</cmp-field>

<primkey-field>addressID</primkey-field>

</entity>

<entity>

<display-name>Subscription</display-name>

<ejb-name>Subscription</ejb-name>

<local-home>com.jdon.ejb.SubscriptionHome</local-home>

<local>com.jdon.ejb.SubscriptionLocal</local>

<ejb-class>com.jdon.ejb.SubscriptionBean</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>Subscription</abstract-schema-name>

<cmp-field>

<field-name>title</field-name>

</cmp-field>

<cmp-field>

<field-name>type</field-name>

</cmp-field>

<primkey-field>title</primkey-field>

<query>

<query-method>

<method-name>findAllSubscriptions</method-name>

<method-params />

</query-method>

<ejb-ql>SELECT OBJECT(s) FROM Subscription AS s</ejb-ql>

</query>

</entity>

</enterprise-beans>

<relationships>

<ejb-relation>

<ejb-relation-name>customer-subscription</ejb-relation-name>

<ejb-relationship-role>

<description>customer</description>

<ejb-relationship-role-name>CustomerRelationshipRole</ejb-relationship-role-name>

<multiplicity>Many</multiplicity>

<relationship-role-source>

<description>customer</description>

<ejb-name>Customer</ejb-name>

</relationship-role-source>

<cmr-field>

<description>subscription</description>

<cmr-field-name>subscription</cmr-field-name>

<cmr-field-type>java.util.Collection</cmr-field-type>

</cmr-field>

</ejb-relationship-role>

<ejb-relationship-role>

<description>subscription</description>

<ejb-relationship-role-name>SubscriptionRelationshipRole</ejb-relationship-role-name>

<multiplicity>Many</multiplicity>

<relationship-role-source>

<description>subscription</description>

<ejb-name>Subscription</ejb-name>

</relationship-role-source>

<cmr-field>

<description>customer</description>

<cmr-field-name>customer</cmr-field-name>

<cmr-field-type>java.util.Collection</cmr-field-type>

</cmr-field>

</ejb-relationship-role>

</ejb-relation>

<ejb-relation>

<ejb-relation-name>customer-address</ejb-relation-name>

<ejb-relationship-role>

<description>customer</description>

<ejb-relationship-role-name>CustomerRelationshipRole</ejb-relationship-role-name>

<multiplicity>One</multiplicity>

<relationship-role-source>

<description>customer</description>

<ejb-name>Customer</ejb-name>

</relationship-role-source>

<cmr-field>

<description>address</description>

<cmr-field-name>address</cmr-field-name>

<cmr-field-type>java.util.Collection</cmr-field-type>

</cmr-field>

</ejb-relationship-role>

<ejb-relationship-role>

<description>address</description>

<ejb-relationship-role-name>AddressRelationshipRole</ejb-relationship-role-name>

<multiplicity>Many</multiplicity>

<cascade-delete />

<relationship-role-source>

<description>address</description>

<ejb-name>Address</ejb-name>

</relationship-role-source>

</ejb-relationship-role>

</ejb-relation>

</relationships>

<assembly-descriptor>

<container-transaction>

<method>

<ejb-name>CustomerManager</ejb-name>

<method-name>*</method-name>

</method>

<trans-attribute>Required</trans-attribute>

</container-transaction>

<container-transaction>

<method>

<ejb-name>EJBController</ejb-name>

<method-name>*</method-name>

</method>

<trans-attribute>Required</trans-attribute>

</container-transaction>

<container-transaction>

<method>

<ejb-name>Customer</ejb-name>

<method-name>*</method-name>

</method>

<trans-attribute>Required</trans-attribute>

</container-transaction>

<container-transaction>

<method>

<ejb-name>Address</ejb-name>

<method-name>*</method-name>

</method>

<trans-attribute>Required</trans-attribute>

</container-transaction>

<container-transaction>

<method>

<ejb-name>Subscription</ejb-name>

<method-name>*</method-name>

</method>

<trans-attribute>Required</trans-attribute>

</container-transaction>

</assembly-descriptor>

</ejb-jar>

jboss.xml如下:

<jboss>

<enterprise-beans>

<session>

<ejb-name>CustomerManager</ejb-name>

<local-jndi-name>CustomerManager</local-jndi-name>

<ejb-local-ref>

<ejb-ref-name>ejb/Customer</ejb-ref-name>

<local-jndi-name>Customer</local-jndi-name>

</ejb-local-ref>

<ejb-local-ref>

<ejb-ref-name>ejb/Subscription</ejb-ref-name>

<local-jndi-name>Subscription</local-jndi-name>

</ejb-local-ref>

<ejb-local-ref>

<ejb-ref-name>ejb/Address</ejb-ref-name>

<local-jndi-name>Address</local-jndi-name>

</ejb-local-ref>

</session>

<session>

<ejb-name>EJBController</ejb-name>

<local-jndi-name>EJBControllerLocal</local-jndi-name>

</session>

<entity>

<ejb-name>Customer</ejb-name>

<local-jndi-name>Customer</local-jndi-name>

</entity>

<entity>

<ejb-name>Address</ejb-name>

<local-jndi-name>Address</local-jndi-name>

</entity>

<entity>

<ejb-name>Subscription</ejb-name>

<local-jndi-name>Subscription</local-jndi-name>

</entity>

</enterprise-beans>

</jboss>

跪请各位大侠赐教

1
banq
2005-05-28 16:56
关键是这一句:

status:Deploryment FAILED reason: Error during deploy; -nested throwable:{javax.naming.NamingException:ejb-local-ref:'ejb/CustomerManager',with web.xml ejb-link:'CustomerManager' failed to resolve to an ejb with a LocalHome}

在web.xml中有一个JNDI名称'ejb/CustomerManager',但是无法找到ejb/CustomerManager所指的ejb。

这属于ejb的JNDI名称引用问题,是EJB应用中最烦人的东西,如果你解决不了,就不要在程序中调用'ejb/CustomerManager 直接使用CustomerManager作为JNDI名称调用ejb

猜你喜欢