• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Problem with configuring Struta application

 
Ranch Hand
Posts: 172
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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 https://coderanch.com/t/84015/Tomcat/Tomcat-not-find-Tag-Libs
 
Ranch Hand
Posts: 134
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Velika Srbija
Ranch Hand
Posts: 172
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 134
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 172
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks.
I already have Struts 1.1. Works OK.
Thanks again.
Problem solved.
 
reply
    Bookmark Topic Watch Topic
  • New Topic