aspose file tools*
The moose likes Struts and the fly likes Struts WebSphere JavascriptValidatorTag Exception Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Struts WebSphere JavascriptValidatorTag Exception" Watch "Struts WebSphere JavascriptValidatorTag Exception" New topic
Author

Struts WebSphere JavascriptValidatorTag Exception

Dave Hayward
Greenhorn

Joined: Feb 28, 2007
Posts: 14
Hey all -
I am new to these parts, but you seem to have more knowledge about Struts than I can find anywhere else. I'm hoping someone can point me to the right place to solve my current dilemma.

I have had my application running on WebSphere 5.1 for over a year, and now I am looking into upgrading to WebSphere 6.1. I am able to get all of my application running except for the modules(projects) that use struts. This is the error I'm getting:

This error shows up on all pages where I have the struts javascript validator code, like this:

I have been talking with IBM support and it may be a classloader issue. However, I don't know anything about modifying my classloader so that the Struts Validator will work. My pages written in struts that don't use the html:javascript seem to work ok (knock on wood).

The worst part is that I don't know what version of Struts we are using. I think it is Struts 1.1 - but I don't know for sure.

Any response, even dumb looks, are greatly appreciated. I am really stumped here and need a new perspective.

Thanks a ton (and in advance too).


The worst thing with having everything is finding a place in the garage to keep it.
Merrill Higginson
Ranch Hand

Joined: Feb 15, 2005
Posts: 4864
Dave,

Welcome to JavaRanch! I notice you've already answered someone else's question, which is a good way to get started. We hope you'll come and visit us once in a while. We always need more knowledgeable, friendly people willing to share their knowledge with the forum.

Now for your question: I'm afraid I don't have the answer, but here is some information.

First of all, I use WebSphere as well, and I've discovered that WSAD, RAD, and RSA all use Struts version 1.1 in their tooling, so that's probably the version you are using unless you've done something to change it. WebSphere will support later versions of Struts, but if you use a later version, the tooling in RAD sometimes gives "false alarm" errors that aren't really errors.

Secondly, I have a copy of the source code for Struts 1.1, and here is the section of code that is failing:


Since the error you're getting is a NPE on line 316, it's clear that the ValidatorResources is null. Why it's null, I couldn't tell you. You may be able to figure it out by downloading the source code and attaching it to the Struts jar file and running it in the debugger.

One thing that could cause this would be having an inconsistent Struts environment. Make sure that all the jar files in your /lib directory all come from the same Struts download.

Good luck!
[ February 28, 2007: Message edited by: Merrill Higginson ]

Merrill
Consultant, Sima Solutions
Dave Hayward
Greenhorn

Joined: Feb 28, 2007
Posts: 14
Hi Merrill - Wow, great to hear from the SysAdmin

This is more detail that IBM has been able to give me in over a month of research. I will DEFINATELY get the source so that I can debug struts.

What I am thinking is that the WAS Admin Console was written in a different version of Struts (like Struts2), but since RAD only supports Struts 1.1 I am in kind of a pickle. You would think the WebSphere team would have created their Admin Console with RAD but I guess not (it isn't a requirement to use their own in house tools) ... but I digress. Can you tell I am just a little bit frustrated with IBM support?

RAD actually doesn't give me any errors. I am pretty sure that I am still using Struts 1.1 for my application (on a count that I don't have access to the "ValidWhen" rule).

IBM did suggest that my problem has something to do with the classloader. You see if I set the "server1" classloader policy to "Multiple (Module)" then I can get my application to work correctly, but the WAS Admin Console will not load. If I set the classloader policy on "server1" back to the default "Single (Application)" then the Admin Console will work, but the struts projects in my application all give that same error listed above.

One other thing I noticed while debugging - I use my own RequestProcessor as defined in the struts-config.xml

However, even though I set a breakpoint and called a page that doesn't utilize the html:javascript tag, my "CareRequestProcessor" was never called. Could this also be a wrinkle caused by having an inconsistent struts environment?

