DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://nagoya.apache.org/bugzilla/show_bug.cgi?id=13686>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://nagoya.apache.org/bugzilla/show_bug.cgi?id=13686

Struts 1.1 Beta 2 and Iplanet Web Server 6

           Summary: Struts 1.1 Beta 2 and Iplanet Web Server 6
           Product: Struts
           Version: 1.1 Beta 2
          Platform: PC
        OS/Version: Windows NT/2K
            Status: NEW
          Severity: Critical
          Priority: Other
         Component: Controller
        AssignedTo: [EMAIL PROTECTED]
        ReportedBy: [EMAIL PROTECTED]


Struts 1.1 Beta 2 does not seem to work under Iplanet 6. I tried running the 
Struts 1.1 example and blank web apps with Iplanet SP1, SP2, and SP4 ( which 
is the latest), with JDK 1.3.1_01 and 1.3.1_05 with no success. I deployed the 
blank application and example application and they all came back with the same 
problem. Eventually I got it working but I had to modify some of the struts 
code. I have included what I had to do in the bug report, and the lines of 
code that are causing the problem. 

The following are the problems I encountered with the blank application with 
Iplanet 6 SP4, and JDK 1.3.1_05, running on a Windows XP machine ( also on 
Windows NT). Note that I have no problems running the 1.0.2 struts examples on 
the same machine. In order to reproduce these problem simply install Iplanet 6 
SP4 and deploy the blank application to it. Nothing else required.

The first problem encountered is the commons-logging.jar problem. To solve 
this under Iplanet 6 you must use the commons-logging.jar library version 
1.0.2. None of the other versions seem to work, they all come back with Null 
pointer Exceptions ( even if you configure logging as per the documentation ) :

Internal error: Unexpected error condition thrown (unknown exception,no 
description), stack: java.lang.ExceptionInInitializerError: 
java.lang.NullPointerException   at 
org.apache.commons.logging.LogFactory.getFactory(LogFactory.java:326)   at 
org.apache.commons.logging.LogFactory.getLog(LogFactory.java:375)   at 
org.apache.struts.action.ActionServlet.<clinit>(ActionServlet.java:375)   at 
java.lang.Class.newInstance0(Native Method)   at java.lang.Class.newInstance
(Class.java:232)   at 
com.iplanet.server.http.servlet.WServletEntity.loadAndInitServlet
(WServletEntity.java:71)   at 
com.iplanet.server.http.servlet.WebApplication.init(WebApplication.java:315)   
at com.iplanet.server.http.servlet.VirtualServer.init
(VirtualServer.java:181)   at 
com.iplanet.server.http.servlet.NSServletRunner.VSInit
(NSServletRunner.java:686)  

The distribution should be updated with commons-logging.jar version 1.0.2. 
After you use commons-logging.jar 1.0.2 you get the following error when 
trying to access the index.jsp page in the blank application:

