You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by "Hutchison, Jeff" <jh...@inst.strykercorp.com> on 2000/06/12 20:20:19 UTC

Strut example broke on latest CVS version of tomcat?

I have the latest CVS build of tomcat and it appears that the struts
example application stopped running normally after my latest update.

When I run the application just after starting tomcat, I get the
following exception:

javax.servlet.jsp.JspException: Missing resources attribute
org.apache.struts.action.MESSAGE
	at java.lang.Throwable.<init>(Throwable.java:96)
	at java.lang.Exception.<init>(Exception.java:44)
	at javax.servlet.jsp.JspException.<init>(JspException.java:73)
	at 
  org.apache.struts.taglib.MessageTag.doStartTag(MessageTag.java:332)
	at
  _0002findex_0002ejspindex_jsp_1._jspService(_0002findex_0002ejspindex_jsp_1.java:68)
	at
  org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:126)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
[snip]

It appears that the action and database servlets are not being loaded at
start up properly.  If I manually load both servlets by invoking them
through my browser, then go to the struts example, all is fine.

-jh

-- 
Jeff Hutchison <jh...@inst.strykercorp.com>
Stryker Instruments Kalamazoo, MI


Re: Can't get it running.

Posted by "Craig R. McClanahan" <Cr...@eng.sun.com>.
Kevin Duffey wrote:

> Craig..I wish I had your email. ;) I keep posting questions to the list that
> may not pertain.
>

My email address is on the "From" line of every message I send :-)

    Craig.McClanahan@eng.sun.com

>
> Incidentally, how do I access the docs once I deploy them. I tried typing in
> localhost/struts and struts-documentation, but the page isn't coming up. Not
> sure that I am deploying correctly either..but I thought i was.

Precise rules for deployment depend on the servlet container you are using.  On
Tomcat, all you do is put the "struts-documentation.war" file in your webapps
directory and access it with:

    http://localhost:8080/struts-documentation

(i.e. the context path is automatically set to the name of the WAR file without
the extension).  Orion may be different -- check your docs.

Craig



RE: Can't get it running.

Posted by Kevin Duffey <kd...@buymedia.com>.
Craig..I wish I had your email. ;) I keep posting questions to the list that
may not pertain.

Incidentally, how do I access the docs once I deploy them. I tried typing in
localhost/struts and struts-documentation, but the page isn't coming up. Not
sure that I am deploying correctly either..but I thought i was.


RE: Can't get it running.

Posted by Kevin Duffey <kd...@buymedia.com>.
My struts.jar does contain the .properties file.

Re: Can't get it running.

Posted by "Craig R. McClanahan" <Cr...@eng.sun.com>.
Kevin Duffey wrote:

> Hi,
>
> > > I encountered the same problem. The reason was that I only set the
> > > struts.jar to classpath, struts.jar doesn't (at least in my case)
> > > include the org.apache.struts.example -package.
> > > So those files must be separately copied into the WEB-INF/classes
> > > -directory.
> > >
> >
> > Good point ... if you want the example application, then you need to
> > deploy the "struts-example.war" file into your servlet container.  If
> > you want to use those classes as the basis for your own application, you
> > need to have the contents of the WEB-INF/classes directory in the
> > example application available on your classpath (at compile time), and
> > available to your servlet container when you run.
>
> Not quite the same problem I am having. I took all references to the
> examples out of the web.xml and action.xml, so I only need the framework
> itself to work. I will supply my own action classes, and hopefully get the
> javabean (formClass) stuff working too. I have an urgency to get this
> working ASAP, so if anyone can shed light on getting Struts working with
> Orion, that would be great. I do know that Orion is fully J2EE compliant,
> and that anything put in /WEB-INF/classes is in the classpath as the servlet
> 2.2 spec says (and I think /WEB-INF/lib gets loaded as well). I have no
> problem calling into any of my code put in this dir, so I don't think thats
> the problem. The problem I seem to be having (sorry for reiterating) is the
> resource loading..it isn't loading any resources. Since my app will never be
> internationally needed, I wouldn't mind doing away with this, if possible.
> Do I need to put some resource in WEB-INF as well? I put the .tld and
> action.xml file there...is something else needed there? The struts.jar is in
> /lib, and it does load, otherwise the servlet wouldn't be called. Infact,
> the mapping must be working as well, since the servlet is being called when
> I submit my .do action/form.
>

The particular resource that Kevin is tripping on is
"org.apache.struts.action.ActionResources", which contains the internal messages
that can be created by the ActionServlet servlet -- not application messages.
It should be present in the "struts.jar" file, in entry
"org/apache/struts/action/ActionResources.properties".

