示例Struts-2应用程序部署

时间:2012-02-28 06:57:44

标签: ant jboss jar struts2 build-process

我在J-Boss 4.2中部署它时遇到部署错误, 我正在使用Eclipse,集成了JBOSS 4.2,已添加,

我为我的应用程序添加了build.properties和build.xml(ANT BUILD),

我想我没有添加足够的jar用于部署。 或者我没有正确配置Jboss 4.2到我的IDE。 请检查错误,让我知道我没有添加什么,或者我没有做什么。

谢谢。

错误:

部署前:

--- Incompletely deployed packages ---
org.jboss.deployment.DeploymentInfo@6381ab5b { url=file:/C:/jboss-4.2.3.GA/server/default/deploy/balaji.war }
  deployer: MBeanProxyExt[jboss.web:service=WebServer]
  status: Deployment FAILED reason: URL file:/C:/jboss-4.2.3.GA/server/default/tmp/deploy/tmp3791207339634144112balaji-exp.war/ deployment failed
  state: FAILED
  watch: file:/C:/jboss-4.2.3.GA/server/default/deploy/balaji.war
  altDD: null
  lastDeployed: 1330411627773
  lastModified: 1330411627765

      mbeans:

    --- MBeans waiting for other MBeans ---
    ObjectName: jboss.web.deployment:war=balaji.war,id=1669442395
      State: FAILED
      Reason: org.jboss.deployment.DeploymentException: URL file:/C:/jboss-4.2.3.GA/server/default/tmp/deploy/tmp3791207339634144112balaji-exp.war/ deployment failed

    --- MBEANS THAT ARE THE ROOT CAUSE OF THE PROBLEM ---
    ObjectName: jboss.web.deployment:war=balaji.war,id=1669442395
      State: FAILED
      Reason: org.jboss.deployment.DeploymentException: URL file:/C:/jboss-4.2.3.GA/server/default/tmp/deploy/tmp3791207339634144112balaji-exp.war/ deployment failed


    12:17:08,876 INFO  [Http11Protocol] Starting Coyote HTTP/1.1 on http-localhost%2F127.0.0.1-8090
    12:17:08,924 INFO  [AjpProtocol] Starting Coyote AJP/1.3 on ajp-localhost%2F127.0.0.1-8009
    12:17:08,959 INFO  [Server] JBoss (MX MicroKernel) [4.2.3.GA (build: SVNTag=JBoss_4_2_3_GA date=200807181417)] Started in 11s:700ms

使用Ant Build部署后:

   12:19:24,258 INFO  [TomcatDeployer] deploy, ctxPath=/balaji, warUrl=.../tmp/deploy/tmp7423340101766636518balaji-exp.war/
    12:19:24,572 WARN  [FileManager] Could not create JarEntryRevision for [jar:file:/C:/jboss-4.2.3.GA/server/default/tmp/deploy/tmp7423340101766636518balaji-exp.war/WEB-INF/lib/struts2-core-2.3.1.2.jar]!
    java.lang.NoClassDefFoundError: org/apache/commons/io/FileUtils
        at com.opensymphony.xwork2.util.FileManager$JarEntryRevision.build(FileManager.java:309)
        at com.opensymphony.xwork2.util.FileManager.loadFile(FileManager.java:145)
        at com.opensymphony.xwork2.util.FileManager.loadFile(FileManager.java:105)
        at com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.loadConfigurationFiles(XmlConfigurationProvider.java:935)
        at com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.loadDocuments(XmlConfigurationProvider.java:155)
        at com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.init(XmlConfigurationProvider.java:122)
        at com.opensymphony.xwork2.config.impl.DefaultConfiguration.reloadContainer(DefaultConfiguration.java:179)

***很长时间切割

Caused by: java.lang.ClassNotFoundException: org.apache.commons.io.FileUtils
    at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1358)
    at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1204)
    ... 103 more
12:19:24,640 INFO  [XmlConfigurationProvider] Parsing configuration file [struts-default.xml]
12:19:24,642 ERROR [[/balaji]] Exception starting filter struts2
java.lang.NoClassDefFoundError: org/apache/commons/lang/StringUtils
    at com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.register(XmlConfigurationProvider.java:201)
    at org.apache.struts2.config.StrutsXmlConfigurationProvider.register(StrutsXmlConfigurationProvider.java:102)
    at com.opensymphony.xwork2.config.impl.DefaultConfiguration.reloadContainer(DefaultConfiguration.java:180)
    at com.opensymphony.xwork2.config.ConfigurationManager.getConfiguration(ConfigurationManager.java:66)

***很长,所以切割

Caused by: java.lang.ClassNotFoundException: org.apache.commons.lang.StringUtils
    at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1358)
    at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1204)
    ... 99 more
12:19:24,644 ERROR [StandardContext] Error filterStart
12:19:24,644 ERROR [StandardContext] Context [/balaji] startup failed due to previous errors
12:19:24,664 WARN  [ServiceController] Problem starting service jboss.web.deployment:war=balaji.war,id=1669442395
org.jboss.deployment.DeploymentException: URL file:/C:/jboss-4.2.3.GA/server/default/tmp/deploy/tmp7423340101766636518balaji-exp.war/ deployment failed
    at org.jboss.web.tomcat.service.TomcatDeployer.performDeployInternal(TomcatDeployer.java:386)
    at org.jboss.web.tomcat.service.TomcatDeployer.performDeploy(TomcatDeployer.java:104)

Project Structure

Build.properties:

deploydir=C:/jboss-4.2.3.GA/server/default/deploy
userlib=C:/Jar/struts2jars
warname=balaji

的login.jsp

<%@ taglib prefix="struts" uri="/struts-tags" %>

<html>
        <head>
            <title>
                struts2 Application
            </title>
        </head>

        <body bgcolor="yellow">
            <struts:form action="dologin" method="get">

                <struts:textfield name="username" label="Enter your name"/>

                <struts:password name="password" label="Enter your Password"/>

                <struts:submit value="Login"/>

            </struts:form>

        </body>

</html>

动作类:Login.java

package com.cluster.action;

import com.opensymphony.xwork2.ActionSupport;

public class Login extends ActionSupport {

    private static final long serialVersionUID = 1L;

    private String username;
    private String password;

    public String getUsername() {
        return username;
    }

    public void setUsername(String username) {
        this.username = username;
    }

    public String getPassword() {
        return password;
    }

    public void setPassword(String password) {
        this.password = password;
    }



    public String execute() {
        String strResult = "failure";

        if(username.equalsIgnoreCase("Balaji") && password.equalsIgnoreCase("Cluster")) {
            strResult = "success";
        }

        return strResult;
    }

}

C:/ Jar / struts2jars中的Jars

C:/Jar/struts2jars

0 个答案:

没有答案