MehtaJasmin
asked on
Enablin org.apache.commons.logging for Weblogic 10.3.6
In our enterprise, we're encountered the requirement to move out J2EE applications to Weblogic 10.3.6. Unfortunately, these applications are using several public libraries and tools that all use Apache Commons Logging (org.apach.commons.logging .*) in order to write their output to log files. Since deploying the applications to Weblogic, the libraries that use this logging are no longer outputting information. We've tried adding the jar file to the claspath, but that didn't work. I've read that the Apache commons logging is not included by default with the Weblogic server release, but that it can be enabled. The only question is, how?
How do we enable the use of Appache commons logging (org.apache.commons.loggin g.*) for use in Weblogic 10.3.6?
Thanks in advance.
How do we enable the use of Appache commons logging (org.apache.commons.loggin
Thanks in advance.
ASKER
I'd seen a similar piece of documentation, that was structured a bit differently. The ones I'd seen before made it seem like in addition to setting the property above, you also had to set it in all your code, which wasn't an option because we're using a lot of public libraries as well that aren't customized in our application. However, this document makes it sound like setting it in a server-wide property works as well.
The followup question, since I'm not as knowledgable when it comes to the server setup is, where do you set the '-Dorg.apache.commons.logg ing.LogFac tory= weblogic.logging.commons.L ogFactoryI mpl' property? Is it in the weblogic startup script? Or is it in some other xml or properties file?
The followup question, since I'm not as knowledgable when it comes to the server setup is, where do you set the '-Dorg.apache.commons.logg
Is it in the weblogic startup script?
Yes it's a Java argument you can set it JAVA_OPTIONS:
In startweblogic.cmd (on Windows system) or startweblogic.sh, JAVA_OPTIONS was set like that:
SET JAVA_OPTIONS=-Dorg.apache. commons.lo gging.LogF actory= weblogic.logging.commons.L ogFactoryI mpl
You will find already some of such options in that script. Thanks.
Yes it's a Java argument you can set it JAVA_OPTIONS:
In startweblogic.cmd (on Windows system) or startweblogic.sh, JAVA_OPTIONS was set like that:
SET JAVA_OPTIONS=-Dorg.apache.
You will find already some of such options in that script. Thanks.
ASKER
The DBA's tried adding it to the export JAVA_OPTIONS set in the startup script, and they got the following error:
Exception in thread "main" java.lang.NoClassDefFoundE rror: weblogic.logging.commons.L ogFactoryI mpl
Caused by: java.lang.ClassNotFoundExc eption: weblogic.logging.commons.L ogFactoryI mpl
at java.net.URLClassLoader.fi ndClass(UR LClassLoad er.java:45 7)
at java.lang.ClassLoader.load Class(Clas sLoader.ja va:676)
at sun.misc.Launcher$AppClass Loader.loa dClass(Lau ncher.java :358)
at java.lang.ClassLoader.load Class(Clas sLoader.ja va:642)
Could not find the main class: weblogic.logging.commons.L ogFactoryI mpl. Program will exit.
Exception in thread "main" java.lang.NoClassDefFoundE
Caused by: java.lang.ClassNotFoundExc
at java.net.URLClassLoader.fi
at java.lang.ClassLoader.load
at sun.misc.Launcher$AppClass
at java.lang.ClassLoader.load
Could not find the main class: weblogic.logging.commons.L
ASKER
The previous exception resolved by adding the "com.bea.core.weblogic.com mons.loggi ng_1.3.0.0 .jar" file in classpath. Now our start script has lines:
But that give errors:
Can you please advise?
Thanks
export CLASSPATH=$CLASSPATH/u2/app/oracle/product/OFM11g/oracle_common/modules/org.apache.commons.logging_1.0.4.jar:/u2/app/oracle/product/OFM11g/modules/com.bea.core.weblogic.commons.logging_1.3.0.0.jar
export JAVA_OPTIONS="-Dweblogic.security.SSL.protocolVersion=TLS1 -Dorg.apache.commons.logging.LogFactory=weblogic.logging.commons.LogFactoryImpl"
But that give errors:
<Mar 22, 2017 12:20:48 PM EDT> <Error> <HTTP> <BEA-101216> <Servlet: "ResourceServlet" failed to preload on startup in Web application: "console".
java.lang.ExceptionInInitializerErro r
at java.lang.J9VMInternals.initialize(J 9VMInterna ls.java:22 1)
at java.lang.J9VMInternals.initialize(J 9VMInterna ls.java:16 6)
at java.lang.J9VMInternals.newInstanceI mpl(Native Method)
at java.lang.Class.newInstance(Class.ja va:1688)
at weblogic.servlet.internal.WebCompone ntContribu tor.getNew Instance(W ebComponen tContribut or.java:22 5)
Truncated. see log file for complete stacktrace
Caused By: org.apache.commons.logging.LogConfig urationExc eption: The chosen LogFactory implementation does not extend LogFactory. Please check your configuration. (Caused by java.lang.ClassCastExcepti on: weblogic.logging.commons.L ogFactoryI mpl incompatible with org.apache.commons.logging .LogFactor y)
at org.apache.commons.logging.LogFactor y$2.run(Lo gFactory.j ava:574)
at java.security.AccessController.doPri vileged(Ac cessContro ller.java: 359)
at org.apache.commons.logging.LogFactor y.newFacto ry(LogFact ory.java:5 17)
at org.apache.commons.logging.LogFactor y.getFacto ry(LogFact ory.java:2 54)
at org.apache.commons.logging.LogFactor y.getLog(L ogFactory. java:351)
Truncated. see log file for complete stacktrace
Caused By: java.lang.ClassCastException: weblogic.logging.commons.L ogFactoryI mpl incompatible with org.apache.commons.logging .LogFactor y
at org.apache.commons.logging.LogFactor y$2.run(Lo gFactory.j ava:569)
at java.security.AccessController.doPri vileged(Ac cessContro ller.java: 359)
at org.apache.commons.logging.LogFactor y.newFacto ry(LogFact ory.java:5 17)
at org.apache.commons.logging.LogFactor y.getFacto ry(LogFact ory.java:2 54)
at org.apache.commons.logging.LogFactor y.getLog(L ogFactory. java:351)
Truncated. see log file for complete stacktrace
Can you please advise?
Thanks
ASKER
Can someone please provide help for my question? Thanks
This question needs an answer!
Become an EE member today
7 DAY FREE TRIALMembers can start a 7-Day Free trial then enjoy unlimited access to the platform.
View membership options
or
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.
This can be because of many different reasons, are you seeing any errors in the weblogic console logs? Verify that first.
You should follow the guidelines from this link: http://docs.oracle.com/cd/E11036_01/wlevs20/config_server/logging.html you can override logfactory to ensure the logging the logging is working.
-Dorg.apache.commons.loggi