一起使用EJB3和Struts 2

时间:2013-12-13 08:57:54

标签: java netbeans struts2 jboss ejb-3.0

据我所知,我们可以在JBoss下的Netbeans中使用ejb3和struts 1。

但是当我使用ejb3和struts 2时,他们在JBoss 6.1.0中部署时出错了。 我正在使用Netbeans 7.2.1 我尝试部署单独的组件,他们没关系,没有错误。 但是如果我添加模块ejb和war,它们就会出现问题。

错误:

15:48:38,023 ERROR [org.apache.struts2.dispatcher.Dispatcher] Dispatcher initialization failed: Unable to load configuration. - bean - vfs:/D:/javaKHANH/JavaKit_t.Khanh/jboss-6.1.0.Final/server/default/deploy/EJB3EntityStruts2Combine.ear/lib/struts2-convention-plugin-2.3.15.3.jar/struts-plugin.xml:32:155

Caused by: Unable to load bean: type:org.apache.struts2.convention.ActionConfigBuilder class:org.apache.struts2.convention.PackageBasedActionConfigBuilder - bean - vfs:/D:/javaKHANH/JavaKit_t.Khanh/jboss-6.1.0.Final/server/default/deploy/EJB3EntityStruts2Combine.ear/lib/struts2-convention-plugin-2.3.15.3.jar/struts-plugin.xml:32:155

Caused by: java.lang.ClassNotFoundException: org.apache.struts2.StrutsException from BaseClassLoader@162f61f{vfs:///D:/javaKHANH/JavaKit_t.Khanh/jboss-6.1.0.Final/server/default/deploy/EJB3EntityStruts2Combine.ear}

Caused by: java.lang.NoClassDefFoundError: org/apache/struts2/StrutsException
at java.lang.Class.getDeclaredConstructors0(Native Method) [:1.7.0_25]
at java.lang.Class.privateGetDeclaredConstructors(Class.java:2483) [:1.7.0_25]
at java.lang.Class.getDeclaredConstructors(Class.java:1891) [:1.7.0_25]
at com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.register(XmlConfigurationProvider.java:235) [:2.3.15.3]


15:48:38,115 ERROR [org.apache.catalina.core.StandardContext] Error filterStart
15:48:38,116 ERROR [org.apache.catalina.core.StandardContext] Context [/Struts2War] startup failed due to previous errors
15:48:38,122 ERROR [org.jboss.kernel.plugins.dependency.AbstractKernelController] Error installing to Start: name=jboss.web.deployment:war=/Struts2War state=Create mode=Manual requiredState=Installed: org.jboss.deployers.spi.DeploymentException: URL file:/D:/javaKHANH/JavaKit_t.Khanh/jboss-6.1.0.Final/server/default/tmp/vfs/automount3affa1740d934a8/Struts2War.war-667258e36d105fd7/ deployment failed

错误部署:名称 - >错误

vfs:///D:/javaKHANH/JavaKit_t.Khanh/jboss-6.1.0.Final/server/default/deploy/EJB3EntityStruts2Combine.ear -> org.jboss.deployers.spi.DeploymentException: URL file:/D:/javaKHANH/JavaKit_t.Khanh/jboss-6.1.0.Final/server/default/tmp/vfs/automount3affa1740d934a8/Struts2War.war-667258e36d105fd7/ deployment failed


DEPLOYMENTS IN ERROR:
  Deployment "vfs:///D:/javaKHANH/JavaKit_t.Khanh/jboss-6.1.0.Final/server/default/deploy/EJB3EntityStruts2Combine.ear" is in error due to the following reason(s): org.jboss.deployers.spi.DeploymentException: URL file:/D:/javaKHANH/JavaKit_t.Khanh/jboss-6.1.0.Final/server/default/tmp/vfs/automount3affa1740d934a8/Struts2War.war-667258e36d105fd7/ deployment failed

1 个答案:

答案 0 :(得分:1)

我目前在EAR中使用EJB 3.1,在JBoss EAP 6(JBss AS 7)上部署了多个Struts2 WAR。他们很棒。

如果您正在使用Maven(如果您不是,我建议您尝试一下,而不是构建您需要为下一个项目重写的复杂ANT脚本),请务必创建和部署项目正确的方式。如果您现在开始使用原型

由于您使用的是Java EE和JBoss,我建议使用jboss-javaee6-webapp Maven Archetype。

I've used it too。然后使用Struts Archetype进行战争,并将其替换为JBoss原型生成的那个,或者手动修改它。