Have you specified the load-on-startup attribute for the controller Servlet in web.xml?

Erik


Daffin, Miles (Company IT) wrote:

Hi,

Can anyone tell me if this is a bug?

I have a struts 1.1 app with a typical default index.jsp redirecting to
the entry point action:

<logic:redirect forward="/startForm3"/>

This was failing to because of the following NPE:

---
java.lang.NullPointerException
at
org.apache.struts.util.RequestUtils.computeURL(RequestUtils.java:521)
at
org.apache.struts.util.RequestUtils.computeURL(RequestUtils.java:436)
at
org.apache.struts.util.RequestUtils.computeURL(RequestUtils.java:396)
at
org.apache.struts.taglib.logic.RedirectTag.doEndTag(RedirectTag.java:294
)
---

I can see from a quick google that this is a frequently experienced
problem and yet I have not seen a satisfactory solution.

If we look into the RequestUtils code we find that the problem is that
the ModuleConfig cannot be found on either the request or in the
application context. When the forward config for the string in the jsp
is looked up we therfore get the NPE.


If we look into the container logs we find the root cause: the
ActionServlet failed to load:

---
javax.servlet.ServletException: Error instantiating servlet class
org.apache.struts.action.ActionServlet
at
org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.jav
a:986)
...
----- Root Cause -----
java.lang.NoClassDefFoundError: javax/sql/DataSource
at java.lang.ClassLoader.defineClass0(Native Method)
---

One assumes that the ActionServlet did not load the ModuleConfig, and
that the application is *not* therefore really viable - although it
seems to think it is...

So. My question is: is this a struts bug? Should the application be
attempting to service requests if its central component failed to boot
correctly?


The side effects this causes are hard to diagnose and I suggest that it
would be better if, in situations like this, all further requests were
responded to with an Error 500 and the stacktrace for the original
problem.


My apologies if this is one of a thousand emails on the same subject. I
searched the archive prior to writing this.


-Miles

Miles Daffin
Morgan Stanley
20 Cabot Square | Canary Wharf | London E14 4QA | UK
Tel: +44 (0) 20 767 75119
[EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]> --------------------------------------------------------


NOTICE: If received in error, please destroy and notify sender. Sender does not waive confidentiality or privilege, and use is prohibited.





--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to