RE: The Continuing Misadventures of Struts in WebSphere - VICTORY!!!!!!!
After quite a bit of effort, I have finally gotten the Struts example to work flawlessly in WebSphere 3.5.3. What's funny is that I was reading your post Richard and was thinking to myself: "Gee, I've done ALL of this EXACTLY -- in fact I'm even on the same OS, just different drive letters, WHAT could be wrong??" Then it hit me, looking through your steps below I found the one thing that was different that had completely slipped through - jaxp 1.0.1. I was using jaxp 1.1.1!! Crimson is a separate jar now, that includes the stuff from parser.jar, but it apparently does something different then 1.0.1 and it was just screwing everything up! I downloaded 1.0.1 and got significantly further then I ever have, but ran into another problem. WebSphere reported that the public identifiers for the DTD's were malformed URLs. Luckily, I saw on another mailing list an issue with WebSphere & Struts not liking PUBLIC DTD refs, so I changed them to SYSTEM and away it flew - flawlessly. For those people who run into these issues (and because I have to document it for work anyway - here is Richard's list again revised with more detail on some of the bugs I encountered. (BTW, adding web to the classpath did not help me, I had to move it to the servlets directory). Server: Windows 2000 Server with WebSphere 3.5.3 Advanced 1. Start up the adminserver. 2. Start up Admin Console. 3. Use the Convert War file task to convert the struts-example.war from the struts-b1 distrib as-is. 4. Convert to the default_server, default servlet engine and standard install directory (c:\websphere\appserver\hosts\default_host). 5. Create a WEB-INF directory in the servlets dir and copy struts-config.xml, database.xml AND web.xml into it (Keep WEB-INF with all the TLD's under web - both WEB-INF directories must be present). 6. Copy jaxp 1.0.1's (NOT 1.1.1's) jaxp.jar and parser.jar to the servlets directory of the strut-example webapp. 7. In the servlets directory, open struts.jar with WinZip. Extract the three DTD's (struts-config_1_0.dtd, web-app_2_2.dtd and web-app_2_3.dtd) into the servlets directory making sure you use folder names (so the files extract to servlets/org/apache/struts/resources). 8. Click on struts-example in the Admin Console under Default Server/Default Servlet Engine and click the advanced tab on the right hand side of the screen. 9. Down where it says Default Error Page, enter /ErrorReporter and then click Apply. 10. Start the Default Server via the Admin Console. You should see a whole bunch of ActionServlet messages in the default_host_stdout.log file with no exceptions. 11. Via a browser accessed the app using http://localhost/struts-example/index.jsp. 12. If it returns "Application not Available" then go back to the Admin Console, right-click on struts-example and select Restart WebApp. 13. Once it reports success, go back to the URL above and try again - it should work flawlessly. For whatever reason, some installations do not like XML files that reference PUBLIC DTD's - if in looking at the default_host_stdout.log file you see errors about invalid public URL references during DTD registrations, or if your pages say "cannot find //logon or //saveRegistration (ie. action mappings) then do the following: 1. Stop Default Server 2. Go to servlets\WEB-INF\ and edit web.xml and struts_config.xml. 3. In the DOCTYPE declaration, change the word PUBLIC to SYSTEM and completely remove the line that reads "-//Sun Microsystems, Inc.//DTD Web Application 2.2//EN" from web.xml and remove "-//Apache Software Foundation//DTD Struts Configuration 1.0//EN" from struts-config.xml. 4. Save these changes and go back to step 10 above. Just as a troubleshooting guide - If you are getting errors like "Cannot find ActionMappings, etc..." or "Cannot find key org.apache.struts.MESSAGE" then your application is most likely still bombing on the struts-config issue that Richard discovered. The above steps SHOULD correct that leaving nothing out. If you are getting 404 errors about //logon or something not found, then you are still having XML config troubles and it is not initializing the Action servlet properly. Follow the steps above in regards to DTD's and it should work. As a final thought, I obviously haven't gotten to test too much but I don't believe that there are ANY coding changes that need to be made to the actual struts source. Everything about getting it to work in WebSphere has been a WebSphere configuration issue thus far (and I don't think I'll be having any more). Thanks for your help Richard and I hope others benefit from this as well! :) Chris Assenza
Re: The Continuing Misadventures of Struts in WebSphere
Chris, The fact that you can't get the struts-example war to work in 3.5.3 seems to indicate that there is an environment problem. The message I posted yesterday was from the observations I made while getting the struts-example up and running on WebSphere 3.5.3 on Windows 2000. Here are the steps I took to get it working : 1. Start up the adminserver. I used adminserver.bat in the bin/debug directory. 2. Start up adminconsole. 3. Use the Convert War file task to convert the struts-example.war. I used the struts-example.war as-is from the struts-b1 distrib. 4. I converted to the default_server, default servlet engine and standard install directory (c:\websphere\appserver\hosts\default_host). 5. Once the convert was finished I added the doc root directory to the classpath for the webapp. (Added c:\websphere\appserver\hosts\default_host\struts-example\ web). This was via the adminconsole. Alternatively you can just create a WEB-INF directory in the servlets dir and copy the struts-config.xml and database.xml. 6. Copied jaxp 1.0.1 jaxp.jar and parser.jar to the servlets directoy of the strut-example webapp. 7. Copied the three dtds from the struts lib directory to the servlets/org/apache/struts/resources directory. (I had to create the resources dir) 8. Started the default_server via the adminconsole. (I had not started it previously.) You should see a whole bunch of ActionServlet messages in the default_host_stdout.log file with no exceptions. 9. Via a browser accessed the app using http://localhost/struts-example/index.jsp. (Welcome file setup did not work.) You did not say why you could not get the parser.jar to work and why you had to use crimson. If you can't get the struts-example working then I don't think you stand much chance with your own app. Have you tried on a different server. Could you try with 3.5.2. The steps I described should apply to this also. You can send me your default_host_stdout.log and I'll take a look at it. Richard Quoting "Assenza, Chris" <[EMAIL PROTECTED]>: > All - > > I'm begging for help here! :\ I have to get this working in WS tomorrow > or > we're going to drop using Struts in our app and that would THOROUGHLY > suck. > Here's the most detailed info I can provide - thank you all in advance. > > 1) Current Environment: >- Development: JBoss 2.0 w/ Tomcat 3.2b7 >- Production: WebSphere 3.5.3 Advanced Server >- Struts Milestone Build: 1.0b1 > > 2) Situation: >- Using struts-example.war, we deploy simply in JBoss with 100% > success. >- Using our own struts app (just a test build of one screen from > front > end to EJB), we deploy in JBoss with 100% success. > > 3) Problem: >- Porting struts-example.war to WebSphere 3.5.3 fails. >- Porting our own War fails in WS as well. > > 4) Steps Taken: >- Converted the struts-example.war file through the Converter tool in > WS. >- Deployed to default_host/struts_example >- Added latest jaxp.jar, crimson.jar (the example seems to need > crimson > not parser), and xalan.jar (for good measure) to servlets directory >- Created WEB-INF directory under servlets - placed struts-config.xml > and > database.xml inside. >- Started Server >- Server starts successfully in console. >- Error log shows that initializing database servlet bomb on uncaught > SAX > exceptions from Crimson (database: Database load exception": > org.xml.sax.SAXNotRecognizedException: Feature: > http://xml.org/sax/features/raw-names) >- No other errors shown. >- Visit IP/struts-example/index.jsp >- Error: Application not available >- Oddly enough if you go to the admin console, right click on > struts-example and say restart webapp and try again, it works - > returning > the following error message. >- Uncaught servlet exception thrown: (see it for yourself > http://209.114.152.157/struts-example/index.jsp if you are interested) > >...ServletInstan X Uncaught service() exception thrown by servlet > {0}: > {1} > "jsp11" > javax.servlet.ServletException: Cannot find message resources under > key org.apache.struts.action.MESSAGE at > javax.servlet.ServletException.(ServletException.java:161) > -- >- Error log shows no errors in addition to this. (I have to wonder > why > the heck it is still trying for org.apache.struts.action.MESSAGE versus > the > file we initialize in the startup params) > > 5) Analysis >I went through the Struts source to identify what might cause this > and > studied the interaction between web.xml (and the init params) along with > how > ActionServlet gets this parameter and then assigns the key value in > Action. > Realizing that web.xml is used to configure the WS console on > conversion, I > checked out the console settings to ensure that "application" was being > set > to "org.apache.struts.example.ApplicationResources" -- it was. > > At this point I'm clueless, I actually DID NOT have this
Re: The Continuing Misadventures of Struts in WebSphere
Here's what someone posted to this list just yesterday: I have some additional information for anyone trying to run struts 1.0 based apps with WebSphere 3.5.2/3: There two main issues that have come up with the move from 0.5 to 1.0 1. The call to ServletContext.getResourceAsStream() in ActionServlet fails to find the "/WEB-INF/struts-config.xml" file. This is because the call is directed to the WebApps classloader to find the resource and it looks for it on its classpath. The ConvertWar Tool copies the WEB-INF directory to the web directory which is not on the classpath and thus it fails to find it. Solution : Either put the web directory (or doc root directory) on the webapps classpath. You can do this via the Admin Console. Or you can make a directory in your servlets directory called WEB-INF and place the struts-config.xml in there. You should NOT have to make code changes to ActionServlet. 2. The struts-config.xml,web-app_2_2.dtd,web-app_2_3.dtd cannot be loaded from the struts.jar. It seems there is a bug with the classloader for loading resources out of jar files. Solution. Create a directory in your servlets directory called org/apache/struts/resources and place the dtds in there. (Or package them up in your war file off of the classes directory and the convertwar tool should copy them for you. The classloader should now find them. Additionally I also found that welcome files don't seem to be picked up. When running the struts-example I could not use just /struts-example but /struts-example/index.jsp worked fine. By using this steps I was able to get the struts-example war working fine. I did have to copy the database.xml file to the new WEB-INF directory on the classpath too. Additionally : The details about copying jaxp.jar and parser.jar to the servlets directory (or placed in the war lib directory) still applies. Richard Backhouse Hope that helps, Donnie >>> [EMAIL PROTECTED] 03/27/01 04:52PM >>> All - I'm begging for help here! :\ I have to get this working in WS tomorrow or we're going to drop using Struts in our app and that would THOROUGHLY suck. Here's the most detailed info I can provide - thank you all in advance. 1) Current Environment: - Development: JBoss 2.0 w/ Tomcat 3.2b7 - Production: WebSphere 3.5.3 Advanced Server - Struts Milestone Build: 1.0b1 2) Situation: - Using struts-example.war, we deploy simply in JBoss with 100% success. - Using our own struts app (just a test build of one screen from front end to EJB), we deploy in JBoss with 100% success. 3) Problem: - Porting struts-example.war to WebSphere 3.5.3 fails. - Porting our own War fails in WS as well. 4) Steps Taken: - Converted the struts-example.war file through the Converter tool in WS. - Deployed to default_host/struts_example - Added latest jaxp.jar, crimson.jar (the example seems to need crimson not parser), and xalan.jar (for good measure) to servlets directory - Created WEB-INF directory under servlets - placed struts-config.xml and database.xml inside. - Started Server - Server starts successfully in console. - Error log shows that initializing database servlet bomb on uncaught SAX exceptions from Crimson (database: Database load exception": org.xml.sax.SAXNotRecognizedException: Feature: http://xml.org/sax/features/raw-names) - No other errors shown. - Visit IP/struts-example/index.jsp - Error: Application not available - Oddly enough if you go to the admin console, right click on struts-example and say restart webapp and try again, it works - returning the following error message. - Uncaught servlet exception thrown: (see it for yourself http://209.114.152.157/struts-example/index.jsp if you are interested) ...ServletInstan X Uncaught service() exception thrown by servlet {0}: {1} "jsp11" javax.servlet.ServletException: Cannot find message resources under key org.apache.struts.action.MESSAGE at javax.servlet.ServletException.(ServletException.java:161) -- - Error log shows no errors in addition to this. (I have to wonder why the heck it is still trying for org.apache.struts.action.MESSAGE versus the file we initialize in the startup params) 5) Analysis I went through the Struts source to identify what might cause this and studied the interaction between web.xml (and the init params) along with how ActionServlet gets this parameter and then assigns the key value in Action. Realizing that web.xml is used to configure the WS console on conversion, I checked out the console settings to ensure that "application" was being set to "org.apache.struts.example.ApplicationResources" -- it was. At this point I'm clueless, I actually DID NOT have this problem in 3.5.2 (just gobs of other ones) but the client we
The Continuing Misadventures of Struts in WebSphere
All - I'm begging for help here! :\ I have to get this working in WS tomorrow or we're going to drop using Struts in our app and that would THOROUGHLY suck. Here's the most detailed info I can provide - thank you all in advance. 1) Current Environment: - Development: JBoss 2.0 w/ Tomcat 3.2b7 - Production: WebSphere 3.5.3 Advanced Server - Struts Milestone Build: 1.0b1 2) Situation: - Using struts-example.war, we deploy simply in JBoss with 100% success. - Using our own struts app (just a test build of one screen from front end to EJB), we deploy in JBoss with 100% success. 3) Problem: - Porting struts-example.war to WebSphere 3.5.3 fails. - Porting our own War fails in WS as well. 4) Steps Taken: - Converted the struts-example.war file through the Converter tool in WS. - Deployed to default_host/struts_example - Added latest jaxp.jar, crimson.jar (the example seems to need crimson not parser), and xalan.jar (for good measure) to servlets directory - Created WEB-INF directory under servlets - placed struts-config.xml and database.xml inside. - Started Server - Server starts successfully in console. - Error log shows that initializing database servlet bomb on uncaught SAX exceptions from Crimson (database: Database load exception": org.xml.sax.SAXNotRecognizedException: Feature: http://xml.org/sax/features/raw-names) - No other errors shown. - Visit IP/struts-example/index.jsp - Error: Application not available - Oddly enough if you go to the admin console, right click on struts-example and say restart webapp and try again, it works - returning the following error message. - Uncaught servlet exception thrown: (see it for yourself http://209.114.152.157/struts-example/index.jsp if you are interested) ...ServletInstan X Uncaught service() exception thrown by servlet {0}: {1} "jsp11" javax.servlet.ServletException: Cannot find message resources under key org.apache.struts.action.MESSAGE at javax.servlet.ServletException.(ServletException.java:161) -- - Error log shows no errors in addition to this. (I have to wonder why the heck it is still trying for org.apache.struts.action.MESSAGE versus the file we initialize in the startup params) 5) Analysis I went through the Struts source to identify what might cause this and studied the interaction between web.xml (and the init params) along with how ActionServlet gets this parameter and then assigns the key value in Action. Realizing that web.xml is used to configure the WS console on conversion, I checked out the console settings to ensure that "application" was being set to "org.apache.struts.example.ApplicationResources" -- it was. At this point I'm clueless, I actually DID NOT have this problem in 3.5.2 (just gobs of other ones) but the client we are developing for agreed to the FixPack 3 upgrade, so now I need only worry about 3.5.3. Please help! :) Chris