K
kexsong
Unregistered / Unconfirmed
GUEST, unregistred user!
我使用jbuilder7+jboss+mysql开发EJB,配置JBUILDER没问题,因为我在测试没EJB的WEB应用是可以的,但是有了EJB就不行了。
我开发EJB的配置是这样的:
在JBOSS的DEPLOY下的mysql-ds.xml配置如下:
<?xml version="1.0" encoding="UTF-8"?>
<datasources>
<local-tx-datasource>
<jndi-name>jdbc/iso</jndi-name>
<connection-url>jdbc:mysql://localhost:3306/iso</connection-url>
<driver-class>org.gjt.mm.mysql.Driver</driver-class>
<user-name>root</user-name>
<password></password>
</local-tx-datasource>
</datasources>
jbuilder7开发EJB的情况如下:
1、创建EJB组
2、根据Datasources创建EJB Filegroup
3、定义Local home JNDI name为ejb/Filegroup
4、在User的Resource References中增加"jdbc/iso"的Datasource
5、在jbosscmp-jdbc.xml中设置如下:
...
<defaults>
<datasource>java:/jdbc/iso</datasource>
<datasource-mapping>mySQL</datasource-mapping>
</defaults>
...
6、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>
<entity>
<display-name>Filegroup</display-name>
<ejb-name>Filegroup</ejb-name>
<local-home>com.elite.test.ejb.cmp.FilegroupHome</local-home>
<local>com.elite.test.ejb.cmp.Filegroup</local>
<ejb-class>com.elite.test.ejb.cmp.FilegroupBean</ejb-class>
<persistence-type>Container</persistence-type>
<prim-key-class>com.elite.test.ejb.cmp.FilegroupPK</prim-key-class>
<reentrant>False</reentrant>
<abstract-schema-name>Filegroup</abstract-schema-name>
<cmp-field>
<field-name>filegroupid</field-name>
</cmp-field>
<cmp-field>
<field-name>groupname</field-name>
</cmp-field>
<cmp-field>
<field-name>status</field-name>
</cmp-field>
<cmp-field>
<field-name>comment</field-name>
</cmp-field>
<resource-ref>
<description />
<res-ref-name>jdbc/iso</res-ref-name>
<res-type>javax.sql.DataSource</res-type>
<res-auth>Container</res-auth>
</resource-ref>
</entity>
</enterprise-beans>
<assembly-descriptor>
<container-transaction>
<method>
<ejb-name>Filegroup</ejb-name>
<method-name>*</method-name>
</method>
<trans-attribute>Required</trans-attribute>
</container-transaction>
</assembly-descriptor>
</ejb-jar>
7、jboss.xml如下
<jboss>
<enterprise-beans>
<entity>
<ejb-name>Filegroup</ejb-name>
<local-jndi-name>Filegroup</local-jndi-name>
<resource-ref>
<res-ref-name>jdbc/iso</res-ref-name>
<jndi-name>java:/jdbc/iso</jndi-name>
</resource-ref>
</entity>
</enterprise-beans>
</jboss>
然后deploy到jboss,出现如下错误:
9:21:18,734 WARN [ServiceController] Problem starting service jboss.j2ee:jndiN
ame=Filegroup,service=EJB
java.lang.NoSuchMethodError: org.apache.bcel.generic.InstructionFactory.createNe
wArray(Lorg/apache/bcel/generic/Type;S)Lorg/apache/bcel/generic/Instruction;
at org.jboss.proxy.compiler.ProxyImplementationFactory.createProxyMethod
(ProxyImplementationFactory.java:319)
at org.jboss.proxy.compiler.ProxyCompiler.getCode(ProxyCompiler.java:167
)
at org.jboss.proxy.compiler.Runtime.makeProxyType(Runtime.java:66)
at org.jboss.proxy.compiler.ProxyCompiler.<init>(ProxyCompiler.java:76)
at org.jboss.proxy.compiler.Proxies$Impl.newTarget(Proxies.java:603)
at org.jboss.proxy.compiler.Proxies.newTarget(Proxies.java:78)
at org.jboss.proxy.compiler.Proxy.newProxyInstance(Proxy.java:49)
at org.jboss.ejb.plugins.cmp.jdbc.JDBCCreateBeanClassInstanceCommand.<in
it>(JDBCCreateBeanClassInstanceCommand.java:62)
at org.jboss.ejb.plugins.cmp.jdbc.JDBCCommandFactory.createCreateBeanCla
ssInstanceCommand(JDBCCommandFactory.java:106)
at org.jboss.ejb.plugins.cmp.jdbc.JDBCStoreManager.startStoreManager(JDB
CStoreManager.java:424)
at org.jboss.ejb.plugins.cmp.jdbc.JDBCStoreManager.start(JDBCStoreManage
r.java:351)
at org.jboss.ejb.plugins.CMPPersistenceManager.start(CMPPersistenceManag
er.java:152)
at org.jboss.ejb.EntityContainer.startService(EntityContainer.java:343)
at org.jboss.system.ServiceMBeanSupport.start(ServiceMBeanSupport.java:1
92)
at sun.reflect.GeneratedMethodAccessor61.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
sorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:324)
at org.jboss.mx.capability.ReflectedMBeanDispatcher.invoke(ReflectedMBea
nDispatcher.java:284)
at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:546)
at org.jboss.system.ServiceController$ServiceProxy.invoke(ServiceControl
ler.java:976)
at $Proxy14.start(Unknown Source)
at org.jboss.system.ServiceController.start(ServiceController.java:394)
at sun.reflect.GeneratedMethodAccessor8.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
sorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:324)
at org.jboss.mx.capability.ReflectedMBeanDispatcher.invoke(ReflectedMBea
nDispatcher.java:284)
at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:546)
at org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:177)
at $Proxy30.start(Unknown Source)
at org.jboss.ejb.EjbModule.startService(EjbModule.java:331)
at org.jboss.system.ServiceMBeanSupport.start(ServiceMBeanSupport.java:1
92)
at sun.reflect.GeneratedMethodAccessor61.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
sorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:324)
at org.jboss.mx.capability.ReflectedMBeanDispatcher.invoke(ReflectedMBea
nDispatcher.java:284)
at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:546)
at org.jboss.system.ServiceController$ServiceProxy.invoke(ServiceControl
ler.java:976)
at $Proxy14.start(Unknown Source)
at org.jboss.system.ServiceController.start(ServiceController.java:394)
at sun.reflect.GeneratedMethodAccessor8.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
sorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:324)
at org.jboss.mx.capability.ReflectedMBeanDispatcher.invoke(ReflectedMBea
nDispatcher.java:284)
at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:546)
at org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:177)
at $Proxy12.start(Unknown Source)
at org.jboss.ejb.EJBDeployer.start(EJBDeployer.java:544)
at org.jboss.deployment.MainDeployer.start(MainDeployer.java:832)
at org.jboss.deployment.MainDeployer.start(MainDeployer.java:824)
at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:642)
at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:605)
at sun.reflect.GeneratedMethodAccessor43.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
sorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:324)
at org.jboss.mx.capability.ReflectedMBeanDispatcher.invoke(ReflectedMBea
nDispatcher.java:284)
at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:546)
at org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:177)
at $Proxy6.deploy(Unknown Source)
at org.jboss.deployment.scanner.URLDeploymentScanner.deploy(URLDeploymen
tScanner.java:302)
at org.jboss.deployment.scanner.URLDeploymentScanner.scan(URLDeploymentS
canner.java:476)
at org.jboss.deployment.scanner.AbstractDeploymentScanner$ScannerThread.
doScan(AbstractDeploymentScanner.java:201)
at org.jboss.deployment.scanner.AbstractDeploymentScanner$ScannerThread.
loop(AbstractDeploymentScanner.java:212)
at org.jboss.deployment.scanner.AbstractDeploymentScanner$ScannerThread.
run(AbstractDeploymentScanner.java:191)
而我的jboss中的jboss/server/iso/deploy下只用到mysql-ds.xml而没有standardjbosscmp-jdbc.xml,其中mysql-ds.xml如下:
<datasources>
<local-tx-datasource>
<jndi-name>jdbc/iso</jndi-name>
<connection-url>jdbc:mysql://localhost:3306/iso</connection-url>
<driver-class>org.gjt.mm.mysql.Driver</driver-class>
<user-name>root</user-name>
<password></password>
</local-tx-datasource>
</datasources>
请问这是什么原因?
我开发EJB的配置是这样的:
在JBOSS的DEPLOY下的mysql-ds.xml配置如下:
<?xml version="1.0" encoding="UTF-8"?>
<datasources>
<local-tx-datasource>
<jndi-name>jdbc/iso</jndi-name>
<connection-url>jdbc:mysql://localhost:3306/iso</connection-url>
<driver-class>org.gjt.mm.mysql.Driver</driver-class>
<user-name>root</user-name>
<password></password>
</local-tx-datasource>
</datasources>
jbuilder7开发EJB的情况如下:
1、创建EJB组
2、根据Datasources创建EJB Filegroup
3、定义Local home JNDI name为ejb/Filegroup
4、在User的Resource References中增加"jdbc/iso"的Datasource
5、在jbosscmp-jdbc.xml中设置如下:
...
<defaults>
<datasource>java:/jdbc/iso</datasource>
<datasource-mapping>mySQL</datasource-mapping>
</defaults>
...
6、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>
<entity>
<display-name>Filegroup</display-name>
<ejb-name>Filegroup</ejb-name>
<local-home>com.elite.test.ejb.cmp.FilegroupHome</local-home>
<local>com.elite.test.ejb.cmp.Filegroup</local>
<ejb-class>com.elite.test.ejb.cmp.FilegroupBean</ejb-class>
<persistence-type>Container</persistence-type>
<prim-key-class>com.elite.test.ejb.cmp.FilegroupPK</prim-key-class>
<reentrant>False</reentrant>
<abstract-schema-name>Filegroup</abstract-schema-name>
<cmp-field>
<field-name>filegroupid</field-name>
</cmp-field>
<cmp-field>
<field-name>groupname</field-name>
</cmp-field>
<cmp-field>
<field-name>status</field-name>
</cmp-field>
<cmp-field>
<field-name>comment</field-name>
</cmp-field>
<resource-ref>
<description />
<res-ref-name>jdbc/iso</res-ref-name>
<res-type>javax.sql.DataSource</res-type>
<res-auth>Container</res-auth>
</resource-ref>
</entity>
</enterprise-beans>
<assembly-descriptor>
<container-transaction>
<method>
<ejb-name>Filegroup</ejb-name>
<method-name>*</method-name>
</method>
<trans-attribute>Required</trans-attribute>
</container-transaction>
</assembly-descriptor>
</ejb-jar>
7、jboss.xml如下
<jboss>
<enterprise-beans>
<entity>
<ejb-name>Filegroup</ejb-name>
<local-jndi-name>Filegroup</local-jndi-name>
<resource-ref>
<res-ref-name>jdbc/iso</res-ref-name>
<jndi-name>java:/jdbc/iso</jndi-name>
</resource-ref>
</entity>
</enterprise-beans>
</jboss>
然后deploy到jboss,出现如下错误:
9:21:18,734 WARN [ServiceController] Problem starting service jboss.j2ee:jndiN
ame=Filegroup,service=EJB
java.lang.NoSuchMethodError: org.apache.bcel.generic.InstructionFactory.createNe
wArray(Lorg/apache/bcel/generic/Type;S)Lorg/apache/bcel/generic/Instruction;
at org.jboss.proxy.compiler.ProxyImplementationFactory.createProxyMethod
(ProxyImplementationFactory.java:319)
at org.jboss.proxy.compiler.ProxyCompiler.getCode(ProxyCompiler.java:167
)
at org.jboss.proxy.compiler.Runtime.makeProxyType(Runtime.java:66)
at org.jboss.proxy.compiler.ProxyCompiler.<init>(ProxyCompiler.java:76)
at org.jboss.proxy.compiler.Proxies$Impl.newTarget(Proxies.java:603)
at org.jboss.proxy.compiler.Proxies.newTarget(Proxies.java:78)
at org.jboss.proxy.compiler.Proxy.newProxyInstance(Proxy.java:49)
at org.jboss.ejb.plugins.cmp.jdbc.JDBCCreateBeanClassInstanceCommand.<in
it>(JDBCCreateBeanClassInstanceCommand.java:62)
at org.jboss.ejb.plugins.cmp.jdbc.JDBCCommandFactory.createCreateBeanCla
ssInstanceCommand(JDBCCommandFactory.java:106)
at org.jboss.ejb.plugins.cmp.jdbc.JDBCStoreManager.startStoreManager(JDB
CStoreManager.java:424)
at org.jboss.ejb.plugins.cmp.jdbc.JDBCStoreManager.start(JDBCStoreManage
r.java:351)
at org.jboss.ejb.plugins.CMPPersistenceManager.start(CMPPersistenceManag
er.java:152)
at org.jboss.ejb.EntityContainer.startService(EntityContainer.java:343)
at org.jboss.system.ServiceMBeanSupport.start(ServiceMBeanSupport.java:1
92)
at sun.reflect.GeneratedMethodAccessor61.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
sorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:324)
at org.jboss.mx.capability.ReflectedMBeanDispatcher.invoke(ReflectedMBea
nDispatcher.java:284)
at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:546)
at org.jboss.system.ServiceController$ServiceProxy.invoke(ServiceControl
ler.java:976)
at $Proxy14.start(Unknown Source)
at org.jboss.system.ServiceController.start(ServiceController.java:394)
at sun.reflect.GeneratedMethodAccessor8.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
sorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:324)
at org.jboss.mx.capability.ReflectedMBeanDispatcher.invoke(ReflectedMBea
nDispatcher.java:284)
at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:546)
at org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:177)
at $Proxy30.start(Unknown Source)
at org.jboss.ejb.EjbModule.startService(EjbModule.java:331)
at org.jboss.system.ServiceMBeanSupport.start(ServiceMBeanSupport.java:1
92)
at sun.reflect.GeneratedMethodAccessor61.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
sorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:324)
at org.jboss.mx.capability.ReflectedMBeanDispatcher.invoke(ReflectedMBea
nDispatcher.java:284)
at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:546)
at org.jboss.system.ServiceController$ServiceProxy.invoke(ServiceControl
ler.java:976)
at $Proxy14.start(Unknown Source)
at org.jboss.system.ServiceController.start(ServiceController.java:394)
at sun.reflect.GeneratedMethodAccessor8.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
sorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:324)
at org.jboss.mx.capability.ReflectedMBeanDispatcher.invoke(ReflectedMBea
nDispatcher.java:284)
at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:546)
at org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:177)
at $Proxy12.start(Unknown Source)
at org.jboss.ejb.EJBDeployer.start(EJBDeployer.java:544)
at org.jboss.deployment.MainDeployer.start(MainDeployer.java:832)
at org.jboss.deployment.MainDeployer.start(MainDeployer.java:824)
at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:642)
at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:605)
at sun.reflect.GeneratedMethodAccessor43.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
sorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:324)
at org.jboss.mx.capability.ReflectedMBeanDispatcher.invoke(ReflectedMBea
nDispatcher.java:284)
at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:546)
at org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:177)
at $Proxy6.deploy(Unknown Source)
at org.jboss.deployment.scanner.URLDeploymentScanner.deploy(URLDeploymen
tScanner.java:302)
at org.jboss.deployment.scanner.URLDeploymentScanner.scan(URLDeploymentS
canner.java:476)
at org.jboss.deployment.scanner.AbstractDeploymentScanner$ScannerThread.
doScan(AbstractDeploymentScanner.java:201)
at org.jboss.deployment.scanner.AbstractDeploymentScanner$ScannerThread.
loop(AbstractDeploymentScanner.java:212)
at org.jboss.deployment.scanner.AbstractDeploymentScanner$ScannerThread.
run(AbstractDeploymentScanner.java:191)
而我的jboss中的jboss/server/iso/deploy下只用到mysql-ds.xml而没有standardjbosscmp-jdbc.xml,其中mysql-ds.xml如下:
<datasources>
<local-tx-datasource>
<jndi-name>jdbc/iso</jndi-name>
<connection-url>jdbc:mysql://localhost:3306/iso</connection-url>
<driver-class>org.gjt.mm.mysql.Driver</driver-class>
<user-name>root</user-name>
<password></password>
</local-tx-datasource>
</datasources>
请问这是什么原因?