[15/Oct/2002:16:09:02] failure ( 3408):  Internal error: servlet service 
function had thrown ServletException (uri=/blank11/pages/Welcome.jsp): 
javax.servlet.ServletException, stack: javax.servlet.ServletException   at 
org.apache.jasper.runtime.PageContextImpl.handlePageException
(PageContextImpl.java:453)   at _jsps._pages._Welcome_jsp._jspService
(_Welcome_jsp.java:226)   at org.apache.jasper.runtime.HttpJspBase.service
(HttpJspBase.java:119)   at javax.servlet.http.HttpServlet.service
(HttpServlet.java:853)   at 
org.apache.jasper.servlet.JspServlet$JspServletWrapper.service
(JspServlet.java:248)   at 
org.apache.jasper.servlet.JspServlet$JspServletWrapper.access$6
(JspServlet.java:238)   at org.apache.jasper.servlet.JspServlet.serviceJspFile
(JspServlet.java:519)   at org.apache.jasper.servlet.JspServlet.service
(JspServlet.java:588)   at javax.servlet.http.HttpServlet.service
(HttpServlet.java:853)   at 
com.iplanet.server.http.servlet.NSServletRunner.invokeServletService
(NSServletRunner.java:897)   at 
com.iplanet.server.http.servlet.WebApplication.service
(WebApplication.java:1059)   at 
com.iplanet.server.http.servlet.NSServletRunner.ServiceWebApp
(NSServletRunner.java:959)   at 
com.iplanet.server.http.servlet.NSServletSession.internalRedirect(Native 
Method)   at com.iplanet.server.http.servlet.NSRequestDispatcher.forward
(NSRequestDispatcher.java:48)   at 
org.apache.struts.actions.ForwardAction.execute(ForwardAction.java:158)   at 
org.apache.struts.action.RequestProcessor.processActionPerform
(RequestProcessor.java:446)   at 
org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:266)   
at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1292)   
at org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:492)   at 
javax.servlet.http.HttpServlet.service(HttpServlet.java:740)   at 
javax.servlet.http.HttpServlet.service(HttpServlet.java:853)   at 
com.iplanet.server.http.servlet.NSServletRunner.invokeServletService
(NSServletRunner.java:897)   at 
com.iplanet.server.http.servlet.WebApplication.service
(WebApplication.java:1059)   at 
com.iplanet.server.http.servlet.NSServletRunner.ServiceWebApp
(NSServletRunner.java:959)   , root cause: javax.servlet.jsp.JspException   at 
org.apache.struts.taglib.bean.MessageTag.doStartTag(MessageTag.java:298)   at 
_jsps._pages._Welcome_jsp._jspService(_Welcome_jsp.java:89)   at 
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:119)   at 
javax.servlet.http.HttpServlet.service(HttpServlet.java:853)   at 
org.apache.jasper.servlet.JspServlet$JspServletWrapper.service
(JspServlet.java:248)   at 
org.apache.jasper.servlet.JspServlet$JspServletWrapper.access$6
(JspServlet.java:238)   at org.apache.jasper.servlet.JspServlet.serviceJspFile
(JspServlet.java:519)   at org.apache.jasper.servlet.JspServlet.service
(JspServlet.java:588)   at javax.servlet.http.HttpServlet.service
(HttpServlet.java:853)   at 
com.iplanet.server.http.servlet.NSServletRunner.invokeServletService
(NSServletRunner.java:897)   at 
com.iplanet.server.http.servlet.WebApplication.service
(WebApplication.java:1059)   at 
com.iplanet.server.http.servlet.NSServletRunner.ServiceWebApp
(NSServletRunner.java:959)   at 
com.iplanet.server.http.servlet.NSServletSession.internalRedirect(Native 
Method)   at com.iplanet.server.http.servlet.NSRequestDispatcher.forward
(NSRequestDispatcher.java:48)   at 
org.apache.struts.actions.ForwardAction.execute(ForwardAction.java:158)   at 
org.apache.struts.action.RequestProcessor.processActionPerform
(RequestProcessor.java:446)   at 
org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:266)   
at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1292)   
at org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:492)   at 
javax.servlet.http.HttpServlet.service(HttpServlet.java:740)   at 
javax.servlet.http.HttpServlet.service(HttpServlet.java:853)   at 
com.iplanet.server.http.servlet.NSServletRunner.invokeServletService
(NSServletRunner.java:897)   at 
com.iplanet.server.http.servlet.WebApplication.service
(WebApplication.java:1059)   at com.  [15/Oct/2002:16:09:02] failure ( 3408):  
Internal error: servlet service function had thrown ServletException 
(uri=/blank11/Welcome.do): javax.servlet.ServletException, stack: 
javax.servlet.ServletException   at 
org.apache.jasper.runtime.PageContextImpl.handlePageException
(PageContextImpl.java:453)   at _jsps._pages._Welcome_jsp._jspService
(_Welcome_jsp.java:226)   at org.apache.jasper.runtime.HttpJspBase.service
(HttpJspBase.java:119)   at javax.servlet.http.HttpServlet.service
(HttpServlet.java:853)   at 
org.apache.jasper.servlet.JspServlet$JspServletWrapper.service
(JspServlet.java:248)   at 
org.apache.jasper.servlet.JspServlet$JspServletWrapper.access$6
(JspServlet.java:238)   at org.apache.jasper.servlet.JspServlet.serviceJspFile
(JspServlet.java:519)   at org.apache.jasper.servlet.JspServlet.service
(JspServlet.java:588)   at javax.servlet.http.HttpServlet.service
(HttpServlet.java:853)   at 
com.iplanet.server.http.servlet.NSServletRunner.invokeServletService
(NSServletRunner.java:897)   at 
com.iplanet.server.http.servlet.WebApplication.service
(WebApplication.java:1059)   at 
com.iplanet.server.http.servlet.NSServletRunner.ServiceWebApp
(NSServletRunner.java:959)   at 
com.iplanet.server.http.servlet.NSServletSession.internalRedirect(Native 
Method)   at com.iplanet.server.http.servlet.NSRequestDispatcher.forward
(NSRequestDispatcher.java:48)   at 
org.apache.struts.actions.ForwardAction.execute(ForwardAction.java:158)   at 
org.apache.struts.action.RequestProcessor.processActionPerform
(RequestProcessor.java:446)   at 
org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:266)   
at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1292)   
at org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:492)   at 
javax.servlet.http.HttpServlet.service(HttpServlet.java:740)   at 
javax.servlet.http.HttpServlet.service(HttpServlet.java:853)   at 
com.iplanet.server.http.servlet.NSServletRunner.invokeServletService
(NSServletRunner.java:897)   at 
com.iplanet.server.http.servlet.WebApplication.service
(WebApplication.java:1059)   at 
com.iplanet.server.http.servlet.NSServletRunner.ServiceWebApp
(NSServletRunner.java:959)   , root cause: javax.servlet.jsp.JspException   at 
org.apache.struts.taglib.bean.MessageTag.doStartTag(MessageTag.java:298)   at 
_jsps._pages._Welcome_jsp._jspService(_Welcome_jsp.java:89)   at 
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:119)   at 
javax.servlet.http.HttpServlet.service(HttpServlet.java:853)   at 
org.apache.jasper.servlet.JspServlet$JspServletWrapper.service
(JspServlet.java:248)   at 
org.apache.jasper.servlet.JspServlet$JspServletWrapper.access$6
(JspServlet.java:238)   at org.apache.jasper.servlet.JspServlet.serviceJspFile
(JspServlet.java:519)   at org.apache.jasper.servlet.JspServlet.service
(JspServlet.java:588)   at javax.servlet.http.HttpServlet.service
(HttpServlet.java:853)   at 
com.iplanet.server.http.servlet.NSServletRunner.invokeServletService
(NSServletRunner.java:897)   at 
com.iplanet.server.http.servlet.WebApplication.service
(WebApplication.java:1059)   at 
com.iplanet.server.http.servlet.NSServletRunner.ServiceWebApp
(NSServletRunner.java:959)   at 
com.iplanet.server.http.servlet.NSServletSession.internalRedirect(Native 
Method)   at com.iplanet.server.http.servlet.NSRequestDispatcher.forward
(NSRequestDispatcher.java:48)   at 
org.apache.struts.actions.ForwardAction.execute(ForwardAction.java:158)   at 
org.apache.struts.action.RequestProcessor.processActionPerform
(RequestProcessor.java:446)   at 
org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:266)   
at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1292)   
at org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:492)   at 
javax.servlet.http.HttpServlet.service(HttpServlet.java:740)   at 
javax.servlet.http.HttpServlet.service(HttpServlet.java:853)   at 
com.iplanet.server.http.servlet.NSServletRunner.invokeServletService
(NSServletRunner.java:897)   at 
com.iplanet.server.http.servlet.WebApplication.service
(WebApplication.java:1059)   at com.iplanet  

