2013-09-30 94 views
1

我試圖構建一個struts2應用程序,但面臨很多困難。Struts 2 - 如何將WAR和JAR文件打包成EAR

經過多日的研究,我成功地構建了一個包含web.xml,struts.xml,.jsp,.java的Dynamic Web Project(strutsJSP)。接下來,我創建了一個企業應用程序項目(earProject),幷包含來自strutsJSP的war文件,earProject的部署成功。

不過,我需要從動作除了分裂JSP,所以我創建一個Java項目(strutsAction),並動了我的行動文件strutsAction,並試圖再次部署earProject但是這一次,我有以下錯誤:

01:17:16,087 INFO [org.jboss.as.server.deployment.scanner] (MSC service thread 1-4) JBAS015012: Started FileSystemDeploymentService for directory /home/pktan/jboss-as-7.1.1.Final/standalone/deployments 
01:17:16,105 INFO [org.jboss.as.server.deployment.scanner] (DeploymentScanner-threads - 1) JBAS015003: Found ear.ear in deployment directory. To trigger deployment create a file called ear.ear.dodeploy 
01:17:16,209 INFO [org.jboss.as.server.deployment] (MSC service thread 1-3) JBAS015876: Starting deployment of "ear.ear" 
01:17:16,255 INFO [org.jboss.as.server.deployment] (MSC service thread 1-3) JBAS015876: Starting deployment of "jspProject.war" 
01:17:18,372 INFO [com.opensymphony.xwork2.config.providers.XmlConfigurationProvider] (MSC service thread 1-4) Parsing configuration file [struts-default.xml] 
01:17:18,609 INFO [com.opensymphony.xwork2.config.providers.XmlConfigurationProvider] (MSC service thread 1-4) Unable to locate configuration files of the name struts-plugin.xml, skipping 
01:17:18,619 INFO [com.opensymphony.xwork2.config.providers.XmlConfigurationProvider] (MSC service thread 1-4) Parsing configuration file [struts-plugin.xml] 
01:17:18,636 INFO [com.opensymphony.xwork2.config.providers.XmlConfigurationProvider] (MSC service thread 1-4) Parsing configuration file [struts.xml] 
01:17:18,646 INFO [org.apache.struts2.config.BeanSelectionProvider] (MSC service thread 1-4) Choosing bean (struts) for class com.opensymphony.xwork2.ObjectFactory 
01:17:18,648 INFO [org.apache.struts2.config.BeanSelectionProvider] (MSC service thread 1-4) Choosing bean (struts) for class com.opensymphony.xwork2.conversion.impl.XWorkConverter 
01:17:18,652 INFO [org.apache.struts2.config.BeanSelectionProvider] (MSC service thread 1-4) Choosing bean (struts) for interface com.opensymphony.xwork2.TextProvider 
01:17:18,653 INFO [org.apache.struts2.config.BeanSelectionProvider] (MSC service thread 1-4) Choosing bean (struts) for interface com.opensymphony.xwork2.ActionProxyFactory 
01:17:18,654 INFO [org.apache.struts2.config.BeanSelectionProvider] (MSC service thread 1-4) Choosing bean (struts) for interface com.opensymphony.xwork2.conversion.ObjectTypeDeterminer 
01:17:18,660 INFO [org.apache.struts2.config.BeanSelectionProvider] (MSC service thread 1-4) Choosing bean (struts) for interface org.apache.struts2.dispatcher.mapper.ActionMapper 
01:17:18,661 INFO [org.apache.struts2.config.BeanSelectionProvider] (MSC service thread 1-4) Choosing bean (jakarta) for interface org.apache.struts2.dispatcher.multipart.MultiPartRequest 
01:17:18,663 INFO [org.apache.struts2.config.BeanSelectionProvider] (MSC service thread 1-4) Choosing bean (struts) for class org.apache.struts2.views.freemarker.FreemarkerManager 
01:17:18,665 INFO [org.apache.struts2.config.BeanSelectionProvider] (MSC service thread 1-4) Choosing bean (struts) for interface org.apache.struts2.components.UrlRenderer 
01:17:18,672 INFO [org.apache.struts2.config.BeanSelectionProvider] (MSC service thread 1-4) Choosing bean (struts) for interface com.opensymphony.xwork2.validator.ActionValidatorManager 
01:17:18,673 INFO [org.apache.struts2.config.BeanSelectionProvider] (MSC service thread 1-4) Choosing bean (struts) for interface com.opensymphony.xwork2.util.ValueStackFactory 
01:17:18,674 INFO [org.apache.struts2.config.BeanSelectionProvider] (MSC service thread 1-4) Choosing bean (struts) for interface com.opensymphony.xwork2.util.reflection.ReflectionProvider 
01:17:18,675 INFO [org.apache.struts2.config.BeanSelectionProvider] (MSC service thread 1-4) Choosing bean (struts) for interface com.opensymphony.xwork2.util.reflection.ReflectionContextFactory 
01:17:18,676 INFO [org.apache.struts2.config.BeanSelectionProvider] (MSC service thread 1-4) Choosing bean (struts) for interface com.opensymphony.xwork2.util.PatternMatcher 
01:17:18,682 INFO [org.apache.struts2.config.BeanSelectionProvider] (MSC service thread 1-4) Choosing bean (struts) for interface org.apache.struts2.dispatcher.StaticContentLoader 
01:17:18,684 INFO [org.apache.struts2.config.BeanSelectionProvider] (MSC service thread 1-4) Choosing bean (struts) for interface com.opensymphony.xwork2.UnknownHandlerManager 
01:17:18,687 INFO [org.apache.struts2.config.BeanSelectionProvider] (MSC service thread 1-4) Loading global messages from ApplicationResources 
01:17:18,945 ERROR [org.apache.struts2.dispatcher.Dispatcher] (MSC service thread 1-4) Dispatcher initialization failed: Unable to load configuration. - action - vfs:/home/pktan/jboss-as-7.1.1.Final/standalone/deployments/ear.ear/jspProject.war/WEB-INF/classes/struts.xml:15:39 
    at com.opensymphony.xwork2.config.ConfigurationManager.getConfiguration(ConfigurationManager.java:69) [xwork-core-2.3.1.2.jar:2.3.1.2] 
    at org.apache.struts2.dispatcher.Dispatcher.init_PreloadConfiguration(Dispatcher.java:390) [struts2-core-2.3.1.2.jar:2.3.1.2] 
    at org.apache.struts2.dispatcher.Dispatcher.init(Dispatcher.java:436) [struts2-core-2.3.1.2.jar:2.3.1.2] 
    at org.apache.struts2.dispatcher.ng.InitOperations.initDispatcher(InitOperations.java:69) [struts2-core-2.3.1.2.jar:2.3.1.2] 
    at org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter.init(StrutsPrepareAndExecuteFilter.java:51) [struts2-core-2.3.1.2.jar:2.3.1.2] 
    at org.apache.catalina.core.ApplicationFilterConfig.getFilter(ApplicationFilterConfig.java:447) [jbossweb-7.0.13.Final.jar:] 
    at org.apache.catalina.core.StandardContext.filterStart(StandardContext.java:3269) [jbossweb-7.0.13.Final.jar:] 
    at org.apache.catalina.core.StandardContext.start(StandardContext.java:3865) [jbossweb-7.0.13.Final.jar:] 
    at org.jboss.as.web.deployment.WebDeploymentService.start(WebDeploymentService.java:90) [jboss-as-web-7.1.1.Final.jar:7.1.1.Final] 
    at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1811) 
    at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1746) 
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110) [rt.jar:1.7.0_09-icedtea] 
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603) [rt.jar:1.7.0_09-icedtea] 
    at java.lang.Thread.run(Thread.java:722) [rt.jar:1.7.0_09-icedtea] 