Kevin, could you make sure that your struts.jar file contains this entry?  If it
does, then the classloader used by Orion is not loading resource bundles
correctly, and you should report that.  Internally, Struts is doing this call:

    ResourceBundle bundle =
ResourceBundle.getBundle("org.apache.struts.action.ActionResources");

which, using the standard JDK resource bundle capabilities, will load a
PropertyResourceBundle from the file identified above.  However, for this to
work, the class loader used by your servlet container must correctly implement
the ClassLoader.getResourceAsStream() method.

As a possible workaround (no idea whether it will work), you might also try
un-JARing the struts.jar file into your "WEB-INF/classes" directory, and see if
Orion will load the resources correctly from there.

>
> Thanks again.

Craig



RE: Can't get it running.

Posted by Kevin Duffey <kd...@buymedia.com>.
Hi,

> > I encountered the same problem. The reason was that I only set the
> > struts.jar to classpath, struts.jar doesn't (at least in my case)
> > include the org.apache.struts.example -package.
> > So those files must be separately copied into the WEB-INF/classes
> > -directory.
> >
>
> Good point ... if you want the example application, then you need to
> deploy the "struts-example.war" file into your servlet container.  If
> you want to use those classes as the basis for your own application, you
> need to have the contents of the WEB-INF/classes directory in the
> example application available on your classpath (at compile time), and
> available to your servlet container when you run.

Not quite the same problem I am having. I took all references to the
examples out of the web.xml and action.xml, so I only need the framework
itself to work. I will supply my own action classes, and hopefully get the
javabean (formClass) stuff working too. I have an urgency to get this
working ASAP, so if anyone can shed light on getting Struts working with
Orion, that would be great. I do know that Orion is fully J2EE compliant,
and that anything put in /WEB-INF/classes is in the classpath as the servlet
2.2 spec says (and I think /WEB-INF/lib gets loaded as well). I have no
problem calling into any of my code put in this dir, so I don't think thats
the problem. The problem I seem to be having (sorry for reiterating) is the
resource loading..it isn't loading any resources. Since my app will never be
internationally needed, I wouldn't mind doing away with this, if possible.
Do I need to put some resource in WEB-INF as well? I put the .tld and
action.xml file there...is something else needed there? The struts.jar is in
/lib, and it does load, otherwise the servlet wouldn't be called. Infact,
the mapping must be working as well, since the servlet is being called when
I submit my .do action/form.

Thanks again.


Re: Can't get it running.

Posted by "Craig R. McClanahan" <Cr...@eng.sun.com>.
Kare Nuorteva wrote:

> "Craig R. McClanahan" wrote:
> >
> >
> > Have any other Orion users been successful (or not) using Struts?
>
> Hello,
>
> I encountered the same problem. The reason was that I only set the
> struts.jar to classpath, struts.jar doesn't (at least in my case)
> include the org.apache.struts.example -package.
> So those files must be separately copied into the WEB-INF/classes
> -directory.
>

Good point ... if you want the example application, then you need to
deploy the "struts-example.war" file into your servlet container.  If
you want to use those classes as the basis for your own application, you
need to have the contents of the WEB-INF/classes directory in the
example application available on your classpath (at compile time), and
available to your servlet container when you run.

>
> It's important to notice that we are discussing about two different
> software:
> - Struts Framework
> - Struts Example Application
>
> Cheers,
> Kare 8^)
>

Craig



Re: Can't get it running.

Posted by Kare Nuorteva <ka...@satama.com>.
"Craig R. McClanahan" wrote:
> 
> 
> Have any other Orion users been successful (or not) using Struts?


Hello,

I encountered the same problem. The reason was that I only set the
struts.jar to classpath, struts.jar doesn't (at least in my case)
include the org.apache.struts.example -package.
So those files must be separately copied into the WEB-INF/classes
-directory.

It's important to notice that we are discussing about two different
software:
- Struts Framework
- Struts Example Application

Cheers,
Kare 8^)

-- 
Kare Nuorteva, Software Engineer
Satama UK Ltd
mobile +44 7989 852 865
http://www.satama.co.uk/

Re: Can't get it running.

Posted by "Craig R. McClanahan" <Cr...@eng.sun.com>.
Kevin Duffey wrote:

> Hi Craig,
>
> I am not sure if my action.xml syntax is correct:
>
> <!-- Action Mappings for the STRUTS Example Application -->
>
> <action-mappings>
>
>   <!-- Edit user registration -->
>   <action
>     path="/AdminLogin"
>     actionClass="com.bm.admin.actions.AdminLogin"
>     formAttribute=""
>     formClass=""
>   />
>
> </action-mappings>
>
> Notice I just use "" for formAttribute and formClass. I will eventually use
> these to have the autopopulated bean work, but I am unclear as to the syntax
> if this is ok or not. Should I leave them out?
>