Line 298 of org.apache.struts.taglib.bean.MessageTag seemed to be the 
offending line, and it seemed to indicate that the web app was unable to find 
the application.properties file to load the message resources. After changing 
the struts-config.xml file to have 

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

I did not get the error but I got te following web page :

???en_AU.welcome.heading???
???en_AU.welcome.message???

Which confirmed that the web app is not able to load the properties file. I 
tried the following things with no success:

1. Put the web-inf/classes/resources/application.properties on the JVM 
classpath.
2. move application.properties one level up to web-inf/classes in case the 
classloader did not like being in resources ( modify struts-config.xml at the 
same time of course).
3. Put application.properties in a jar file and put it in the web-inf/lib 
directory.
4. I noticed that the struts.jar file had a classpath defined in the manifest. 
I removed the classpath out of the manifest in case it was confusing the 
classloader. 
5. etc......

I downloaded a copy of the source and had a look at the code. The problem had 
to be in org.apache.struts.util.PropertyMessageResources, since it was the one 
locating the properties file and loading the messages. Since the 1.0.2 
examples and applications work fine I downloaded the 1.0.2 source code. The 
loadLocale method was different between the two versions. The 1.1 beta2 source 
was loading the properties file as follows:

        try {
            if (log.isTraceEnabled()) {
                log.trace("  Loading resource '" + name + "'");
            }
            ClassLoader classLoader =
                Thread.currentThread().getContextClassLoader();
            if (classLoader == null) {
                classLoader = this.getClass().getClassLoader();
            }
            is = classLoader.getResourceAsStream(name);
            if (is != null) {
                props.load(is);
                is.close();
            }
            if (log.isTraceEnabled()) {
                log.trace("  Loading resource completed");
            }
        } catch (Throwable t) {
            log.error("loadLocale()", t);
            if (is != null) {
                try {
                    is.close();
                } catch (Throwable u) {
                    ;
                }
            }
        }

The 1.0.2 loadLocale method did as follows:

        // Load the specified property resource
        try {
            is = this.getClass().getClassLoader().getResourceAsStream(name);
            if (is != null) {
                props.load(is);
                is.close();
            }
        } catch (Throwable t) {
            if (is != null) {
                try {
                    is.close();
                } catch (Throwable u) {
                    ;
                }
            }
        }

The difference being             

ClassLoader classLoader =
                Thread.currentThread().getContextClassLoader();

I modified the Struts 1.1 PropertyMessageResources class to work the same as 
the 1.0.2 version and deployed the new struts jar file. The blank application 
worked fine with no problems. It seems that the Thread.currentThread
().getContextClassLoader(); call does not work well under Iplanet 6. 

What is the reason for using the different call in 1.1. Could we change Struts 
1.1 to work under Iplanet 6, by removing the Thread.currentThread
().getContextClassLoader(); line. Has anybody got this working under Iplanet 
Web Server 6 without doing what I had to do? We are using struts 1.0.2 for a 
few applications and would like to upgrade to 1.1 when it is available. 
Basically unless this is fixed no struts application will work under Iplanet 
Web Server 6. 

Regards,

Ziad Haidar.

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

Reply via email to