Hi Eric,
In your code, Spring ClassPathXmlApplicationContext uses a classloader taken
from service.getClassLoader() but log4j doesn't.
Try the same classloader given to Spring for the log4j,
ClassLoader classLoader = service.getClassLoader();
URL url = classLoader.getResource("config_ws/log4j.xml");
Hope this helps.
Upul
On 10/8/07, Eric_K <[EMAIL PROTECTED]> wrote:
>
>
>
> Hi Upul,
>
> Thanks for responding. The below is correct.My .aar looks like the
> following:
>
> .aar
> |_com
> |_config_ws
> | |_applicationContext.xml
> | |_log4j.xml
> |_META-INF
>
> The below code for my springinit.java works fine for the loading the
> applicationContext, but I think that axis has a problem with loading the
> log4j as it can't recognize the directory structure in the aar. Is there a
> similar call to the getSystemResource that can locate within the
> classpath?
>
> thanks,
>
> Eric
>
>
> Upul Godage wrote:
> >
> > Hi,
> >
> > Looks like URL url = ClassLoader.getSystemResource
> ("config_ws/log4j.xml");
> > returned null. Is the location correct?
> >
> > Upul
> >
> >
> > On 10/6/07, Eric_K <[EMAIL PROTECTED]> wrote:
> >>
> >>
> >> hi folks,
> >>
> >> I'm trying to determine if there's a simple method of enabling log4j
> >> logging
> >> inside axis2, more specifically inside the AAR. I am running the
> >> following
> >> inside my springinit.java and receiving the below failure. Do I need to
> >> use
> >> the .mar example for the logging module or is there another common way
> to
> >> get log4J running?
> >>
> >> <code>
> >>
> >> public void startUp(ConfigurationContext ignore, AxisService
> service)
> >> {
> >> //Load and configure log4j.
> >> URL url = ClassLoader.getSystemResource("config_ws/log4j.xml");
> >> DOMConfigurator.configure(url);
> >>
> >> ClassLoader classLoader = service.getClassLoader();
> >> ClassPathXmlApplicationContext appCtx = new
> >> ClassPathXmlApplicationContext(new String[]
> >> {"config_ws/applicationContext.xml"}, false);
> >> appCtx.setClassLoader(classLoader);
> >> appCtx.refresh();
> >> if (logger.isDebugEnabled()) {
> >> logger.debug("\n\nstartUp() set spring classloader via
> >> axisService.getClassLoader() ... ");
> >> }
> >> }
> >>
> >> </code>
> >>
> >> the following produces the following error... long... sorry.
> >>
> >>
> >> --------------------
> >>
> >>
> >> Error: org.apache.axis2.deployment.DeploymentException: Processing
> >> Operations Modules with an error of null at
> >>
> >>
> org.apache.axis2.deployment.repository.util.ArchiveReader.processServiceGroup
> >> (ArchiveReader.java:147)
> >> at
> >> org.apache.axis2.deployment.ServiceDeployer.deploy(ServiceDeployer.java
> >> :79)
> >> at
> >> org.apache.axis2.deployment.DeploymentEngine.doDeploy(
> >> DeploymentEngine.java:582)
> >> at
> >> org.apache.axis2.deployment.repository.util.WSInfoList.update(
> >> WSInfoList.java:201)
> >> at
> >> org.apache.axis2.deployment.RepositoryListener.update(
> >> RepositoryListener.java:271)
> >> at
> >> org.apache.axis2.deployment.RepositoryListener.checkServices(
> >> RepositoryListener.java:189)
> >> at
> >> org.apache.axis2.deployment.DeploymentEngine.loadServices(
> >> DeploymentEngine.java:110)
> >> at
> >> org.apache.axis2.deployment.WarBasedAxisConfigurator.loadServices(
> >> WarBasedAxisConfigurator.java:257)
> >> at
> >>
> >>
> org.apache.axis2.context.ConfigurationContextFactory.createConfigurationContext
> >> (ConfigurationContextFactory.java:74)
> >> at
> >> org.apache.axis2.transport.http.AxisServlet.initConfigContext(
> >> AxisServlet.java:486)
> >> at org.apache.axis2.transport.http.AxisServlet.init(AxisServlet.java
> :406)
> >> at
> >> org.apache.catalina.core.StandardWrapper.loadServlet(
> StandardWrapper.java
> >> :1139)
> >> at
> >> org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:966)
> >> at
> >> org.apache.catalina.core.StandardContext.loadOnStartup(
> >> StandardContext.java:3956)
> >> at org.apache.catalina.core.StandardContext.start(StandardContext.java
> >> :4230)
> >> at
> >> org.apache.catalina.core.ContainerBase.addChildInternal(
> ContainerBase.java
> >> :760)
> >> at
> >> org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:740)
> >> at org.apache.catalina.core.StandardHost.addChild(StandardHost.java
> :544)
> >> at
> >> org.apache.catalina.startup.HostConfig.deployWAR(HostConfig.java:825)
> at
> >> org.apache.catalina.startup.HostConfig.deployWARs(HostConfig.java:714)
> at
> >> org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:490)
> at
> >> org.apache.catalina.startup.HostConfig.start(HostConfig.java:1138) at
> >> org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java
> :311)
> >> at
> >> org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(
> >> LifecycleSupport.java:120)
> >> at org.apache.catalina.core.ContainerBase.start(ContainerBase.java
> :1022)
> >> at
> >> org.apache.catalina.core.StandardHost.start(StandardHost.java:736) at
> >> org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1014)
> at
> >> org.apache.catalina.core.StandardEngine.start(StandardEngine.java:443)
> at
> >> org.apache.catalina.core.StandardService.start(StandardService.java
> :448)
> >> at
> >> org.apache.catalina.core.StandardServer.start(StandardServer.java:700)
> at
> >> org.apache.catalina.startup.Catalina.start(Catalina.java:552) 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
> >> org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:295) at
> >> org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:433) Caused
> by:
> >> org.apache.axis2.deployment.DeploymentException: Processing Operations
> >> Modules with an error of null at
> >> org.apache.axis2.deployment.ServiceGroupBuilder.populateServiceGroup(
> >> ServiceGroupBuilder.java:103)
> >> at
> >>
> >>
> org.apache.axis2.deployment.repository.util.ArchiveReader.buildServiceGroup
> >> (ArchiveReader.java:106)
> >> at
> >>
> >>
> org.apache.axis2.deployment.repository.util.ArchiveReader.processServiceGroup
> >> (ArchiveReader.java:140)
> >> ... 36 more Caused by: org.apache.axis2.deployment.DeploymentException:
> >> Processing Operations Modules with an error of null at
> >> org.apache.axis2.deployment.ServiceBuilder.populateService(
> >> ServiceBuilder.java:381)
> >> at
> >> org.apache.axis2.deployment.ServiceGroupBuilder.populateServiceGroup(
> >> ServiceGroupBuilder.java:98)
> >> ... 38 more Caused by: org.apache.axis2.deployment.DeploymentExceptionat
> >> org.apache.axis2.deployment.ServiceBuilder.loadServiceLifeCycleClass(
> >> ServiceBuilder.java:458)
> >> at
> >> org.apache.axis2.deployment.ServiceBuilder.populateService(
> >> ServiceBuilder.java:176)
> >> ... 39 more Caused by: java.lang.NullPointerException at
> >> org.apache.log4j.xml.DOMConfigurator$2.toString(DOMConfigurator.java
> :615)
> >> at
> >> org.apache.log4j.xml.DOMConfigurator.doConfigure(DOMConfigurator.java
> :715)
> >> at
> >> org.apache.log4j.xml.DOMConfigurator.doConfigure(DOMConfigurator.java
> :618)
> >> at org.apache.log4j.xml.DOMConfigurator.configure(DOMConfigurator.java
> >> :743)
> >> at com.rocketgaming.ws.SpringInit.startUp(Unknown Source) at
> >> org.apache.axis2.deployment.ServiceBuilder.loadServiceLifeCycleClass(
> >> ServiceBuilder.java:454)
> >> ... 40 more
> >>
> >>
> >> ---------------------------
> >>
> >>
> >> many thanks in advance,
> >>
> >> Eric
> >>
> >>
> >> --
> >> View this message in context:
> >> http://www.nabble.com/Logging-%2B-axis2-tf4580678.html#a13075879
> >> Sent from the Axis - User mailing list archive at Nabble.com.
> >>
> >>
> >> ---------------------------------------------------------------------
> >> To unsubscribe, e-mail: [EMAIL PROTECTED]
> >> For additional commands, e-mail: [EMAIL PROTECTED]
> >>
> >>
> >
> >
>
> --
> View this message in context:
> http://www.nabble.com/Logging-%2B-axis2-tf4580678.html#a13102049
> Sent from the Axis - User mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>