Caused by: Action class [login.LoginAction] not found - action - vfs:/home/pktan/jboss-as-7.1.1.Final/standalone/deployments/ear.ear/jspProject.war/WEB-INF/classes/struts.xml:15:39 
    at com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.verifyAction(XmlConfigurationProvider.java:426) [xwork-core-2.3.1.2.jar:2.3.1.2] 
    at com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.addAction(XmlConfigurationProvider.java:370) [xwork-core-2.3.1.2.jar:2.3.1.2] 
    at com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.addPackage(XmlConfigurationProvider.java:487) [xwork-core-2.3.1.2.jar:2.3.1.2] 
    at com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.loadPackages(XmlConfigurationProvider.java:278) [xwork-core-2.3.1.2.jar:2.3.1.2] 
    at org.apache.struts2.config.StrutsXmlConfigurationProvider.loadPackages(StrutsXmlConfigurationProvider.java:112) [struts2-core-2.3.1.2.jar:2.3.1.2] 
    at com.opensymphony.xwork2.config.impl.DefaultConfiguration.reloadContainer(DefaultConfiguration.java:204) [xwork-core-2.3.1.2.jar:2.3.1.2] 
    at com.opensymphony.xwork2.config.ConfigurationManager.getConfiguration(ConfigurationManager.java:66) [xwork-core-2.3.1.2.jar:2.3.1.2] 
    ... 13 more 