If you are not using them, you should just leave them out.  Otherwise, you are
going to mislead the framework into trying to find a class named "", which of
course it will not be able to do.

>
> Sadly, you mention looking in the JavaDoc api..yet I dont have any JavaDoc
> API with the download (just got the june 13th one). Do I need to create my
> own javadoc from the source?
>

The API docs, as well as a bunch of other documentation (user's guide and a
reference for all of the custom tags), is packaged in the
"struts-documentation.war" web application.  Simply deploy this on your servlet
container and access it with a browser.

>
> On another note, I tried compiling the source several times, and to no avail
> can the compiler seem to get past the javax.parser.SAXParser,
> javax.parser.Document, etc. I don't know why. I have in my compiler
> classpath the xml.jar, parser.jar, xerces.jar. Orion ships with xerces.jar
> and parser.jar. I think parser.jar is the sun parser. We have xml.jar, which
> is also suns xml. Am I missing something? Its only in ActionServlet and
> Digester that I get these errors.
>

You need to have "jaxp.jar" and "parser.jar" from the JAXP 1.0.1 release on your
compiler classpath, as described on the README file.

I'm not sure that the Xerces version shipped with Orion is JAXP-compatible -- if
not, this could be an area of difficulty in geting them to work together.  If it
is, then you can use Xerces instead of JAXP.  The "xml.jar" file is the old Sun
"Project X" parser that was used, among other things, with Tomcat 3.0 and 3.1.
I haven't tested it explicitly, but I'm pretty sure it's not compatible.

>
> Thanks.


RE: Can't get it running.

Posted by Kevin Duffey <kd...@buymedia.com>.
Hi Craig,

I am not sure if my action.xml syntax is correct:

<!-- Action Mappings for the STRUTS Example Application -->

<action-mappings>

  <!-- Edit user registration -->
  <action
    path="/AdminLogin"
    actionClass="com.bm.admin.actions.AdminLogin"
    formAttribute=""
    formClass=""
  />

</action-mappings>


Notice I just use "" for formAttribute and formClass. I will eventually use
these to have the autopopulated bean work, but I am unclear as to the syntax
if this is ok or not. Should I leave them out?

Sadly, you mention looking in the JavaDoc api..yet I dont have any JavaDoc
API with the download (just got the june 13th one). Do I need to create my
own javadoc from the source?

On another note, I tried compiling the source several times, and to no avail
can the compiler seem to get past the javax.parser.SAXParser,
javax.parser.Document, etc. I don't know why. I have in my compiler
classpath the xml.jar, parser.jar, xerces.jar. Orion ships with xerces.jar
and parser.jar. I think parser.jar is the sun parser. We have xml.jar, which
is also suns xml. Am I missing something? Its only in ActionServlet and
Digester that I get these errors.

Thanks.


Re: Can't get it running.

Posted by "Craig R. McClanahan" <Cr...@eng.sun.com>.
Kevin Duffey wrote:

> Hi Craig,
>
> > > <web-app>
> > >
> > >     <servlet>
> > >       <servlet-name>action</servlet-name>
> > >
> > <servlet-class>org.apache.struts.action.ActionServlet</servlet-class>
> > >       <load-on-startup>1</load-on-startup>
> > >     </servlet>
> > >
> >
> > You have neglected to include any of the servlet initialization
> > parameters for
> > the controller servlet.  This will cause you grief later,
> > although it did not
> > cause the particular message you received.  See the Javadocs
> > comments for the
> > init() method of ActionServlet.
>
> Actually, I did have those in there and still got the problem.
>
> > This is coming from the code at the beginning of the init method, which is
> > (ultimately) trying to load a ResourceBundle for
> > "org.apache.struts.action.ActionResources" (in the struts.jar file).  The
> > implication is that the servlet container you are running in might not be
> > implementing getResource() or getResourceAsStream() correctly.
> > What are you
> > trying this under?
>
> Orion app server. I saw a few others using Orion..not sure if they got it
> working or not. Any suggestions?

All I can think of is try putting "struts.jar" on the system class path instead
of in WEB-INF/lib -- Orion may use a different approach for that.

Have any other Orion users been successful (or not) using Struts?

Craig





RE: Can't get it running.

Posted by Kevin Duffey <kd...@buymedia.com>.
Hi Craig,

