'No appenders could be found. Please initialise the log4j system properly' error when trying to execute the same working scripts from one VM to another

Asked by Ishtiaq Qureshi

Hi,

Basically, we have a set of Sikuli scripts we created on a Windows server VM (Machine 1) and they work fine and are even integrated with a CI tool.

However, we want to run them against different versions of the software so copied these scripts (including all dependencies) to another VM (Machine 2) and ensured the JAVA version and other settings are exactly the same.

But we keep getting the following error - only get this error the first time trying to execute the script (usually comes up with the top log4j errors – sometimes longer error as below). For subsequent executions, it just skips the whole script and displays SOT and EOT (see script further below).

I'm assuming it's some sort of a configuration issue. Where are these log4j settings?
Have added an example of the scripts further below. It would be really great if you could point us in the right direction.

Thanks
Ishtiaq

ERROR

Storm Filtering
log4j:WARN No appenders could be found for logger (org.python.netty.util.internal.logging.InternalLoggerFactory).
log4j:WARN Please initialize the log4j system properly.
log4j:WARN See http://logging.apache.org/log4j/1.2/faq.html#noconfig for more info.
[info] Exit code: 0
SOT: SF_003
EOT: SF_003
Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException
               at java.desktop/javax.swing.text.FlowView$FlowStrategy.layoutRow(FlowView.java:576)
               at java.desktop/javax.swing.text.FlowView$FlowStrategy.layout(FlowView.java:489)
               at java.desktop/javax.swing.text.FlowView.layout(FlowView.java:209)
               at java.desktop/javax.swing.text.html.LineView.layout(LineView.java:123)
               at java.desktop/javax.swing.text.BoxView.setSize(BoxView.java:398)
               at java.desktop/javax.swing.text.BoxView.updateChildSizes(BoxView.java:367)
               at java.desktop/javax.swing.text.BoxView.setSpanOnAxis(BoxView.java:349)
               at java.desktop/javax.swing.text.BoxView.layout(BoxView.java:709)
               at java.desktop/javax.swing.text.BoxView.setSize(BoxView.java:398)
               at java.desktop/javax.swing.text.BoxView.updateChildSizes(BoxView.java:367)
               at java.desktop/javax.swing.text.BoxView.setSpanOnAxis(BoxView.java:349)
               at java.desktop/javax.swing.text.BoxView.layout(BoxView.java:709)
               at java.desktop/javax.swing.text.BoxView.setSize(BoxView.j
ava:398)
               at java.desktop/javax.swing.text.BoxView.updateChildSizes(BoxView.java:367)
               at java.desktop/javax.swing.text.BoxView.setSpanOnAxis(BoxView.java:349)
               at java.desktop/javax.swing.text.BoxView.layout(BoxView.java:709)
               at java.desktop/javax.swing.text.BoxView.setSize(BoxView.java:398)
               at java.desktop/javax.swing.plaf.basic.BasicTextUI$RootView.setSize(BasicTextUI.java:1821)
               at java.desktop/javax.swing.plaf.basic.BasicTextUI.modelToView(BasicTextUI.java:1111)
               at java.desktop/javax.swing.plaf.basic.BasicTextUI.modelToView(BasicTextUI.java:1089)
               at java.desktop/javax.swing.text.DefaultCaret.repaintNewCaret(DefaultCaret.java:1318)
               at java.desktop/javax.swing.text.DefaultCaret$1.run(DefaultCaret.java:1296)
               at java.desktop/java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:313)
               at java.desktop/java.awt.EventQueue.dispatchEventImpl(EventQueue.java:770)
               at java.desktop/java.awt.EventQueue$4.run(EventQueue.java:721)
               at java.desktop/java.awt.EventQueue$4.run(EventQueue.java:715)

               at java.base/java.security.AccessController.doPrivileged(AccessController.java:391)
               at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:85)
               at java.desktop/java.awt.EventQueue.dispatchEvent(EventQueue.java:740)
               at java.desktop/java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:203)
               at java.desktop/java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:124)
               at java.desktop/java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:113)
               at java.desktop/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:109)
               at java.desktop/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101)
               at java.desktop/java.awt.EventDispatchThread.run(EventDispatchThread.java:90)

SCRIPT

# --------------------------------------------------------------------------------------------------------------
# Test Description: SF_003 - Storm Filtering Mimic Test
#
# Minimum target:
# Maximum target:
# Server instance:
# --------------------------------------------------------------------------------------------------------------