01:17:18,956 ERROR [org.apache.catalina.core.ContainerBase.[jboss.web].[default-host].[/jspProject]] (MSC service thread 1-4) Exception starting filter struts2: Unable to load configuration. - action - vfs:/home/pktan/jboss-as-7.1.1.Final/standalone/deployments/ear.ear/jspProject.war/WEB-INF/classes/struts.xml:15:39 
    at org.apache.struts2.dispatcher.Dispatcher.init(Dispatcher.java:449) [struts2-core-2.3.1.2.jar:2.3.1.2] 
    at org.apache.struts2.dispatcher.ng.InitOperations.initDispatcher(InitOperations.java:69) [struts2-core-2.3.1.2.jar:2.3.1.2] 
    at org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter.init(StrutsPrepareAndExecuteFilter.java:51) [struts2-core-2.3.1.2.jar:2.3.1.2] 
    at org.apache.catalina.core.ApplicationFilterConfig.getFilter(ApplicationFilterConfig.java:447) [jbossweb-7.0.13.Final.jar:] 
    at org.apache.catalina.core.StandardContext.filterStart(StandardContext.java:3269) [jbossweb-7.0.13.Final.jar:] 
    at org.apache.catalina.core.StandardContext.start(StandardContext.java:3865) [jbossweb-7.0.13.Final.jar:] 
    at org.jboss.as.web.deployment.WebDeploymentService.start(WebDeploymentService.java:90) [jboss-as-web-7.1.1.Final.jar:7.1.1.Final] 
    at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1811) 
    at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1746) 
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110) [rt.jar:1.7.0_09-icedtea] 
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603) [rt.jar:1.7.0_09-icedtea] 
    at java.lang.Thread.run(Thread.java:722) [rt.jar:1.7.0_09-icedtea] 
Caused by: Unable to load configuration. - action - vfs:/home/pktan/jboss-as-7.1.1.Final/standalone/deployments/ear.ear/jspProject.war/WEB-INF/classes/struts.xml:15:39 
    at com.opensymphony.xwork2.config.ConfigurationManager.getConfiguration(ConfigurationManager.java:69) [xwork-core-2.3.1.2.jar:2.3.1.2] 
    at org.apache.struts2.dispatcher.Dispatcher.init_PreloadConfiguration(Dispatcher.java:390) [struts2-core-2.3.1.2.jar:2.3.1.2] 
    at org.apache.struts2.dispatcher.Dispatcher.init(Dispatcher.java:436) [struts2-core-2.3.1.2.jar:2.3.1.2] 
    ... 11 more 