> > <web-app>
> >
> >     <servlet>
> >       <servlet-name>action</servlet-name>
> >
> <servlet-class>org.apache.struts.action.ActionServlet</servlet-class>
> >       <load-on-startup>1</load-on-startup>
> >     </servlet>
> >
>
> You have neglected to include any of the servlet initialization
> parameters for
> the controller servlet.  This will cause you grief later,
> although it did not
> cause the particular message you received.  See the Javadocs
> comments for the
> init() method of ActionServlet.

Actually, I did have those in there and still got the problem.

> This is coming from the code at the beginning of the init method, which is
> (ultimately) trying to load a ResourceBundle for
> "org.apache.struts.action.ActionResources" (in the struts.jar file).  The
> implication is that the servlet container you are running in might not be
> implementing getResource() or getResourceAsStream() correctly.
> What are you
> trying this under?

Orion app server. I saw a few others using Orion..not sure if they got it
working or not. Any suggestions?


Re: Can't get it running.

Posted by "Craig R. McClanahan" <Cr...@eng.sun.com>.
See below.

Kevin Duffey wrote:

> Hi Craig,
>
> Having some problems getting Struts to work. I have an application, with
> WEB-INF below www, web.xml in it, classes and lib folders in WEB-INF as
> well. I moved the struts.jar to WEB-INF/lib, and moved the action.xml and
> struts.tld to WEB-INF/.
>
> Here is what web.xml and action.xml look like:
>
> web.xml:
>
> <?xml version="1.0"?>
> <!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application
> 2.2//EN" "http://java.sun.com/j2ee/dtds/web-app_2_2.dtd">
>
> <web-app>
>
>     <servlet>
>       <servlet-name>action</servlet-name>
>       <servlet-class>org.apache.struts.action.ActionServlet</servlet-class>
>       <load-on-startup>1</load-on-startup>
>     </servlet>
>

You have neglected to include any of the servlet initialization parameters for
the controller servlet.  This will cause you grief later, although it did not
cause the particular message you received.  See the Javadocs comments for the
init() method of ActionServlet.

>
>     <servlet-mapping>
>       <servlet-name>action</servlet-name>
>       <url-pattern>*.do</url-pattern>
>     </servlet-mapping>
>
>     <!-- Struts Tag Library Descriptor -->
>     <taglib>
>       <taglib-uri>/WEB-INF/struts.tld</taglib-uri>
>       <taglib-location>/WEB-INF/struts.tld</taglib-location>
>     </taglib>
>
>     <welcome-file-list>
>       <welcome-file>index.jsp</welcome-file>
>     </welcome-file-list>
>
> </web-app>
>
> action.xml:
>
> <!-- Action Mappings for the STRUTS Example Application -->
>
> <action-mappings>
>
>   <!-- Edit user registration -->
>   <action
>     path="/AdminLogin"
>     actionClass="com.bm.admin.actions.AdminLogin"
>     formAttribute=""
>     formClass=""
>   />
>
> </action-mappings>
>
> My index.jsp page shows up, but as soon as I try to call /AdminLogin.do in
> my login form, I get:
>
> Servlet error: Cannot load internal resources

This is coming from the code at the beginning of the init method, which is
(ultimately) trying to load a ResourceBundle for
"org.apache.struts.action.ActionResources" (in the struts.jar file).  The
implication is that the servlet container you are running in might not be
implementing getResource() or getResourceAsStream() correctly.  What are you
trying this under?

>
>
> I haven't had time to look in the source yet, but it seems as if there is
> some problem loading a resource (duh. ;). Any ideas what is going on?
>
> Thanks.

Craig

PS:  Replied only on STRUTS-USER, since this is a user question :-)



Can't get it running.

Posted by Kevin Duffey <kd...@buymedia.com>.
Hi Craig,

Having some problems getting Struts to work. I have an application, with
WEB-INF below www, web.xml in it, classes and lib folders in WEB-INF as
well. I moved the struts.jar to WEB-INF/lib, and moved the action.xml and
struts.tld to WEB-INF/.

Here is what web.xml and action.xml look like:

web.xml:

<?xml version="1.0"?>
<!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application
2.2//EN" "http://java.sun.com/j2ee/dtds/web-app_2_2.dtd">

<web-app>

    <servlet>
      <servlet-name>action</servlet-name>
      <servlet-class>org.apache.struts.action.ActionServlet</servlet-class>
      <load-on-startup>1</load-on-startup>
    </servlet>

    <servlet-mapping>
      <servlet-name>action</servlet-name>
      <url-pattern>*.do</url-pattern>
    </servlet-mapping>

    <!-- Struts Tag Library Descriptor -->
    <taglib>
      <taglib-uri>/WEB-INF/struts.tld</taglib-uri>
      <taglib-location>/WEB-INF/struts.tld</taglib-location>
    </taglib>

    <welcome-file-list>
      <welcome-file>index.jsp</welcome-file>
    </welcome-file-list>

