aspose file tools*
The moose likes Struts and the fly likes Problem with configuring Struta application Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Java 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Problem with configuring Struta application" Watch "Problem with configuring Struta application" New topic
Author

Problem with configuring Struta application

Velika Srbija
Ranch Hand

Joined: Jan 15, 2002
Posts: 172
Note: I'm using IDEA 4.0 and Tomcat 5.0.18

I have expirienced a problem that I never had had before.
I'm at the very beginning of my new Struts application
and I started it with struts-blank app. Only few modifications
but constantly getting error:

SEVERE: Parsing error processing resource path /WEB-INF/struts-config.xml
java.lang.NullPointerException
at org.apache.struts.action.ActionServlet.initApplicationConfig(ActionServlet.java:857)
at org.apache.struts.action.ActionServlet.init(ActionServlet.java:455)
at javax.servlet.GenericServlet.init(GenericServlet.java:256)
at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1044)
at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:887)
at org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:3960)
at org.apache.catalina.core.StandardContext.start(StandardContext.java:4283)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1125)
...

What is going on? Can not figure out. Everything seems to be OK.


Another thing to note!

I had to use direct URI like:
uri="http://jakarta.apache.org/struts/tags-html-1.0"
in my taglib directive in my JSP page, because Tomcat complained that it can not find physical location of *.tld files when using aliases in taglib directive.
Very strange!
See http://www.coderanch.com/t/84015/Tomcat/Tomcat-not-find-Tag-Libs
Shankar Narayana
Ranch Hand

Joined: Jan 08, 2003
Posts: 134
Hi,

Did you validate the struts-config.xml before deploying, I mean there could be some format exceptions in the xml file. I dont have any idea about IDEA but I am using JDeveloper which looks for the well-formedness and validates the xml with the corressponding DTDs.

Put all your struts related DTD files and .tld files in the WEB-INF folder, so that you no need to point the URI attribute to the apache website.


"Failure is not when you fall down; its only when you fail to get up again."
Velika Srbija
Ranch Hand

Joined: Jan 15, 2002
Posts: 172
I have moved .tld and .dtd files under /WEB-INF but the same error occures again.

*********************************************
Here is my /WEB-INF/struts-config.xml file:

<?xml version="1.0" encoding="ISO-8859-1" ?>

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

<struts-config>
<form-beans>
<form-bean name="registerForm" type="register.RegisterForm" />
</form-beans>

<action-mappings>
<action path="/register"
type="register.RegisterAction"
name="registerForm"
input="/web/register/register.jsp">
<forward name="success" path="/web/register/success.html" />
<forward name="failure" path="/web/register/failure.html" />
</action>
</action-mappings>

<message-resources parameter="resources.application" />

<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>
------------------------------------------------

and here is an excerpt from my directory tree:

MyWebAppROOT/web/register/register.jsp
success.html
failure.html
MyWebAppROOT/WEB-INF/classes/register/RegisterAction.class
RegisterForm.class
MyWebAppROOT/WEB-INF/classes/resources/application.properties
MyWebAppROOT/WEB-INF/validator-rules.xml
validation.xml
...
------------------------------------------------

And here we go again; after starting Tomcat 5.0.18:

...
Aug 2, 2004 10:41:26 PM org.apache.struts.util.PropertyMessageResources <init>
INFO: Initializing, config='org.apache.struts.util.LocalStrings', returnNull=true
Aug 2, 2004 10:41:26 PM org.apache.struts.util.PropertyMessageResources <init>
INFO: Initializing, config='org.apache.struts.action.ActionResources', returnNull=true
Aug 2, 2004 10:41:26 PM org.apache.struts.action.ActionServlet initApplicationConfig
SEVERE: Parsing error processing resource path /WEB-INF/struts-config.xml
java.lang.NullPointerException
at org.apache.struts.action.ActionServlet.initApplicationConfig(ActionServlet.java:857)
at org.apache.struts.action.ActionServlet.init(ActionServlet.java:455)
at javax.servlet.GenericServlet.init(GenericServlet.java:256)
at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1044)
at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:887)
at org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:3960)
at org.apache.catalina.core.StandardContext.start(StandardContext.java:4283)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1125)
at org.apache.catalina.core.StandardHost.start(StandardHost.java:832)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1125)
at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:518)
at org.apache.catalina.core.StandardService.start(StandardService.java:519)
at org.apache.catalina.core.StandardServer.start(StandardServer.java:2345)
at org.apache.catalina.startup.Catalina.start(Catalina.java:598)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
...
--------------------------------------------------

What's wrong with this code?
Shankar Narayana
Ranch Hand

Joined: Jan 08, 2003
Posts: 134
Hi,

I have taken your struts-config.xml and tried to validate it using xmlspy, the problem is you are using a previous version of the DTD file, you should use the latest .tld and .dtd files.
Download the latest version of struts (ie 1.2). Your code should work fine with that.
Velika Srbija
Ranch Hand

Joined: Jan 15, 2002
Posts: 172
Thanks.
I already have Struts 1.1. Works OK.
Thanks again.
Problem solved.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Problem with configuring Struta application
 
Similar Threads
Tomcat 5 can not find Tag-Libs
Problem with struts in fedora 4
CONTEXT LODING PROBELM
JSTL EL language not resolving
Tomcat Error after moving from struts 1.1 to struts 1.3.10