# Script Name
print "Storm Filtering"

import org.sikuli.script.SikulixForJython
from sikuli import *

addImportPath("C:\\Sikuli\\Aveva")
addImportPath("C:\\Sikuli\\Dependancies")

addImagePath("C:\\Sikuli\\SE\\SF_003.sikuli")
addImagePath("C:\\Sikuli\\SE\\SECommon.sikuli")
addImagePath("C:\\Sikuli\\Aveva\\CommonViewX.sikuli")
addImagePath("C:\\Sikuli\\Aveva\\Common.sikuli")
addImagePath("C:\\Sikuli\\Aveva\\CommonObject.sikuli")

import CommonViewX
import Common
import CommonObject
import SECommon
import XMLTestRunner1
import unittest

Settings.ActionLogs = True
Settings.UserLogs = True
Settings.UserLogPrefix = "test"
Settings.UserLogTime = True

# --------------------------------------------------------------------------------------------------------------
# Test Body
# --------------------------------------------------------------------------------------------------------------

class SF_003(unittest.TestCase):

    def setUp(self):

        # Launch ViewX
        if CommonViewX.LaunchViewX("", "", ""):
            Debug.user("PASS - 001 - ViewX launched")

        # Logon to ViewX
        if CommonViewX.ViewXLogOnAsUser("Ribbon", "DevOpsTest", "DevOpsTest"):
            Debug.user("PASS - 002 - Logged on to ViewX")

         # Navigate to test Group
        CommonViewX.ExpandMainRootNode()
        CommonViewX.ExpandGroup([Pattern("1587657354043.png").targetOffset(2,2)])
        CommonViewX.ExpandGroup(["1584463258669.png"])
        CommonViewX.ExpandGroup(["1584463284474.png"])
        Debug.user("PASS - 003 - Expanded all required Groups")

        assert True

    def test(self):

        CommonObject.DisplayMimic([Pattern("1587722496992.png").similar(0.90)], [Pattern("1587725756104.png").similar(0.80)], [Pattern("1587725756104.png").similar(0.80)])
        if Common.Exists(["1584545459195.png"], documentRegion, 3):
            Debug.user("PASS - 004 - Storm Filtering mimic displayed correctly")
        else:
            Common.EndTestOnFailure("004 - Storm Filtering mimic not displayed correctly")

        Common.Click(["1584547358411.png"], "", 1)
        Common.Wait(["1584017291569.png"], "", 30)
        Common.Click([Pattern("1584017446172.png").targetOffset(-49,4)], "", 1)
        Common.Wait(["1584019307201.png"], "", 5)
        Common.Click([Pattern("1584019307201.png").targetOffset(113,78)], "", 5)
        CommonViewX.ExpandGroup(["1584547435611.png"])
        CommonViewX.ExpandGroup(["1588237843971.png"])
        Common.RightClick(["1584547498755.png"], "", 3)
        Common.Click([Pattern("1584547591388.png").targetOffset(-36,28)], "", 3)

        if Common.Exists(["1584373848888.png"], "", 1):
            Debug.user("PASS - 005 - MAOIPoints data displayed")
        else:
            Common.EndTestOnFailure("005 - MAOIPoints data not displayed")

        CommonViewX.ExpandGroup([Pattern("1588258767279.png").similar(0.79)])
        Common.Wheel([Pattern("1588258767279.png").similar(0.79)],"DOWN",5, "")
        Common.DoubleClick([Pattern("1588258836604.png").similar(0.98).targetOffset(1,2)], "", 1)
        Common.DoubleClick([Pattern("1588259120860.png").similar(0.90).targetOffset(5,2)], "", 1)

        Common.Wheel(["1584549953739.png"],"DOWN", 5, "")

        if Common.Exists(["1584449758274.png"], "", 1):
            Debug.user("PASS - 006 - Area of Interest STORM displayed")
        else:
            Common.EndTestOnFailure("006 - Area of Interest STORM not displayed")

        Common.Click(["1584548432653.png"], "", 1)
        Common.Click(["1584548457616.png"], "", 1)
        Common.Wait([Pattern("1584548513452.png").targetOffset(-22,1)], "", 30)
        Common.Click([Pattern("1584548513452.png").targetOffset(80,63)], "", 1)
        Common.Wait(["1584548611022.png"], "", 20)
        Common.Click(["1584550826497.png"], "", 1)
        Common.Click([Pattern("1584551913342.png").targetOffset(27,0)], "", 1)
        Common.DoubleClick([Pattern("1584552167179.png").targetOffset(-5,-6)], "", 1)
        wheel("1584549953739.png",Button.WHEEL_DOWN, 5)
        if Common.Exists(["1584551044796.png"], "", 1):
            Debug.user("PASS - 007 - Area of Interest IPHORV displayed")
        else:
            Common.EndTestOnFailure("007 - Area of Interest IPHORV not displayed")

        assert True

    def tearDown(self):

        # Close ViewX
        if CommonViewX.CloseViewX("Direct"):
            Debug.user("PASS - 008 - ViewX closed")

        assert True