Caused by: Action class [login.LoginAction] not found - action - vfs:/home/pktan/jboss-as-7.1.1.Final/standalone/deployments/ear.ear/jspProject.war/WEB-INF/classes/struts.xml:15:39 
    at com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.verifyAction(XmlConfigurationProvider.java:426) [xwork-core-2.3.1.2.jar:2.3.1.2] 
    at com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.addAction(XmlConfigurationProvider.java:370) [xwork-core-2.3.1.2.jar:2.3.1.2] 
    at com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.addPackage(XmlConfigurationProvider.java:487) [xwork-core-2.3.1.2.jar:2.3.1.2] 
    at com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.loadPackages(XmlConfigurationProvider.java:278) [xwork-core-2.3.1.2.jar:2.3.1.2] 
    at org.apache.struts2.config.StrutsXmlConfigurationProvider.loadPackages(StrutsXmlConfigurationProvider.java:112) [struts2-core-2.3.1.2.jar:2.3.1.2] 
    at com.opensymphony.xwork2.config.impl.DefaultConfiguration.reloadContainer(DefaultConfiguration.java:204) [xwork-core-2.3.1.2.jar:2.3.1.2] 
    at com.opensymphony.xwork2.config.ConfigurationManager.getConfiguration(ConfigurationManager.java:66) [xwork-core-2.3.1.2.jar:2.3.1.2] 
    ... 13 more 

01:17:18,965 ERROR [org.apache.catalina.core.StandardContext] (MSC service thread 1-4) Error filterStart 
01:17:18,965 ERROR [org.apache.catalina.core.StandardContext] (MSC service thread 1-4) Context [/jspProject] startup failed due to previous errors 
01:17:18,982 ERROR [org.jboss.msc.service.fail] (MSC service thread 1-4) MSC00001: Failed to start service jboss.web.deployment.default-host./jspProject: org.jboss.msc.service.StartException in service jboss.web.deployment.default-host./jspProject: JBAS018040: Failed to start context 
    at org.jboss.as.web.deployment.WebDeploymentService.start(WebDeploymentService.java:95) 
    at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1811) [jboss-msc-1.0.2.GA.jar:1.0.2.GA] 
    at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1746) [jboss-msc-1.0.2.GA.jar:1.0.2.GA] 
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110) [rt.jar:1.7.0_09-icedtea] 
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603) [rt.jar:1.7.0_09-icedtea] 
    at java.lang.Thread.run(Thread.java:722) [rt.jar:1.7.0_09-icedtea] 

01:17:18,987 INFO [org.jboss.as] (MSC service thread 1-3) JBAS015951: Admin console listening on http://127.0.0.1:9990 
01:17:18,988 ERROR [org.jboss.as] (MSC service thread 1-3) JBAS015875: JBoss AS 7.1.1.Final "Brontes" started (with errors) in 6347ms - Started 282 of 363 services (2 services failed or missing dependencies, 78 services are passive or on-demand) 
01:17:19,189 INFO [org.jboss.as.server] (DeploymentScanner-threads - 2) JBAS015870: Deploy of deployment "ear.ear" was rolled back with failure message {"JBAS014671: Failed services" => {"jboss.web.deployment.default-host./jspProject" => "org.jboss.msc.service.StartException in service jboss.web.deployment.default-host./jspProject: JBAS018040: Failed to start context"}} 
01:17:19,237 INFO [org.jboss.as.server.deployment] (MSC service thread 1-3) JBAS015877: Stopped deployment jspProject.war in 46ms 
01:17:19,238 INFO [org.jboss.as.server.deployment] (MSC service thread 1-3) JBAS015877: Stopped deployment ear.ear in 48ms 
01:17:19,240 INFO [org.jboss.as.controller] (DeploymentScanner-threads - 2) JBAS014774: Service status report 
JBAS014777: Services which failed to start:  service jboss.web.deployment.default-host./jspProject: org.jboss.msc.service.StartException in service jboss.web.deployment.default-host./jspProject: JBAS018040: Failed to start context 

01:17:19,242 ERROR [org.jboss.as.server.deployment.scanner] (DeploymentScanner-threads - 1) {"JBAS014653: Composite operation failed and was rolled back. Steps that failed:" => {"Operation step-2" => {"JBAS014671: Failed services" => {"jboss.web.deployment.default-host./jspProject" => "org.jboss.msc.service.StartException in service jboss.web.deployment.default-host./jspProject: JBAS018040: Failed to start context"}}}} 

我一直在掙扎數週。

回答

0

沒有理由將操作從Web模塊中分離出來,但是如果你這樣做了,那麼你應該添加依賴到你的Web模塊。修改manifest.mfclass-path

相關問題