Menu

StrutsTestCase + jakarta-commons logging: Err

2003-06-19
2003-06-19
  • Aaron V. Humphrey

    I've verified to my satisfaction that IntelliJ is not behind the error after all.  I set my CLASSPATH variable to:

    .;C:\Java;C:\Java\jUnit\junit.jar;D:\j2sdkee1.3.1\lib\j2ee.jar;D:\strutstest\strutstest-2.0.0.jar;D:\Jakarta\struts\lib\struts.jar;D:\Jakarta\commons\commons-logging.jar

    (my normal CLASSPATH with StrutsTestCase, Struts, and Jakarta Commons Logging added), and I am getting the same error when I run junit.swingui.TestRunner from the command-line "java" tool.  In all its glory:

    java.lang.ExceptionInInitializerError
            at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
            at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
            at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
            at java.lang.reflect.Method.invoke(Unknown Source)
            at junit.runner.BaseTestRunner.getTest(BaseTestRunner.java:111)
            at junit.swingui.TestRunner.runSuite(TestRunner.java:591)
            at junit.swingui.TestRunner$9.actionPerformed(TestRunner.java:283)
            at javax.swing.AbstractButton.fireActionPerformed(Unknown Source)
            at javax.swing.AbstractButton$ForwardActionEvents.actionPerformed(Unknown Source)
            at javax.swing.DefaultButtonModel.fireActionPerformed(Unknown Source)
            at javax.swing.DefaultButtonModel.setPressed(Unknown Source)
            at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(Unknown Source)
            at java.awt.Component.processMouseEvent(Unknown Source)
            at java.awt.Component.processEvent(Unknown Source)
            at java.awt.Container.processEvent(Unknown Source)
            at java.awt.Component.dispatchEventImpl(Unknown Source)
            at java.awt.Container.dispatchEventImpl(Unknown Source)
            at java.awt.Component.dispatchEvent(Unknown Source)
            at java.awt.LightweightDispatcher.retargetMouseEvent(Unknown Source)
            at java.awt.LightweightDispatcher.processMouseEvent(Unknown Source)
            at java.awt.LightweightDispatcher.dispatchEvent(Unknown Source)
            at java.awt.Container.dispatchEventImpl(Unknown Source)
            at java.awt.Window.dispatchEventImpl(Unknown Source)
            at java.awt.Component.dispatchEvent(Unknown Source)
            at java.awt.EventQueue.dispatchEvent(Unknown Source)
            at java.awt.EventDispatchThread.pumpOneEventForHierarchy(Unknown Source)
            at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
            at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
            at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
            at java.awt.EventDispatchThread.run(Unknown Source)
    Caused by: org.apache.commons.logging.LogConfigurationException: org.apache.commons.logging.LogConfigurationException: org.apache.commons.logging.LogConfigurationException: Class org.apache.commons.logging.impl.Jdk14Logger does not implement Log
            at org.apache.commons.logging.impl.LogFactoryImpl.newInstance(LogFactoryImpl.java:568)
            at org.apache.commons.logging.impl.LogFactoryImpl.getInstance(LogFactoryImpl.java:292)
            at org.apache.commons.logging.impl.LogFactoryImpl.getInstance(LogFactoryImpl.java:265)
            at org.apache.commons.logging.LogFactory.getLog(LogFactory.java:395)
            at servletunit.struts.MockStrutsTestCase.<clinit>(MockStrutsTestCase.java:83)
            ... 30 more
    Caused by: org.apache.commons.logging.LogConfigurationException: org.apache.commons.logging.LogConfigurationException: Class org.apache.commons.logging.impl.Jdk14Logger does not implement Log
            at org.apache.commons.logging.impl.LogFactoryImpl.getLogConstructor(LogFactoryImpl.java:434)
            at org.apache.commons.logging.impl.LogFactoryImpl.newInstance(LogFactoryImpl.java:561)
            ... 34 more
    Caused by: org.apache.commons.logging.LogConfigurationException: Class org.apache.commons.logging.impl.Jdk14Logger does not implement Log
            at org.apache.commons.logging.impl.LogFactoryImpl.getLogConstructor(LogFactoryImpl.java:430)
            ... 35 more

    This is the same error I was getting in IntelliJ...where I had several more classes linked in, which don't seem relevant for this example.

    Commons-Logging is the most recent version, 1.0.3, downloaded as of yesterday.

     
    • Aaron V. Humphrey

      Okay, I've made some progress, which is to say that I am getting different error messages now.

      I ran across some references to putting things into the junit/runner/excluded.properties file, so I tried that.  This is what I've got right now:

      excluded.0=sun.*
      excluded.1=com.sun.*
      excluded.2=org.omg.*
      excluded.3=javax.*
      excluded.4=sunw.*
      excluded.5=java.*
      excluded.6=org.w3c.dom.*
      excluded.7=org.xml.*
      excluded.8=net.jini.*
      excluded.9=org.*

      But I'm still getting errors like this:

      INFO: ActionServlet: init
      Jun 19, 2003 11:59:07 AM org.apache.struts.util.PropertyMessageResources <init>
      INFO: Initializing, config='org.apache.struts.util.LocalStrings', returnNull=true
      Jun 19, 2003 11:59:07 AM org.apache.struts.util.PropertyMessageResources <init>
      INFO: Initializing, config='org.apache.struts.action.ActionResources', returnNull=true
      Jun 19, 2003 11:59:07 AM org.apache.struts.action.ActionServlet initServlet
      SEVERE: null
      java.lang.NullPointerException
          at org.apache.crimson.parser.Parser2.parseInternal(Parser2.java:524)
          at org.apache.crimson.parser.Parser2.parse(Parser2.java:305)
          at org.apache.crimson.parser.XMLReaderImpl.parse(XMLReaderImpl.java:442)
          at org.apache.commons.digester.Digester.parse(Digester.java:1562)
          at org.apache.struts.action.ActionServlet.initServlet(ActionServlet.java:1379)
          at org.apache.struts.action.ActionServlet.init(ActionServlet.java:461)
          at javax.servlet.GenericServlet.init(GenericServlet.java:258)
          at servletunit.struts.MockStrutsTestCase.getActionServlet(MockStrutsTestCase.java:279)
          at servletunit.struts.MockStrutsTestCase.actionPerform(MockStrutsTestCase.java:332)
          at com.kakari.strutstest.test.LoginTest.testSuccessfulLogin(LoginTest.java:37)
          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:324)
          at junit.framework.TestCase.runTest(TestCase.java:154)
          at junit.framework.TestCase.runBare(TestCase.java:127)
          at junit.framework.TestResult$1.protect(TestResult.java:106)
          at junit.framework.TestResult.runProtected(TestResult.java:124)
          at junit.framework.TestResult.run(TestResult.java:109)
          at junit.framework.TestCase.run(TestCase.java:118)
          at junit.framework.TestSuite.runTest(TestSuite.java:208)
          at junit.framework.TestSuite.run(TestSuite.java:203)
          at junit.swingui.TestRunner$16.run(TestRunner.java:623)
      Jun 19, 2003 11:59:07 AM org.apache.struts.action.ActionServlet initModuleConfig
      SEVERE: Parsing error processing resource path
      java.lang.NullPointerException
          at org.apache.struts.action.ActionServlet.initModuleConfig(ActionServlet.java:941)
          at org.apache.struts.action.ActionServlet.init(ActionServlet.java:465)
          at javax.servlet.GenericServlet.init(GenericServlet.java:258)
          at servletunit.struts.MockStrutsTestCase.getActionServlet(MockStrutsTestCase.java:279)
          at servletunit.struts.MockStrutsTestCase.actionPerform(MockStrutsTestCase.java:332)
          at com.kakari.strutstest.test.LoginTest.testSuccessfulLogin(LoginTest.java:37)
          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:324)
          at junit.framework.TestCase.runTest(TestCase.java:154)
          at junit.framework.TestCase.runBare(TestCase.java:127)
          at junit.framework.TestResult$1.protect(TestResult.java:106)
          at junit.framework.TestResult.runProtected(TestResult.java:124)
          at junit.framework.TestResult.run(TestResult.java:109)
          at junit.framework.TestCase.run(TestCase.java:118)
          at junit.framework.TestSuite.runTest(TestSuite.java:208)
          at junit.framework.TestSuite.run(TestSuite.java:203)
          at junit.swingui.TestRunner$16.run(TestRunner.java:623)
      Jun 19, 2003 11:59:07 AM servletunit.ServletContextSimulator log
      INFO: ActionServlet: init
      Jun 19, 2003 11:59:07 AM org.apache.struts.util.PropertyMessageResources <init>
      INFO: Initializing, config='org.apache.struts.action.ActionResources', returnNull=true
      Jun 19, 2003 11:59:07 AM org.apache.struts.action.ActionServlet initServlet
      SEVERE: null
      java.lang.NullPointerException
          at org.apache.crimson.parser.Parser2.parseInternal(Parser2.java:524)
          at org.apache.crimson.parser.Parser2.parse(Parser2.java:305)
          at org.apache.crimson.parser.XMLReaderImpl.parse(XMLReaderImpl.java:442)
          at org.apache.commons.digester.Digester.parse(Digester.java:1562)
          at org.apache.struts.action.ActionServlet.initServlet(ActionServlet.java:1379)
          at org.apache.struts.action.ActionServlet.init(ActionServlet.java:461)
          at javax.servlet.GenericServlet.init(GenericServlet.java:258)
          at servletunit.struts.MockStrutsTestCase.getActionServlet(MockStrutsTestCase.java:279)
          at servletunit.struts.MockStrutsTestCase.actionPerform(MockStrutsTestCase.java:332)
          at com.kakari.strutstest.test.LoginTest.testFailedLogin(LoginTest.java:48)
          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:324)
          at junit.framework.TestCase.runTest(TestCase.java:154)
          at junit.framework.TestCase.runBare(TestCase.java:127)
          at junit.framework.TestResult$1.protect(TestResult.java:106)
          at junit.framework.TestResult.runProtected(TestResult.java:124)
          at junit.framework.TestResult.run(TestResult.java:109)
          at junit.framework.TestCase.run(TestCase.java:118)
          at junit.framework.TestSuite.runTest(TestSuite.java:208)
          at junit.framework.TestSuite.run(TestSuite.java:203)
          at junit.swingui.TestRunner$16.run(TestRunner.java:623)
      Jun 19, 2003 11:59:07 AM org.apache.struts.action.ActionServlet initModuleConfig
      SEVERE: Parsing error processing resource path
      java.lang.NullPointerException
          at org.apache.struts.action.ActionServlet.initModuleConfig(ActionServlet.java:941)
          at org.apache.struts.action.ActionServlet.init(ActionServlet.java:465)
          at javax.servlet.GenericServlet.init(GenericServlet.java:258)
          at servletunit.struts.MockStrutsTestCase.getActionServlet(MockStrutsTestCase.java:279)
          at servletunit.struts.MockStrutsTestCase.actionPerform(MockStrutsTestCase.java:332)
          at com.kakari.strutstest.test.LoginTest.testFailedLogin(LoginTest.java:48)
          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:324)
          at junit.framework.TestCase.runTest(TestCase.java:154)
          at junit.framework.TestCase.runBare(TestCase.java:127)
          at junit.framework.TestResult$1.protect(TestResult.java:106)
          at junit.framework.TestResult.runProtected(TestResult.java:124)
          at junit.framework.TestResult.run(TestResult.java:109)
          at junit.framework.TestCase.run(TestCase.java:118)
          at junit.framework.TestSuite.runTest(TestSuite.java:208)
          at junit.framework.TestSuite.run(TestSuite.java:203)
          at junit.swingui.TestRunner$16.run(TestRunner.java:623)

       
    • Aaron V. Humphrey

      Luckily, I have fixed my own problem, and will state it here so that the next person to run into it might find it through Google or something.  Apparently the arcane XML exception results from...StrutsTestCase not being able to find the struts-config.xml.

      As it clearly states in the documentation, WEB-INF/struts-config.xml has to be in the CLASSPATH.  Now that I've actually put it there, it works much better.  It is such an odd requirement, somehow, that I guess I just blocked it out.

      Thanks for all my help.  :-)

       

Log in to post a comment.