wood burning stoves 2.0*
The moose likes Struts and the fly likes WAS 5.1 using Struts 1.2.9 - commons-logging issue Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "WAS 5.1 using Struts 1.2.9 - commons-logging issue" Watch "WAS 5.1 using Struts 1.2.9 - commons-logging issue" New topic
Author

WAS 5.1 using Struts 1.2.9 - commons-logging issue

Jason Berk
Ranch Hand

Joined: May 03, 2006
Posts: 41
has anyone gotten WAS 5.1 + Struts 1.2.9 working together?

I'm getting bit (I think) by WAS's forced loading of the commons-logging.jar:

Caused by: org.apache.commons.logging.LogConfigurationException:
The chosen LogFactory implementation does not extend LogFactory.
Please check your configuration.
(Caused by java.lang.ClassCastException:
com.ibm.ws.commons.logging.TrLogFactory)
at org.apache.commons.logging.LogFactory$2.run(LogFactory.java:574)

I fear this older version of WAS has a different version of the commons-logging.jar that struts 1.2.9 was built against.

I have the log4J jar in the EAR also. Is there some way I can tell the commons-logging used inside the WAS container (that I have no control over?) to use a specified LOG4J factory.

Jason


Caused by: org.apache.commons.logging.LogConfigurationException: The chosen LogFactory implementation does not extend LogFactory. Please check your configuration. (Caused by java.lang.ClassCastException: com.ibm.ws.commons.logging.TrLogFactory)
at org.apache.commons.logging.LogFactory$2.run(LogFactory.java:574)
at java.security.AccessController.doPrivileged(Native Method)
at org.apache.commons.logging.LogFactory.newFactory(LogFactory.java:517)
at org.apache.commons.logging.LogFactory.getFactory(LogFactory.java:308)
at org.apache.commons.logging.LogFactory.getLog(LogFactory.java:351)
at at org.apache.struts.util.MessageResources.<clinit>(MessageResources.java:57).null(Unknown Source)
... 40 more
Caused by: java.lang.ClassCastException: com.ibm.ws.commons.logging.TrLogFactory
at org.apache.commons.logging.LogFactory$2.run(LogFactory.java:531)
[ June 19, 2006: Message edited by: Jason Berk ]
Merrill Higginson
Ranch Hand

Joined: Feb 15, 2005
Posts: 4864
Jason,

I'm afraid I'm not much help here. My client also uses WebSphere Application Server Version 5.1.2, but their policy is that all applications have to be built to use Struts 1.1, so they don't have this issue.

You might be able to get around the issue, though, by just using the log4j API in your applications and avoiding the use of commons.logging APIs.


Merrill
Consultant, Sima Solutions
Jason Berk
Ranch Hand

Joined: May 03, 2006
Posts: 41
Merrill,

http://jakarta.apache.org/commons/logging/troubleshooting.html


Some containers use a custom LogFactory implementation to adapt JCL to their particular logging system. This has some important consequences for the deployment of applications using JCL within these containers.

Containers known to use this mechanism:
* WebSphere Application Server from IBM (versions 5 and 6).


If you want to continue to use the default container mechanism then:
* Find and replace the commons-logging implementation used by the container with the most modern release
(NOT POSSIBLE FOR BUSINESS REASONS)

* Replace the commons-logging jar in the application with the commons-logging-adapters jar. This will ensure that application classloader will delegate to it's parent when loading LogFactory.
(WORKED LIKE A CHAMP)


only hitch is that we had to rename "commons-logging-adapters.jar" to
"commons-logging.jar" to match the struts.jar manifest.

Now I have WARs using struts 1.2.9 running on WAS5.1

jason
Merrill Higginson
Ranch Hand

Joined: Feb 15, 2005
Posts: 4864
Jason,

Thanks for posting your solution. Now hopefully someone running into the same problem can find the answer by searching this forum.

Merrill
S Rangwani
Greenhorn

Joined: Sep 04, 2006
Posts: 1
A test environment update also fixes the problem. There is a fix pack available on the IBM website (V6.0.2.5)

Cheers
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: WAS 5.1 using Struts 1.2.9 - commons-logging issue