</web-app>



action.xml:

<!-- Action Mappings for the STRUTS Example Application -->

<action-mappings>

  <!-- Edit user registration -->
  <action
    path="/AdminLogin"
    actionClass="com.bm.admin.actions.AdminLogin"
    formAttribute=""
    formClass=""
  />

</action-mappings>




My index.jsp page shows up, but as soon as I try to call /AdminLogin.do in
my login form, I get:

Servlet error: Cannot load internal resources

I haven't had time to look in the source yet, but it seems as if there is
some problem loading a resource (duh. ;). Any ideas what is going on?

Thanks.


Can't get it running.

Posted by Kevin Duffey <kd...@buymedia.com>.
Hi Craig,

Having some problems getting Struts to work. I have an application, with
WEB-INF below www, web.xml in it, classes and lib folders in WEB-INF as
well. I moved the struts.jar to WEB-INF/lib, and moved the action.xml and
struts.tld to WEB-INF/.

Here is what web.xml and action.xml look like:

web.xml:

<?xml version="1.0"?>
<!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application
2.2//EN" "http://java.sun.com/j2ee/dtds/web-app_2_2.dtd">

<web-app>

    <servlet>
      <servlet-name>action</servlet-name>
      <servlet-class>org.apache.struts.action.ActionServlet</servlet-class>
      <load-on-startup>1</load-on-startup>
    </servlet>

    <servlet-mapping>
      <servlet-name>action</servlet-name>
      <url-pattern>*.do</url-pattern>
    </servlet-mapping>

    <!-- Struts Tag Library Descriptor -->
    <taglib>
      <taglib-uri>/WEB-INF/struts.tld</taglib-uri>
      <taglib-location>/WEB-INF/struts.tld</taglib-location>
    </taglib>

    <welcome-file-list>
      <welcome-file>index.jsp</welcome-file>
    </welcome-file-list>

</web-app>



action.xml:

<!-- Action Mappings for the STRUTS Example Application -->

<action-mappings>

  <!-- Edit user registration -->
  <action
    path="/AdminLogin"
    actionClass="com.bm.admin.actions.AdminLogin"
    formAttribute=""
    formClass=""
  />

</action-mappings>




My index.jsp page shows up, but as soon as I try to call /AdminLogin.do in
my login form, I get:

Servlet error: Cannot load internal resources

I haven't had time to look in the source yet, but it seems as if there is
some problem loading a resource (duh. ;). Any ideas what is going on?

Thanks.


Re: Strut example broke on latest CVS version of tomcat?

Posted by "Craig R. McClanahan" <Cr...@eng.sun.com>.
"Hutchison, Jeff" wrote:

> I have the latest CVS build of tomcat and it appears that the struts
> example application stopped running normally after my latest update.
>

I just tried this and had different problems (it couldn't load the MessageTag class from
struts.jar).

Tomcat is going through some major rearrangements in the code right now, so it is very
likely to have various things broken until that is all shaken out.  I would suggest
sticking with Tomcat 3.1, or testing under Catalina -- for which you can get nightly
builds at:

    http://jakarta.apache.org/builds/catalina/nightly

Note there is a relevant bug in Catalina that will get fixed later today -- you need to
add a trailing slash to the URL you use to call the app:

    http://localhost:8080/struts-example/

instead of

    http://localhost:8080/struts-example

to make the relative page references work right.  I will fix this in tonight's nightly
build of Catalina.

Craig


>
> When I run the application just after starting tomcat, I get the
> following exception:
>
> javax.servlet.jsp.JspException: Missing resources attribute
> org.apache.struts.action.MESSAGE
>         at java.lang.Throwable.<init>(Throwable.java:96)
>         at java.lang.Exception.<init>(Exception.java:44)
>         at javax.servlet.jsp.JspException.<init>(JspException.java:73)
>         at
>   org.apache.struts.taglib.MessageTag.doStartTag(MessageTag.java:332)
>         at
>   _0002findex_0002ejspindex_jsp_1._jspService(_0002findex_0002ejspindex_jsp_1.java:68)
>         at
>   org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:126)
>         at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
> [snip]
>
> It appears that the action and database servlets are not being loaded at
> start up properly.  If I manually load both servlets by invoking them
> through my browser, then go to the struts example, all is fine.
>
> -jh
>
> --
> Jeff Hutchison <jh...@inst.strykercorp.com>
> Stryker Instruments Kalamazoo, MI