java.lang.thread.state:等待(在对象监视器上)

brvekthn  于 2021-07-04  发布在  Java
关注(0)|答案(1)|浏览(430)

我正在尝试创建weblogic域使用python代码,它被困在filehandler,下面是代码和stacktrace,它正在等待一些东西,你能帮助修复它吗?

import os
import sys
import wl as myWLST

from java.lang import System,Runtime,Process,String
from java.io import BufferedReader,InputStreamReader,File
from java.util.logging import FileHandler,Logger,SimpleFormatter

from com.oracle.cie.domain.script.jython import WLSTException
from com.oracle.cie.domain.script import ScriptException
from WeblogicConfigXmlParser import XmlParser

# =====================

# Program starts here

# =====================

if __name__ == "__main__":
    print "in main"
    print len(sys.argv)
    if len(sys.argv) < 2:
                print 'Insufficent arguments'
                System.exit(-1)
    else:
        try:
            print "inside try - JASON"
            print (os.getcwd())
            fileHandler = FileHandler("weblogic.log",1);
            print "inside try 2"
            fileHandler.setFormatter(SimpleFormatter());`

它卡在线路上了 "fileHandler = FileHandler("weblogic.log",1);", 堆栈跟踪:

Full thread dump Java HotSpot(TM) Server VM (24.255-b255-jre1.7.0.25.ia-rc1 mixed mode):

"Attach Listener" daemon prio=8 tid=0x00835000 nid=13 lwp_id=3559300 waiting on condition [0x00000000]
   java.lang.Thread.State: RUNNABLE

"Service Thread" daemon prio=8 tid=0x00676c00 nid=12 lwp_id=3559264 runnable [0x00000000]
   java.lang.Thread.State: RUNNABLE

"C2 CompilerThread1" daemon prio=8 tid=0x00670600 nid=10 lwp_id=3559262 waiting on condition [0x00000000]
   java.lang.Thread.State: RUNNABLE

"C2 CompilerThread0" daemon prio=8 tid=0x0066ce00 nid=9 lwp_id=3559261 waiting on condition [0x00000000]
   java.lang.Thread.State: RUNNABLE

"Signal Dispatcher" daemon prio=8 tid=0x0066aa00 nid=8 lwp_id=3559260 runnable [0x00000000]
   java.lang.Thread.State: RUNNABLE

"Finalizer" daemon prio=8 tid=0x00653a00 nid=7 lwp_id=3559259 in Object.wait() [0x484c0000]
   java.lang.Thread.State: WAITING (on object monitor)
    at java.lang.Object.wait(Native Method)
    - waiting on <0x73a28788> (a java.lang.ref.ReferenceQueue$Lock)
    at java.lang.ref.ReferenceQueue.remove(ReferenceQueue.java:152)
    - locked <0x73a28788> (a java.lang.ref.ReferenceQueue$Lock)
    at java.lang.ref.ReferenceQueue.remove(ReferenceQueue.java:168)
    at java.lang.ref.Finalizer$FinalizerThread.run(Finalizer.java:248)

"Reference Handler" daemon prio=8 tid=0x00651600 nid=6 lwp_id=3559258 in Object.wait() [0x4a3c0000]
   java.lang.Thread.State: WAITING (on object monitor)
    at java.lang.Object.wait(Native Method)
    - waiting on <0x73a28818> (a java.lang.ref.Reference$Lock)
    at java.lang.Object.wait(Object.java:503)
    at java.lang.ref.Reference$ReferenceHandler.run(Reference.java:140)
    - locked <0x73a28818> (a java.lang.ref.Reference$Lock)

"main" prio=8 tid=0x00473400 nid=1 lwp_id=-1 runnable [0x7fffd000]
   java.lang.Thread.State: RUNNABLE
    at sun.nio.ch.FileDispatcherImpl.lock0(Native Method)
    at sun.nio.ch.FileDispatcherImpl.lock(FileDispatcherImpl.java:90)
    at sun.nio.ch.FileChannelImpl.tryLock(FileChannelImpl.java:1098)
    at java.nio.channels.FileChannel.tryLock(FileChannel.java:1154)
    at java.util.logging.FileHandler.openFiles(FileHandler.java:438)
    - locked <0x710b6228> (a java.util.HashMap)
    at java.util.logging.FileHandler.<init>(FileHandler.java:310)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)
    at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
    at java.lang.reflect.Constructor.newInstance(Constructor.java:526)
    at org.python.core.PyReflectedConstructor.__call__(Unknown Source)
    at org.python.core.PyJavaInstance.__init__(Unknown Source)
    at org.python.core.PyJavaClass.__call__(Unknown Source)
    at org.python.core.PyObject.__call__(Unknown Source)
    at org.python.pycode._pyx0.f$0(/SHARED/scripts/weblogicscripts/WeblogicDomainManager.py:428)
    at org.python.pycode._pyx0.call_function(/SHARED/scripts/weblogicscripts/WeblogicDomainManager.py)
    at org.python.core.PyTableCode.call(Unknown Source)
    at org.python.core.PyCode.call(Unknown Source)
    at org.python.core.Py.runCode(Unknown Source)
    at org.python.core.__builtin__.execfile_flags(Unknown Source)
    at org.python.util.PythonInterpreter.execfile(Unknown Source)
    at org.python.util.jython.main(Unknown Source)

"VM Thread" prio=8 tid=0x00640400 nid=5 lwp_id=3559257 runnable 

"GC task thread#0 (ParallelGC)" prio=8 tid=0x00495000 nid=3 lwp_id=3559255 runnable 

"GC task thread#1 (ParallelGC)" prio=8 tid=0x004bb600 nid=4 lwp_id=3559256 runnable 

"VM Periodic Task Thread" prio=8 tid=0x00674800 nid=11 lwp_id=3559263 waiting on condition 

JNI global references: 273

无法理解为什么它被困在filehandler,它正在创建任何weblogic.log也没有得到timedout。甚至我在post对象waiting的基础上使用了“-xx:compilecommand=”exclude,java/lang/object.wait“,但仍然不走运。

hjzp0vay

hjzp0vay1#

在将日志文件的位置从/shared更改为local之后,可以解决此问题
旧的:

fileHandler = FileHandler("/SHARED/weblogic.log",1);
                print "inside try 2"
                fileHandler.setFormatter(SimpleFormatter());`

新增:

fileHandler = FileHandler("/home/user/weblogic.log",1);
            print "inside try 2"
            fileHandler.setFormatter(SimpleFormatter());`

文件系统中,在写入文件时,/shared文件系统出现了一些问题,这就是它被卡住的原因。

相关问题