# --------------------------------------------------------------------------------------------------------------
# Test Execution
# --------------------------------------------------------------------------------------------------------------

if __name__ == "__main__":

    print("SOT: SF_003")

    documentRegion = CommonObject.GetDocumentRegion()

    suite = unittest.TestSuite(unittest.TestLoader().loadTestsFromTestCase(SF_003))

    xmlFile = os.path.join(getBundlePath(), "Results.xml")
    result = XMLTestRunner1.XMLTestRunner(file(xmlFile, "w")).run(suite)

    print("EOT: SF_003")

    exit(0)

Question information

Language:
English Edit question
Status:
Expired
For:
SikuliX Edit question
Assignee:
No assignee Edit question
Last query:
Last reply:
Revision history for this message
RaiMan (raimund-hocke) said :
#1

SikuliX version?

Do you run the script from inside the SikuliX IDE?

you say:
... skips the whole script ...???

... but the
print("SOT: SF_003")
and
print("EOT: SF_003")
are executed.

... so only the test in between is not run.

Revision history for this message
Ishtiaq Qureshi (iqureshi81) said :
#2

Hi, thanks for the quick response.

We're using the latest Sikuli version 2.05 but have tried 2.04 and the same issue.
But on Machine A we've used both versions and they both work.

Yes the test in between SOT and EOT is not executing. I've tried similar other scripts with the same format and its the same issue.
They work on Machine A but not on this other machine and have tried another VM too and same issue.

I've checked the JAVA version and made sure its the same as Machine A - version 13.0.2.

Thanks
Ish.

Revision history for this message
Ishtiaq Qureshi (iqureshi81) said :
#3

The other information which may or may not be useful

Machine A is a Windows server 2016 VM

Machine B is a local Windows10 Hyper V virtual environment

Machine C is a Windows server 2019 VM

Revision history for this message
Manfred Hampl (m-hampl) said :
#4

(Not sure whether helpful at all)

Result of websearch for the error message log4j:WARN No appenders could be found for logger ...

https://logging.apache.org/log4j/1.2/faq.html#noconfig
Why do I see a warning about "No appenders found for logger" and "Please configure log4j properly"?
This occurs when the default configuration files log4j.properties and log4j.xml can not be found and the application performs no explicit configuration. ...

Do you have the files log4j.properties and log4j.xml on the different systems?
Do they contain similar contents?

Revision history for this message
Ishtiaq Qureshi (iqureshi81) said :
#5

Hi, thanks for this. Yes I did have a look at this page and similar other ones during my troubleshooting;

When searching for log4j on;

Machine A - these are the only log4j files that are displayed and are related to Bamboo agent home/classpath and Intelij IDEA IDE
- log4j-1.2.17jar
- log4j-api-2.9.0jar
- log4j-to-slf4j-2.9.0.jar
- slf4j-log4j12-1.7.10.jar
- log4j.jar
- log4j_license.txt

And Machine A is connected to Bamboo CI via an agent. And these probably were installed when we set up the remote agent for Bamboo and the IDE.

Machine B search comes up with log4javascript

Machine C similarly to Machine A instead has Atlassian/Confluence installed - and all the log4j files are related to Atlassian

I can't see where log4j is configured for Sikuli and how it's related or where the settings are. And why it would have an impact on execution. I'm guessing it will be some configuration/environment issue.

Revision history for this message
Ishtiaq Qureshi (iqureshi81) said :
#6

I realised didn't answer one of the questions - yes we run it directly from within the Sikuli IDE. Some developers have used IntelliJ IDEA but we mostly use the Sikuli IDE to create and run tests.

Revision history for this message
Launchpad Janitor (janitor) said :
#7

This question was expired because it remained in the 'Open' state without activity for the last 15 days.