3 Replies Latest reply: May 6, 2014 2:21 AM by KarthikSinghDBA RSS

    Errors while running WLST script

    fc0c0afa-2d14-4ea0-b466-06bdcd890b81

      Hi ,

       

      I am getting the following error while running WLST .

       

       

       

      Problem invoking WLST - Traceback (innermost last):

        File "/app/orclas/product/merdev02/fmw/wlserver_10.3/common/bin/serverstatus.py", line 52, in ?

        File "/app/orclas/product/merdev02/fmw/wlserver_10.3/common/bin/serverstatus.py", line 19, in sendMailString

        File "/app/orclas/product/merdev02/fmw/wlserver_10.3/common/wlst/modules/jython-modules.jar/Lib/javaos$py.class", line 334, in system

        File "/app/orclas/product/merdev02/fmw/wlserver_10.3/common/wlst/modules/jython-modules.jar/Lib/popen2.py", line 235, in system

        File "/app/orclas/product/merdev02/fmw/wlserver_10.3/common/wlst/modules/jython-modules.jar/Lib/popen2.py", line 79, in __init__

        File "/app/orclas/product/merdev02/fmw/wlserver_10.3/common/wlst/modules/jython-modules.jar/Lib/threading$py.class", line 6, in ?

        File "/app/orclas/product/merdev02/fmw/wlserver_10.3/common/wlst/modules/jython-modules.jar/Lib/traceback$py.class", line 3, in ?

        File "/app/orclas/product/merdev02/fmw/wlserver_10.3/common/wlst/modules/jython-modules.jar/Lib/linecache$py.class", line 10, in ?

              at java.io.File.<init>(File.java:222)

              at java.lang.Package$1.run(Package.java:527)

              at java.lang.Package.defineSystemPackage(Package.java:520)

              at java.lang.Package.getSystemPackages(Package.java:511)

              at java.lang.ClassLoader.getPackages(ClassLoader.java:1513)

              at java.lang.ClassLoader.getPackages(ClassLoader.java:1511)

              at java.lang.Package.getPackages(Package.java:281)

              at org.python.core.JavaImportHelper.buildLoadedPackages(Unknown Source)

              at org.python.core.JavaImportHelper.tryAddPackage(Unknown Source)

              at org.python.core.imp.import_next(Unknown Source)

              at org.python.core.imp.import_logic(Unknown Source)

              at org.python.core.imp.import_name(Unknown Source)

              at org.python.core.imp.importName(Unknown Source)

              at org.python.core.ImportFunction.load(Unknown Source)

              at org.python.core.ImportFunction.__call__(Unknown Source)

              at org.python.core.PyObject.__call__(Unknown Source)

              at org.python.core.__builtin__.__import__(Unknown Source)

              at org.python.core.PyModule.impHook(Unknown Source)

              at org.python.core.PyModule.module___findattr__(Unknown Source)

              at org.python.core.PyModule.__findattr__(Unknown Source)

              at org.python.core.imp.importAll(Unknown Source)

              at linecache$py.f$0(C:\wlst\jython_2.2.1\Lib\linecache.py:12)

              at linecache$py.call_function(C:\wlst\jython_2.2.1\Lib\linecache.py)

              at org.python.core.PyTableCode.call(Unknown Source)

              at org.python.core.PyCode.call(Unknown Source)

              at org.python.core.imp.createFromCode(Unknown Source)

              at org.python.core.imp.createFromPyClass(Unknown Source)

              at org.python.core.ZipFileImporter$ZipFileLoader.load_module(Unknown Source)

              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)

       

       

      java.lang.NullPointerException: java.lang.NullPointerException

        • 1. Re: Errors while running WLST script
          fc0c0afa-2d14-4ea0-b466-06bdcd890b81

          Please help to resolve this issue.  below is my script

           

          from java.util import Date

          from java.io import FileInputStream

          import java.lang

          import os

          import string

           

           

          propInputStream = FileInputStream("domain.properties")

          configProps = Properties()

          configProps.load(propInputStream)

           

           

          adminUser = configProps.get("admin.username")

          adminPassword = configProps.get("admin.password")

          checkInterval = configProps.get("check.interval")

          totalServersToMonitor = configProps.get("total.number.of.servers")

          checkingIntervalSeconds = int(checkInterval)

          #############  This method would send the Alert Email  #################

          def sendMailString():  # this is my line 19 which throws the error

                 os.system('/usr/bin/mailx -s "ALERT: Check Server May Not Be RUNNING !!! Please check..." vignesh.sunderraj@officedepot.com < serverState_file')

                 print '*********  ALERT MAIL HAS BEEN SENT FOR SERVER STATE ***********'

                 print ''

           

           

          #############  Infinite Loop to check the Status of Server in Mentioned Interval  #################

          while true:

                 print 'Checking All Servers State Details'

                 totalServers = int(totalServersToMonitor)

                 i=1

                 while i <= totalServers:

                     disconnect()

                     serverState=""

                     serverName = configProps.get("server.name." + str(i))

                     serverURL = configProps.get("server.url." + str(i))

                     try:

                        connect(adminUser,adminPassword,serverURL)

                        serverRuntime()

                        serverState=cmo.getState()

                        print '-----------------', serverName , ' is in State: ', serverState

                        if serverState != "RUNNING":

                            today = Date()

                            stateMessage = 'The ' + serverName + ' is In State ' + serverState + '  At Time: ' + today.toString()

                            cmd = "echo " + stateMessage +" >> serverState_file"

                            os.system(cmd)

                     except:

                        serverName=configProps.get("server.name." + str(i))

                        print 'Sorry !!! Unable to Connect to Server ' , serverName

                        today = Date()

                        stateMessage = 'The ' + serverName + ' May Be DOWN.' + ' At Time: ' + today.toString()

                        cmd = "echo " + stateMessage +" >> serverState_file"

                        os.system(cmd)

                     i =  i + 1

           

           

                 sendMailString() # this is my line 52 which throws the error

                 cmd = "rm -f serverState_file"

                 os.system(cmd)

           

           

                 print 'Sleeping for ', int(checkingIntervalSeconds) , ' Seconds...'

                 print ''

                 interval=int(checkingIntervalSeconds)

                 Thread.sleep(interval*1000)

          #######################################################################

          • 2. Re: Errors while running WLST script
            KarthikSinghDBA

            Did your script work previously? Or is this a New script into your Environment ?

            Mostly WLST will throw error if there is any blank space or indentation, check for that.

             

            Thanks,

            Karthik

            • 3. Re: Errors while running WLST script
              KarthikSinghDBA

              If you are editing your script from a Windows Text Editor please try to convert the script as it support the Unix Environment using "dos2unix".