Sorry for so many questions - I'll go see if I can help more users and make up for it.
Merrill Higginson
Ranch Hand

Joined: Feb 15, 2005
Posts: 4864
From what you describe, it sounds as if the problem may be that the Admin Console is using a later version of Struts than your application. Since the classloader may be loading some artifacts from a later Struts version, these are possibly conflicting with your Struts 1.1 artifacts.

One thing I suspect may solve the problem would be to find out for sure which version of Struts the Admin Console is using and then upgrade your application to the same version. This would involve changing all the Struts jar files in your /lib folder as well as changing the DTD references in all the XML files. Once you change the DTD references, this may expose other items in your XML files that need changing as well.

Regarding your question about the RequestProcessor: The RequestProcessor is not invoked when you call a JSP directly (e.g.. myapp/mypage.jsp ). It's only invoked when you call an action url (e.g. myapp/myAction.do). So, I don't see it as a problem that the RequestProcessor was not invoked when you displayed a particular JSP.
Dave Hayward
Greenhorn

Joined: Feb 28, 2007
Posts: 14
Sorry to not explain fully - I do not call JSPs directly. Our application always calls Actions (whether from Global Forwards, or Local Forwards). So my CareRequestProcessor should be called. It is used to override the processRoles() and processValidate() methods.

I am trying to find out what version of Struts the WebSphere 6.1 Admin Console uses. If it uses Struts2, is that a difficult upgrade? Is there a good tutorial or checklist for upgrading? My boss is really getting anxious about my lack of results. I've been on this upgrade to WAS 6.1 for over 3 months now (upgrade OS (AIX), WebSphere, IDE from WSAD 5.1.2 to Rational 7, etc), and this struts issue is the final hurdle. I hate being so close but so far.
Merrill Higginson
Ranch Hand

Joined: Feb 15, 2005
Posts: 4864
I still wouldn't be concerned that your breakpoint wasn't hit. Since you only overrode two methods, all it means is that in that particular case, neither of those methods happened to be invoked.

Regarding the version of Struts used by the Admin Console, I'd be extremely surprised if they used Struts 2. The first general (non-beta) release of Struts 2 came out about a week ago. Do you honestly think that a company still using Struts 1.1 in its development environment is going to jump that far ahead in its Admin Console? I think not. My guess would be one of the 1.2.x releases.. probably 1.2.7. The upgrade process to this release would be just what I described above. I doubt you'd have to change anything in your JSPs at all.
Dave Hayward
Greenhorn

Joined: Feb 28, 2007
Posts: 14
Well - good and bad news. I found that the version of Struts the WAS Admin Console is using is 1.1. Same as what I'm using. SO WHY WON'T IT WORK!!!

Good and bad - that is all this upgrade project has been for me. I really can't wait to get back to developing.

I really appreciate your taking the time to help me out here Merrill. I will try to help out others here when they have questions that I know something about. Your patience and desire to help speaks volumes.

You know - when my websphere server starts up it has a number of errors in the log. Here is a sample:

IBM said that there is something going on in that "System Out in ModuleConfigXmlParser" I believe that is a struts class, but it is not in the source code that I downloaded. Am I barking up the wrong tree with this, or could this be the root of the problem?

If you just want me to go away - let me know.

THANKS TONS AGAIN FOR ALL YOUR HELP!!!
MONICA MALDONADO
Greenhorn

Joined: Oct 16, 2007
Posts: 1
Hello,


I have the same problem that you explained in march with struts and Websphere 6.1. Could you please tell me if you could solve the problem and what did you do?? Thanks!!!

Here you have my log errors:

10/16/07 12:43:01:305 CEST] 00000014 WebGroup A SRVE0169I: Loading Web Module: portal.war.
[10/16/07 12:43:02:788 CEST] 00000014 SystemOut O [2007-10-16 12:43:02,788|FATAL|server.startup : 1 |net.sf.navigator.menu.MenuContextListener] Failure initializing struts-menu: Error parsing resource file: /WEB-INF/menu-config.xml nested exception is: null
[10/16/07 12:43:02:998 CEST] 00000014 SystemOut O In ModuleConfigXmlParser parse Exception occurred java.lang.NumberFormatException: null

