设置“java.util.logging.manager”在 weblogic 启动期间给出 ClassNotFoundException
为了实现自定义 loggin ,我重写了 java.util.logging.LogManager 。 现在我需要将“java.util.logging.manager”系统属性指向我的 CustomLogManager 类。
在 jdev 中,可以通过在项目属性中设置 java 选项来实现。 “-Djava.util.logging.manager=project8.CustomLogManager”。
我编辑了 startWebLogic.sh ,并添加了相同的内容。
# START WEBLOGIC
echo "starting weblogic with Java version:"
${JAVA_HOME}/bin/java ${JAVA_VM} -version
if [ "${WLS_REDIRECT_LOG}" = "" ] ; then
echo "Starting WLS with line:"
echo "${JAVA_HOME}/bin/java ${JAVA_VM} ${MEM_ARGS} -Djava.util.logging.manager=project8.CustomLogManager -Dweblogic.Name=${SERVER_NAME} -Djava.security.policy=${WL_HOME}/server/lib/weblogic.policy ${JAVA_OPTIONS} ${PROXY_SETTINGS} ${SERVER_CLASS}"
但是在启动管理服务器时,出现此错误。
weblogic.Server
Could not load Logmanager "project8.CustomLogManager "
java.lang.ClassNotFoundException: project8.CustomLogManager
at java.net.URLClassLoader$1.run(URLClassLoader.java:200)
at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
at java.lang.ClassLoader.loadClass(ClassLoader.java:303)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
at java.lang.ClassLoader.loadClass(ClassLoader.java:248)
at java.util.logging.LogManager$1.run(LogManager.java:167)
at java.util.logging.LogManager.<clinit>(LogManager.java:156)
at java.util.logging.Logger.getAnonymousLogger(Logger.java:342)
at weblogic.kernel.KernelLogManager.createClientLogger(KernelLogManager.java:44)
at weblogic.kernel.KernelLogManager.access$000(KernelLogManager.java:17)
at weblogic.kernel.KernelLogManager$LoggerMaker.<clinit>(KernelLogManager.java:20)
at weblogic.kernel.KernelLogManager.getLogger(KernelLogManager.java:26)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at weblogic.logging.MessageLogger.log(MessageLogger.java:96)
at weblogic.logging.MessageLogger.log(MessageLogger.java:112)
at weblogic.logging.WLMessageLogger.log(WLMessageLogger.java:53)
at weblogic.kernel.T3SrvrLogger.logDomainLibPath(T3SrvrLogger.java:2440)
at weblogic.Server.appendToClassPath(Server.java:129)
at weblogic.Server.intializeClassloader(Server.java:140)
at weblogic.Server.main(Server.java:67)
但与此同时,在那之后我可以看到我的 CustomLogManager.jar 被导入。 我有 CustomLogManager.jar ,位于 /domain-folder/bin/ 下。
<Notice> <WebLogicServer> <BEA-000395> <Following extensions directory contents added to the end of the classpath:
/export/......../CustomLogManager.jar
那么知道如何避免出现 ClassNotFound 错误吗?
提前致谢
In-order to achieve custom loggin , am overriding java.util.logging.LogManager.
Now i need to point "java.util.logging.manager" system property to my CustomLogManager class.
In jdev , its possobie by setting java options in project properties.
"-Djava.util.logging.manager=project8.CustomLogManager" .
I edited the startWebLogic.sh , and added the same.
# START WEBLOGIC
echo "starting weblogic with Java version:"
${JAVA_HOME}/bin/java ${JAVA_VM} -version
if [ "${WLS_REDIRECT_LOG}" = "" ] ; then
echo "Starting WLS with line:"
echo "${JAVA_HOME}/bin/java ${JAVA_VM} ${MEM_ARGS} -Djava.util.logging.manager=project8.CustomLogManager -Dweblogic.Name=${SERVER_NAME} -Djava.security.policy=${WL_HOME}/server/lib/weblogic.policy ${JAVA_OPTIONS} ${PROXY_SETTINGS} ${SERVER_CLASS}"
But while starting the admin server ,am getting this error..
weblogic.Server
Could not load Logmanager "project8.CustomLogManager "
java.lang.ClassNotFoundException: project8.CustomLogManager
at java.net.URLClassLoader$1.run(URLClassLoader.java:200)
at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
at java.lang.ClassLoader.loadClass(ClassLoader.java:303)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
at java.lang.ClassLoader.loadClass(ClassLoader.java:248)
at java.util.logging.LogManager$1.run(LogManager.java:167)
at java.util.logging.LogManager.<clinit>(LogManager.java:156)
at java.util.logging.Logger.getAnonymousLogger(Logger.java:342)
at weblogic.kernel.KernelLogManager.createClientLogger(KernelLogManager.java:44)
at weblogic.kernel.KernelLogManager.access$000(KernelLogManager.java:17)
at weblogic.kernel.KernelLogManager$LoggerMaker.<clinit>(KernelLogManager.java:20)
at weblogic.kernel.KernelLogManager.getLogger(KernelLogManager.java:26)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at weblogic.logging.MessageLogger.log(MessageLogger.java:96)
at weblogic.logging.MessageLogger.log(MessageLogger.java:112)
at weblogic.logging.WLMessageLogger.log(WLMessageLogger.java:53)
at weblogic.kernel.T3SrvrLogger.logDomainLibPath(T3SrvrLogger.java:2440)
at weblogic.Server.appendToClassPath(Server.java:129)
at weblogic.Server.intializeClassloader(Server.java:140)
at weblogic.Server.main(Server.java:67)
But at the same time , right after that I can see my CustomLogManager.jar getting imported.
I have the CustomLogManager.jar , under /domain-folder/bin/ .
<Notice> <WebLogicServer> <BEA-000395> <Following extensions directory contents added to the end of the classpath:
/export/......../CustomLogManager.jar
So any idea how I can avoid getting ClassNotFound error.?
Thanks in advance
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
将 CustomLogManager.jar 包含在 WEBLOGIC_CLASSPATH 中
Include your CustomLogManager.jar in your WEBLOGIC_CLASSPATH