Problem with Apache Axis and Log4J in a scheduled agent

I tried to use Apache Axis to access a WebService in a Java Agent.

If I start the agent manualy on my local workstation, it works fine. If I run it scheduled on my Server (Windows 2000), it fails with an exception (see below).

It seems that Log4J has a problem with loading resources.

My JavaUserClasses are:

JavaUserClasses=C:\Lotus\Domino\axis.jar;C:\Lotus\Domino\j2ee.jar

where axis.jar is a combination of all the jar files that come with Axis 1.1 to shorten the length of my JavaUserClasses.

Has anybody successfully used Axis or Log4J in a Notes Agent? Did you encunter the same problem? Do you have a solution?

log4j: Trying to find [log4j.xml] using context classloader sun.misc.Launcher$AppClassLoader@2e6c5587.

log4j: Trying to find [log4j.xml] using ClassLoader.getSystemResource().

log4j: Trying to find [log4j.properties] using context classloader sun.misc.Launcher$AppClassLoader@2e6c5587.

log4j:WARN Caught Exception while in Loader.getResource. This may be innocuous.

java.lang.SecurityException: \C:\Lotus\Domino\axis.jar

at lotus.notes.AgentSecurityManager.checkRead(AgentSecurityManager.java:608)

at sun.misc.URLClassPath.check(URLClassPath.java:379)

at sun.misc.URLClassPath$JarLoader.checkResource(URLClassPath.java:561)

at sun.misc.URLClassPath$JarLoader.getResource(URLClassPath.java:593)

at sun.misc.URLClassPath.getResource(URLClassPath.java:164)

at sun.misc.URLClassPath.getResource(URLClassPath.java:173)

at java.lang.ClassLoader.getBootstrapResource(ClassLoader.java:1122)

at java.lang.ClassLoader.getResource(ClassLoader.java:1026)

at java.lang.ClassLoader.getResource(ClassLoader.java:1024)

at org.apache.log4j.helpers.Loader.getResource(Loader.java:78)

at org.apache.log4j.LogManager.<clinit>(LogManager.java:96)

at org.apache.log4j.Logger.getLogger(Logger.java:85)

at org.apache.commons.logging.impl.Log4JLogger.<init>(Log4JLogger.java:102)

at java.lang.reflect.Constructor.newInstance(Native Method)

at org.apache.commons.logging.impl.LogFactoryImpl.newInstance(LogFactoryImpl.java:525)

at org.apache.commons.logging.impl.LogFactoryImpl.getInstance(LogFactoryImpl.java:272)

at org.apache.commons.logging.LogFactory.getLog(LogFactory.java:414)

at org.apache.axis.components.logger.LogFactory.getLog(LogFactory.java:76)

at org.apache.axis.AxisProperties.<clinit>(AxisProperties.java:117)

at TestAgent02.execute(TestAgent02.java:62)

at TestAgent02.NotesMain(TestAgent02.java:39)

at lotus.domino.AgentBase.runNotes(Unknown Source)

at lotus.domino.NotesThread.run(NotesThread.java:215)

log4j: Trying to find [log4j.properties] using ClassLoader.getSystemResource().

java.lang.ExceptionInInitializerError:

org.apache.commons.logging.LogConfigurationException: java.lang.reflect.InvocationTargetException

at org.apache.commons.logging.impl.LogFactoryImpl.newInstance(LogFactoryImpl.java:532)

at org.apache.commons.logging.impl.LogFactoryImpl.getInstance(LogFactoryImpl.java:272)

at org.apache.commons.logging.LogFactory.getLog(LogFactory.java:414)

at org.apache.axis.components.logger.LogFactory.getLog(LogFactory.java:76)

at org.apache.axis.AxisProperties.<clinit>(AxisProperties.java:117)

at TestAgent02.execute(TestAgent02.java:62)

at TestAgent02.NotesMain(TestAgent02.java:39)

at lotus.domino.AgentBase.runNotes(Unknown Source)

at lotus.domino.NotesThread.run(NotesThread.java:215)

Subject: Problem with Apache Axis and Log4J in a scheduled agent

Hi Kurt,

i’m trying to get a WebService via Axis & Log4J running - but actually i get some “No Class Def.” or “Implementation Class not found” errors on commons.logging.

Even on local Tests.

Do you use a properties File to configure commons.logging / log4j ?

When yes - where do you place it ?

Would you post some example code, please ?

I think your problem consists on a security case " … java.lang.SecurityException: \C:\Lotus\Domino\axis.jar …"

you perhaps have a look at this post

http://www-10.lotus.com/ldd/nd6forum.nsf/55c38d716d632d9b8525689b005ba1c0/40d033fba3897f4d85256cd30034026a?OpenDocument

Thanks in advance.

VM

Subject: RE: Problem with Apache Axis and Log4J in a scheduled agent

My security problem was solved by setting the agent security to “Allow restricted operations”.

Concerning Log4J, I have a properties file in the root folder within the axis.jar file with the following adjusted content (mainly I have set everything to a NULL logger):

log4j.rootLogger=INFO, NULL

log4j.rootCategory=INFO, NULL

log4j.logger.org.apache.axis.enterprise=FATAL, NULL

NULL is set to be a NullAppender that ignores any logging

log4j.appender.NULL=org.apache.log4j.varia.NullAppender

log4j.appender.NULL.layout.ConversionPattern=%d %-5p - %m%n