....

[10/16/07 12:43:03:354 CEST] 00000014 ApplicationMg A WSVR0204I: Application: filetransfer Application build level: Unknown
[10/16/07 12:43:04:415 CEST] 00000015 SystemOut O In ModuleConfigXmlParser parse Exception occurred java.lang.NumberFormatException: null
[10/16/07 12:43:04:457 CEST] 00000015 ServletWrappe I SRVE0242I: [modelo791] [/PAC] [action]: Initialization successful.
James Ward
Ranch Hand

Joined: Apr 27, 2003
Posts: 263
I have this exact same problem.
Any help is greatly greatly appreciated.

Thanks.
James Ward
Ranch Hand

Joined: Apr 27, 2003
Posts: 263
Hello,

I resolved my following problem (which is also discussed above):

java.lang.NumberFormatException: null[3/1/07 15:36:50:711 MST] 00000019 SystemErr R at java.lang.Integer.parseInt(Integer.java:449)[3/1/07 15:36:50:711 MST] 00000019 SystemErr R at java.lang.Integer.<init>(Integer.java:654)[3/1/07 15:36:50:711 MST] 00000019 SystemErr R at org.apache.struts.action.ModuleConfigXmlParser.startElement(ModuleConfigXmlParser.java:294)

Basically i decompiled the ModuleConfigXmlParser class present in struts.jar being used by WebSphere and looked inside the startElement method. The code was clearly looking for the following in struts config file:

1. in the controller element debug attribute (integer)was expected.(so i gave something like debug="3").
2. in the form-bean element size attribute (integer)was expected. (so i gave something like size="1000" ).

And the error went away. I don't really know why these attributes are compulsory, but it worked.

Additional Note: Also note that i have deployed my application in WebSphere 6.0, which itself uses struts 1.1. And when i deployed 'my' struts based application which uses struts 1.2.7; but i was never able to resolve my struts version colliding with websphere's own struts version.. so i just got rid of my strtus jars from web-inf\lib, and let websphere's struts come into play. So clearly these issues have to do with using a struts config file meant for one version but using it with another version of struts jar.
Dave Hayward
Greenhorn

Joined: Feb 28, 2007
Posts: 14
Sorry it took so long to get back to you. You had asked how I solved my issue. I ended up calling IBM and they suggested changing the Server Level Application Classloader Policy to "Multiple". This allowed each individual application to use it's own classloader.

Apparently the internal WebSphere application for the admin console uses Struts and it was loading it's own classes first. These were then confusing my struts application to use the wrong classloader and that is why my struts applications failed to run when all the non-struts worked fine.

I'm glad you figured out your issue. It seems that having to decompile the XMLParser.java inside the struts.jar is a lot of work. We are using Struts v1.1 - so I didn't need to go to such extremes.

Good luck - everything is working well for us now - I hope your success is the same.
Pushpa MD
Greenhorn

Joined: Dec 19, 2008
Posts: 1
I am using WAS 6.1 in IBM Tivoli Integrated Portal 1.1
It uses struts 1.1. My application war uses Struts1.2. When I deploy the war file and run the classloader in PARENT_LAST mode i expect that my application's class files will be loaded last.
But looks like thats not happening.
I get the error in SystemOut.log
[12/21/08 21:54:54:570 PST] 0000002c SystemOut O In ModuleConfigXmlParser parse Exception occurred java.lang.NumberFormatException: null

I see that by adding "debug=3" in controller of struts-config.xml, we can solve this problem in 1.1. But I am using Struts 1.2? debug is removed in 1.2 web page. Then why am I getting this error. I am really clueless as to how to solve this. Any help is really appreciated.

Along with this I see error like

Are these both related? Please give some pointers.
David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

Please start your own new thread-this thread is over a year old and a different issue.
 
Consider Paul's rocket mass heater.
 
subject: Struts WebSphere JavascriptValidatorTag Exception