Пример развертывания приложения Struts-2 - PullRequest
0 голосов
/ 28 февраля 2012

Я получаю ошибку развертывания для развертывания в J-Boss 4.2, Я использую Eclipse, интегрированный JBOSS 4.2, добавил,

Я добавил build.properties и build.xml (ANT BUILD) для моего приложения,

Мне кажется, я не добавляю достаточно банок для развертывания. Или я не настроил 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: / Баночка / struts2jars

C:/Jar/struts2jars

...