有两个EJB,一个是SESSION,另一个是ENTITY,使用CMP2。0,在JBOSS
部署出错,EJB-JAR和JBOSS文件如下
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>Blacklist manage</display-name>
<enterprise-beans>
<session>
<ejb-name>ejb/BlacklistController</ejb-name>
<home>com.goldencoast.creditsys.ejb.blacklistmanage.BlacklistControllerHome</home>
<remote>com.goldencoast.creditsys.ejb.blacklistmanage.BlacklistController</remote>
<ejb-class>com.goldencoast.creditsys.ejb.blacklistmanage.BlacklistControllerBean</ejb-class>
<session-type>Stateless</session-type>
<transaction-type>Container</transaction-type>
<!--ejb-ref>
<ejb-ref-name>ejb-ref/Blacklist</ejb-ref-name>
<ejb-ref-type>Entity</ejb-ref-type>
<jndi-name>blacklistmanage/Blacklist</jndi-name>
</ejb-ref-->
<!--resource-ref>
<res-ref-name>jdbc/TransactDS</res-ref-name>
<res-type>javax.sql.DataSource</res-type>
<res-auth>Container</res-auth>
<jndi-name/>
<res-url/>
</resource-ref-->
</session>
<entity>
<ejb-name>ejb/Blacklist</ejb-name>
<home>com.goldencoast.creditsys.ejb.blacklistmanage.BlacklistHome</home>
<remote>com.goldencoast.creditsys.ejb.blacklistmanage.Blacklist</remote>
<ejb-class>com.goldencoast.creditsys.ejb.blacklistmanage.BlacklistBean</ejb-class>
<persistence-type>Container</persistence-type>
<prim-key-class>java.lang.String</prim-key-class>
<reentrant>False</reentrant>
<abstract-schema-name>blacklist</abstract-schema-name>
<cmp-version>2.x</cmp-version>
<cmp-field>
<field-name>recordId</field-name>
</cmp-field>
<cmp-field>
<field-name>name</field-name>
</cmp-field>
<cmp-field>
<field-name>creditId</field-name>
</cmp-field>
<cmp-field>
<field-name>driveCard</field-name>
</cmp-field>
<cmp-field>
<field-name>idCard</field-name>
</cmp-field>
<cmp-field>
<field-name>crimeRecord</field-name>
</cmp-field>
<cmp-field>
<field-name>remark</field-name>
</cmp-field>
<primkey-field>recordId</primkey-field>
<query>
<query-method>
<method-name>findByPrimaryKey</method-name>
<method-params>
<method-param>java.lang.String</method-param>
<!--method-param>java.lang.String</method-param>
<method-param>java.lang.String</method-param>
<method-param>java.lang.String</method-param>
<method-param>java.lang.String</method-param>
<method-param>java.lang.String</method-param>
<method-param>java.lang.String</method-param-->
</method-params>
</query-method>
<ejb-ql><![CDATA[select Object(b) form blacklist as b where recordId=?1]]>
</ejb-ql>
</query>
<!--resource-ref>
<res-ref-name>jdbc/TransactDS</res-ref-name>
<res-type>javax.sql.DataSource</res-type>
<res-auth>Container</res-auth>
<jndi-name/>
<res-url/>
</resource-ref-->
</entity>
</enterprise-beans>
<resource-managers>
<!--resource-manager res-class="">
<res-name>TransactDS</res-name>
<res-jndi-name>java:/TransactDS</res-jndi-name>
</resource-manager-->
</resource-managers>
<assembly-descriptor>
<container-transaction>
<description>Transaction attributes for 'ejb/Blacklist' methods</description>
<method>
<ejb-name>ejb/Blacklist</ejb-name>
<method-name>*</method-name>
</method>
<trans-attribute>Required</trans-attribute>
</container-transaction>
<container-transaction>
<description>Transaction attributes for 'ejb/BlacklistController' methods</description>
<method>
<ejb-name>ejb/BlacklistController</ejb-name>
<method-name>*</method-name>
</method>
<trans-attribute>Required</trans-attribute>
</container-transaction>
</assembly-descriptor>
</ejb-jar>
jboss.xml
<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE jboss PUBLIC
"-//JBoss//DTD JBOSS 3.0//EN"
"http://www.jboss.org/j2ee/dtd/jboss_3_0.dtd">
<jboss>
<enterprise-beans>
<entity>
<ejb-name>ejb/Blacklist</ejb-name>
<jndi-name>blacklistmanage/Blacklist</jndi-name>
<!--resource-ref>
<res-ref-name>jdbc/TransactDS</res-ref-name>
<resource-name>TransactDS</resource-name>
<jndi-name/>
<res-url/>
</resource-ref-->
</entity>
<session>
<ejb-name>ejb/BlacklistController</ejb-name>
<jndi-name>blacklistmanage/BlacklistController</jndi-name>
<!--ejb-ref>
<ejb-ref-name>ejb-ref/Blacklist</ejb-ref-name>
<jndi-name>blacklistmanage/Blacklist</jndi-name>
</ejb-ref-->
<!--resource-ref>
<res-ref-name>jdbc/TransactDS</res-ref-name>
<resource-name>TransactDS</resource-name>
<jndi-name/>
<res-url/>
</resource-ref-->
</session>
</enterprise-beans>
<resource-managers>
<!--resource-manager res-class="">
<res-name>TransactDS</res-name>
<res-jndi-name>java:/TransactDS</res-jndi-name>
</resource-manager-->
</resource-managers>
</jboss>