users@glassfish.java.net

Re: struts-config.xml ok in GF2.1 but parsing error in GF3

From: <glassfish_at_javadesktop.org>
Date: Thu, 08 Apr 2010 18:18:47 PDT

I wrote a simple jee struts app to test the case. The struts-config.xml was generated by Netbean but it has the same problem as my old app. As mentioned in my second post above, it works when I start GF3 from Netbean, but doesn't work when I deploy the ear file to standalone GF3 (same installation).

I further test the case with standalone GF3 but instead of using ear file, I deploy the app using the folder in netbeans project's "dist/gfdeploy/my app" and it works! I checked the content of the folder which is the same as the ear file. Any idea why?

Here is the extract of server.log (from ear deployment to the problem):
[#|2010-04-08T17:53:59.564+0800|INFO|glassfishv3.0|javax.enterprise.system.tools.deployment.org.glassfish.deployment.common|_ThreadID=30;_ThreadName=Thread-1;|[AutoDeploy] Selecting file C:\Program Files\glassfishv3\glassfish\domains\domain1\autodeploy\tryv3.ear for autodeployment.|#]

[#|2010-04-08T17:54:01.033+0800|INFO|glassfishv3.0|javax.enterprise.system.container.ejb.com.sun.ejb.containers|_ThreadID=30;_ThreadName=Thread-1;|Portable JNDI names for EJB AddBean : [java:global/tryv3/tryv3-ejb/AddBean!ejb.AddBeanLocal, java:global/tryv3/tryv3-ejb/AddBean!ejb.AddBeanRemote]|#]

[#|2010-04-08T17:54:01.033+0800|INFO|glassfishv3.0|javax.enterprise.system.container.ejb.com.sun.ejb.containers|_ThreadID=30;_ThreadName=Thread-1;|Glassfish-specific (Non-portable) JNDI names for EJB AddBean : [addBean, addBean#ejb.AddBeanRemote]|#]

[#|2010-04-08T17:54:01.533+0800|INFO|glassfishv3.0|javax.enterprise.resource.webcontainer.jsf.config|_ThreadID=30;_ThreadName=Thread-1;|Initializing Mojarra 2.0.2 (FCS b10) for context '/tryv3-war'|#]

[#|2010-04-08T17:54:02.861+0800|INFO|glassfishv3.0|javax.enterprise.system.container.web.com.sun.enterprise.web|_ThreadID=30;_ThreadName=Thread-1;|PWC1412: WebModule[/tryv3-war] ServletContext.log():PWC1409: Marking servlet action as unavailable|#]

[#|2010-04-08T17:54:02.861+0800|INFO|glassfishv3.0|javax.enterprise.system.container.web.com.sun.enterprise.web|_ThreadID=30;_ThreadName=AutoDeployer;|PWC1412: WebModule[/tryv3-war] ServletContext.log():PWC1409: Marking servlet action as unavailable|#]

[#|2010-04-08T17:54:02.861+0800|INFO|glassfishv3.0|javax.enterprise.system.container.web.com.sun.enterprise.web|_ThreadID=30;_ThreadName=AutoDeployer;|PWC1412: WebModule[/tryv3-war] ServletContext.log():PWC1409: Marking servlet action as unavailable|#]

[#|2010-04-08T17:54:02.861+0800|SEVERE|glassfishv3.0|javax.enterprise.system.container.web.com.sun.enterprise.web|_ThreadID=30;_ThreadName=Thread-1;|WebModule[/tryv3-war]PWC1396: Servlet /tryv3-war threw load() exception
javax.servlet.UnavailableException: Parsing error processing resource path jndi:/server/tryv3-war/WEB-INF/struts-config.xml
        at org.apache.struts.action.ActionServlet.handleConfigException(ActionServlet.java:761)
        at org.apache.struts.action.ActionServlet.parseModuleConfigFile(ActionServlet.java:742)
        at org.apache.struts.action.ActionServlet.initModuleConfig(ActionServlet.java:689)
        at org.apache.struts.action.ActionServlet.init(ActionServlet.java:356)
        at javax.servlet.GenericServlet.init(GenericServlet.java:242)
        at org.apache.catalina.core.StandardWrapper.initServlet(StandardWrapper.java:1428)
        at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:1230)
        at org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:4934)
        at org.apache.catalina.core.StandardContext.start(StandardContext.java:5207)
        at com.sun.enterprise.web.WebModule.start(WebModule.java:499)
        at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:928)
        at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:912)
        at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:694)
        at com.sun.enterprise.web.WebContainer.loadWebModule(WebContainer.java:1933)
        at com.sun.enterprise.web.WebContainer.loadWebModule(WebContainer.java:1605)
        at com.sun.enterprise.web.WebApplication.start(WebApplication.java:90)
        at org.glassfish.internal.data.EngineRef.start(EngineRef.java:126)
        at org.glassfish.internal.data.ModuleInfo.start(ModuleInfo.java:241)
        at org.glassfish.internal.data.ApplicationInfo.start(ApplicationInfo.java:236)
        at com.sun.enterprise.v3.server.ApplicationLifecycle.deploy(ApplicationLifecycle.java:339)
        at com.sun.enterprise.v3.server.ApplicationLifecycle.deploy(ApplicationLifecycle.java:183)
        at org.glassfish.deployment.admin.DeployCommand.execute(DeployCommand.java:272)
        at com.sun.enterprise.v3.admin.CommandRunnerImpl$1.execute(CommandRunnerImpl.java:310)
        at com.sun.enterprise.v3.admin.CommandRunnerImpl.doCommand(CommandRunnerImpl.java:320)
        at com.sun.enterprise.v3.admin.CommandRunnerImpl.doCommand(CommandRunnerImpl.java:1176)
        at com.sun.enterprise.v3.admin.CommandRunnerImpl.access$900(CommandRunnerImpl.java:83)
        at com.sun.enterprise.v3.admin.CommandRunnerImpl$ExecutionContext.execute(CommandRunnerImpl.java:1235)
        at org.glassfish.deployment.autodeploy.AutoOperation.run(AutoOperation.java:141)
        at org.glassfish.deployment.autodeploy.AutoDeployer.deploy(AutoDeployer.java:573)
        at org.glassfish.deployment.autodeploy.AutoDeployer.deployAll(AutoDeployer.java:459)
        at org.glassfish.deployment.autodeploy.AutoDeployer.run(AutoDeployer.java:391)
        at org.glassfish.deployment.autodeploy.AutoDeployer.run(AutoDeployer.java:376)
        at org.glassfish.deployment.autodeploy.AutoDeployService$1.run(AutoDeployService.java:195)
        at java.util.TimerThread.mainLoop(Timer.java:512)
        at java.util.TimerThread.run(Timer.java:462)
|#]

[#|2010-04-08T17:54:02.861+0800|SEVERE|glassfishv3.0|javax.enterprise.system.container.web.com.sun.enterprise.web|_ThreadID=30;_ThreadName=AutoDeployer;|WebModule[/tryv3-war]PWC1396: Servlet /tryv3-war threw load() exception
javax.servlet.UnavailableException: Parsing error processing resource path jndi:/server/tryv3-war/WEB-INF/struts-config.xml
        at org.apache.struts.action.ActionServlet.handleConfigException(ActionServlet.java:761)
        at org.apache.struts.action.ActionServlet.parseModuleConfigFile(ActionServlet.java:742)
        at org.apache.struts.action.ActionServlet.initModuleConfig(ActionServlet.java:689)
.................. more ..............

Here is the web.xml:
<?xml version="1.0" encoding="UTF-8"?>
<web-app version="3.0" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd">
    <servlet>
        <servlet-name>action</servlet-name>
        <servlet-class>org.apache.struts.action.ActionServlet</servlet-class>
        <init-param>
            <param-name>config</param-name>
            <param-value>/WEB-INF/struts-config.xml</param-value>
        </init-param>
        <init-param>
            <param-name>debug</param-name>
            <param-value>2</param-value>
        </init-param>
        <init-param>
            <param-name>detail</param-name>
            <param-value>2</param-value>
        </init-param>
        <load-on-startup>2</load-on-startup>
    </servlet>
    <servlet-mapping>
        <servlet-name>action</servlet-name>
        <url-pattern>*.do</url-pattern>
    </servlet-mapping>
    <session-config>
        <session-timeout>
            30
        </session-timeout>
    </session-config>
    <welcome-file-list>
        <welcome-file>index.jsp</welcome-file>
    </welcome-file-list>
</web-app>

Here is the struts-config.xml:
<?xml version="1.0" encoding="UTF-8" ?>

<!DOCTYPE struts-config PUBLIC
          "-//Apache Software Foundation//DTD Struts Configuration 1.3//EN"
          "http://jakarta.apache.org/struts/dtds/struts-config_1_3.dtd">


<struts-config>
    <form-beans>
        <form-bean name="AddForm" type="forms.AddForm"/>
    
    </form-beans>
    
    <global-exceptions>
    
    </global-exceptions>

    <global-forwards>
        <forward name="welcome" path="/Welcome.do"/>
    </global-forwards>

    <action-mappings>
        <action input="/addJsp.jsp" name="AddForm" path="/AddAction" scope="session" type="actions.AddAction">
            <forward name="success" path="/addJsp.jsp"/>
        </action>
        <action path="/Welcome" forward="/welcomeStruts.jsp"/>
    </action-mappings>
    
    <controller processorClass="org.apache.struts.tiles.TilesRequestProcessor"/>

    <message-resources parameter="com/ApplicationResource"/>
    
    <!-- ========================= Tiles plugin ===============================-->
    <!--
    This plugin initialize Tiles definition factory. This later can takes some
    parameters explained here after. The plugin first read parameters from
    web.xml, thenoverload them with parameters defined here. All parameters
    are optional.
    The plugin should be declared in each struts-config file.
    - definitions-config: (optional)
    Specify configuration file names. There can be several comma
    separated file names (default: ?? )
    - moduleAware: (optional - struts1.1)
    Specify if the Tiles definition factory is module aware. If true
    (default), there will be one factory for each Struts module.
    If false, there will be one common factory for all module. In this
    later case, it is still needed to declare one plugin per module.
    The factory will be initialized with parameters found in the first
    initialized plugin (generally the one associated with the default
    module).
    true : One factory per module. (default)
    false : one single shared factory for all modules
    - definitions-parser-validate: (optional)
    Specify if xml parser should validate the Tiles configuration file.
    true : validate. DTD should be specified in file header (default)
    false : no validation

    Paths found in Tiles definitions are relative to the main context.
    -->
    <plug-in className="org.apache.struts.tiles.TilesPlugin" >
        <set-property property="definitions-config" value="/WEB-INF/tiles-defs.xml" />
        <set-property property="moduleAware" value="true" />
    </plug-in>
    
    <!-- ========================= Validator plugin ================================= -->
    <plug-in className="org.apache.struts.validator.ValidatorPlugIn">
        <set-property
            property="pathnames"
            value="/WEB-INF/validator-rules.xml,/WEB-INF/validation.xml"/>
    </plug-in>
  
</struts-config>
[Message sent by forum member 'senderj']

http://forums.java.net/jive/thread.jspa?messageID=396025