axis-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Anthony Bull <anthony.b...@bcsoft.co.nz>
Subject Re: Logging + axis2
Date Mon, 08 Oct 2007 19:38:50 GMT
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
  <meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
I've done Spring and log4j within an .aar file. I've also got multiple
.aars running independently with their own log4j and Spring setups.<br>
<br>
Things I had to do were:<br>
<br>
1. Make sure log4j.jar is not in the axis2/WEB-INF/lib folder.<br>
2. Set the axis 2 logger to non log4j logging and remove the axis2
log4j.properties from the axis2/WEB-INF/classes folder.<br>
3. I configure log4j in the init method of my skeleton classes, as you
can be sure at that point that the correct classloader is available - I
think the Spring init phase is using a different classloader to the one
you need.<br>
4. If I'm using either Ibatis or Hibernate inside the .aar I have to
explode it to the services folder - otherwise you get resource not
found exceptions for the mapping files.<br>
<br>
A snippet from my skeleton init() methods:<br>
<br>
Properties props = new Properties();<br>
props.load(
DataHubAuthenticationServiceSkeleton.class.getClassLoader().getResourceAsStream(
"log4j.properties"));<br>
PropertyConfigurator.configure( props);<br>
<br>
<br>
<br>
Upul Godage wrote:
<blockquote
 cite="mid51e581cd0710081206g44fe0f61u641ef32fc11b84be@mail.gmail.com"
 type="cite"><a href="http://ws.apache.org/axis2/faq.html#b1">http://ws.apache.org/axis2/faq.html#b1</a><br>
  <br>
This link has details about Axis2 class loading behaviour.<br>
  <br>
Upul<br>
  <br>
  <br>
  <div><span class="gmail_quote">On 10/9/07, <b
 class="gmail_sendername">Upul Godage</b> &lt;<a
 href="mailto:upulg.dev@gmail.com">upulg.dev@gmail.com</a>&gt; wrote:</span>
  <blockquote class="gmail_quote"
 style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left:
1ex;">Hi
Eric,<br>
    <br>
In your code, Spring ClassPathXmlApplicationContext uses a classloader
taken from&nbsp; service.getClassLoader() but log4j doesn't.<br>
    <span><br>
Try the same classloader given to Spring for the log4j,<br>
    <br>
ClassLoader <span style="font-weight: bold;">classLoader</span> =
service.getClassLoader();<br>
URL url = <span style="font-weight: bold;">classLoader</span>.getResource("config_ws/log4j.xml");<br>
    </span><br>
Hope this helps.
    <br>
    <span class="sg"><br>
Upul</span>
    <div><span class="e" id="q_11581002a567d9b9_2"><br>
    <br>
    <br>
    <div><span class="gmail_quote">On 10/8/07, <b
 class="gmail_sendername">Eric_K</b> &lt;<a
 href="mailto:ekinskfr@hotmail.com" target="_blank"
 onclick="return top.js.OpenExtLink(window,event,this)">
ekinskfr@hotmail.com</a>&gt; wrote:</span>
    <blockquote class="gmail_quote"
 style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left:
1ex;"><br>
      <br>
Hi Upul,<br>
      <br>
Thanks for responding. The below is correct.My .aar looks like the<br>
following:<br>
      <br>
.aar<br>
&nbsp;&nbsp;&nbsp;&nbsp;|_com<br>
&nbsp;&nbsp;&nbsp;&nbsp;|_config_ws<br>
&nbsp;&nbsp;&nbsp;&nbsp;|&nbsp;&nbsp; |_applicationContext.xml<br>
&nbsp;&nbsp;&nbsp;&nbsp;|&nbsp;&nbsp; |_log4j.xml<br>
&nbsp;&nbsp;&nbsp;&nbsp;|_META-INF
      <br>
      <br>
The below code for my springinit.java works fine for the loading the<br>
applicationContext, but I think that axis has a problem with loading the<br>
log4j as it can't recognize the directory structure in the aar. Is
there a
      <br>
similar call to the getSystemResource that can locate within the
classpath?<br>
      <br>
thanks,<br>
      <br>
Eric<br>
      <br>
      <br>
Upul Godage wrote:<br>
&gt;<br>
&gt; Hi,<br>
&gt;<br>
&gt; Looks like URL url = ClassLoader.getSystemResource
("config_ws/log4j.xml");<br>
&gt; returned null. Is the location correct?<br>
&gt;<br>
&gt; Upul<br>
&gt;<br>
&gt;<br>
&gt; On 10/6/07, Eric_K &lt;<a href="mailto:ekinskfr@hotmail.com"
 target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">
ekinskfr@hotmail.com</a>&gt; wrote:
      <br>
&gt;&gt;<br>
&gt;&gt;<br>
&gt;&gt; hi folks,<br>
&gt;&gt;<br>
&gt;&gt; I'm trying to determine if there's a simple method of enabling
log4j<br>
&gt;&gt; logging<br>
&gt;&gt; inside axis2, more specifically inside the AAR. I am running
the
      <br>
&gt;&gt; following<br>
&gt;&gt; inside my springinit.java and receiving the below failure. Do
I need to<br>
&gt;&gt; use<br>
&gt;&gt; the .mar example for the logging module or is there another
common way to<br>
&gt;&gt; get log4J running?
      <br>
&gt;&gt;<br>
&gt;&gt; &lt;code&gt;<br>
&gt;&gt;<br>
&gt;&gt;&nbsp;&nbsp;&nbsp;&nbsp; public void startUp(ConfigurationContext
ignore,
AxisService service)<br>
&gt;&gt; {<br>
&gt;&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
//Load and configure log4j.<br>
&gt;&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
URL url =
ClassLoader.getSystemResource("config_ws/log4j.xml");<br>
&gt;&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
DOMConfigurator.configure(url);<br>
&gt;&gt;<br>
&gt;&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
ClassLoader classLoader = service.getClassLoader();<br>
&gt;&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
ClassPathXmlApplicationContext appCtx = new
      <br>
&gt;&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
ClassPathXmlApplicationContext(new String[]<br>
&gt;&gt; {"config_ws/applicationContext.xml"}, false);<br>
&gt;&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
appCtx.setClassLoader(classLoader);<br>
&gt;&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
appCtx.refresh
();<br>
&gt;&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
if (logger.isDebugEnabled()) {<br>
&gt;&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
logger.debug("\n\nstartUp() set spring classloader
via<br>
&gt;&gt; axisService.getClassLoader() ... ");<br>
&gt;&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
}<br>
&gt;&gt;&nbsp;&nbsp;&nbsp;&nbsp; }
      <br>
&gt;&gt;<br>
&gt;&gt; &lt;/code&gt;<br>
&gt;&gt;<br>
&gt;&gt; the following produces the following error... long... sorry.<br>
&gt;&gt;<br>
&gt;&gt;<br>
&gt;&gt; --------------------<br>
&gt;&gt;<br>
&gt;&gt;<br>
&gt;&gt; Error: org.apache.axis2.deployment.DeploymentException:
Processing<br>
&gt;&gt; Operations Modules with an error of null at<br>
&gt;&gt;<br>
&gt;&gt;
org.apache.axis2.deployment.repository.util.ArchiveReader.processServiceGroup<br>
&gt;&gt; (ArchiveReader.java:147)<br>
&gt;&gt; at<br>
&gt;&gt;
org.apache.axis2.deployment.ServiceDeployer.deploy(ServiceDeployer.java<br>
&gt;&gt; :79)<br>
&gt;&gt; at<br>
&gt;&gt; org.apache.axis2.deployment.DeploymentEngine.doDeploy
(<br>
&gt;&gt; DeploymentEngine.java:582)<br>
&gt;&gt; at<br>
&gt;&gt; org.apache.axis2.deployment.repository.util.WSInfoList.update(<br>
&gt;&gt; WSInfoList.java:201)<br>
&gt;&gt; at<br>
&gt;&gt; org.apache.axis2.deployment.RepositoryListener.update
(<br>
&gt;&gt; RepositoryListener.java:271)<br>
&gt;&gt; at<br>
&gt;&gt; org.apache.axis2.deployment.RepositoryListener.checkServices(<br>
&gt;&gt; RepositoryListener.java:189)<br>
&gt;&gt; at<br>
&gt;&gt; org.apache.axis2.deployment.DeploymentEngine.loadServices
(<br>
&gt;&gt; DeploymentEngine.java:110)<br>
&gt;&gt; at<br>
&gt;&gt;
org.apache.axis2.deployment.WarBasedAxisConfigurator.loadServices(<br>
&gt;&gt; WarBasedAxisConfigurator.java:257)<br>
&gt;&gt; at<br>
&gt;&gt;<br>
&gt;&gt;
org.apache.axis2.context.ConfigurationContextFactory.createConfigurationContext<br>
&gt;&gt; (ConfigurationContextFactory.java:74)<br>
&gt;&gt; at<br>
&gt;&gt; org.apache.axis2.transport.http.AxisServlet.initConfigContext(<br>
&gt;&gt; AxisServlet.java:486)<br>
&gt;&gt; at
org.apache.axis2.transport.http.AxisServlet.init(AxisServlet.java:406)<br>
&gt;&gt; at<br>
&gt;&gt;
org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java<br>
&gt;&gt; :1139)<br>
&gt;&gt; at<br>
&gt;&gt;
org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:966)<br>
&gt;&gt; at<br>
&gt;&gt; org.apache.catalina.core.StandardContext.loadOnStartup(<br>
&gt;&gt; StandardContext.java
:3956)<br>
&gt;&gt; at
org.apache.catalina.core.StandardContext.start(StandardContext.java<br>
&gt;&gt; :4230)<br>
&gt;&gt; at<br>
&gt;&gt;
org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java<br>
&gt;&gt; :760)
      <br>
&gt;&gt; at<br>
&gt;&gt;
org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:740)<br>
&gt;&gt; at
org.apache.catalina.core.StandardHost.addChild(StandardHost.java:544)<br>
&gt;&gt; at<br>
&gt;&gt; org.apache.catalina.startup.HostConfig.deployWAR
(HostConfig.java:825) at<br>
&gt;&gt;
org.apache.catalina.startup.HostConfig.deployWARs(HostConfig.java:714)
at<br>
&gt;&gt;
org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:490)
at<br>
&gt;&gt; org.apache.catalina.startup.HostConfig.start
(HostConfig.java:1138) at<br>
&gt;&gt;
org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:311)<br>
&gt;&gt; at<br>
&gt;&gt; org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(<br>
&gt;&gt; LifecycleSupport.java
:120)<br>
&gt;&gt; at
org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1022)<br>
&gt;&gt; at<br>
&gt;&gt;
org.apache.catalina.core.StandardHost.start(StandardHost.java:736) at<br>
&gt;&gt; org.apache.catalina.core.ContainerBase.start
(ContainerBase.java:1014) at<br>
&gt;&gt;
org.apache.catalina.core.StandardEngine.start(StandardEngine.java:443)
at<br>
&gt;&gt;
org.apache.catalina.core.StandardService.start(StandardService.java:448)<br>
&gt;&gt; at<br>
&gt;&gt;
org.apache.catalina.core.StandardServer.start(StandardServer.java:700)
at<br>
&gt;&gt; org.apache.catalina.startup.Catalina.start(Catalina.java:552)
at<br>
&gt;&gt; sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at
      <br>
&gt;&gt; sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at<br>
&gt;&gt; sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown
Source) at<br>
&gt;&gt; java.lang.reflect.Method.invoke(Unknown Source) at<br>
&gt;&gt;
org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:295) at<br>
&gt;&gt; org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:433)
Caused by:<br>
&gt;&gt; org.apache.axis2.deployment.DeploymentException
: Processing Operations<br>
&gt;&gt; Modules with an error of null at<br>
&gt;&gt;
org.apache.axis2.deployment.ServiceGroupBuilder.populateServiceGroup(<br>
&gt;&gt; ServiceGroupBuilder.java:103)<br>
&gt;&gt; at<br>
&gt;&gt;<br>
&gt;&gt;
org.apache.axis2.deployment.repository.util.ArchiveReader.buildServiceGroup<br>
&gt;&gt; (ArchiveReader.java:106)<br>
&gt;&gt; at<br>
&gt;&gt;<br>
&gt;&gt;
org.apache.axis2.deployment.repository.util.ArchiveReader.processServiceGroup
      <br>
&gt;&gt; (ArchiveReader.java:140)<br>
&gt;&gt; ... 36 more Caused by:
org.apache.axis2.deployment.DeploymentException:<br>
&gt;&gt; Processing Operations Modules with an error of null at<br>
&gt;&gt; org.apache.axis2.deployment.ServiceBuilder.populateService
(<br>
&gt;&gt; ServiceBuilder.java:381)<br>
&gt;&gt; at<br>
&gt;&gt;
org.apache.axis2.deployment.ServiceGroupBuilder.populateServiceGroup(<br>
&gt;&gt; ServiceGroupBuilder.java:98)<br>
&gt;&gt; ... 38 more Caused by:
org.apache.axis2.deployment.DeploymentException at<br>
&gt;&gt;
org.apache.axis2.deployment.ServiceBuilder.loadServiceLifeCycleClass(<br>
&gt;&gt; ServiceBuilder.java:458)<br>
&gt;&gt; at<br>
&gt;&gt; org.apache.axis2.deployment.ServiceBuilder.populateService(<br>
&gt;&gt; ServiceBuilder.java:176)<br>
&gt;&gt; ... 39 more Caused by: java.lang.NullPointerException at<br>
&gt;&gt;
org.apache.log4j.xml.DOMConfigurator$2.toString(DOMConfigurator.java:615)<br>
&gt;&gt; at<br>
&gt;&gt; org.apache.log4j.xml.DOMConfigurator.doConfigure
(DOMConfigurator.java:715)<br>
&gt;&gt; at<br>
&gt;&gt;
org.apache.log4j.xml.DOMConfigurator.doConfigure(DOMConfigurator.java:618)<br>
&gt;&gt; at
org.apache.log4j.xml.DOMConfigurator.configure(DOMConfigurator.java<br>
&gt;&gt; :743)
      <br>
&gt;&gt; at com.rocketgaming.ws.SpringInit.startUp(Unknown Source) at<br>
&gt;&gt;
org.apache.axis2.deployment.ServiceBuilder.loadServiceLifeCycleClass(<br>
&gt;&gt; ServiceBuilder.java:454)<br>
&gt;&gt; ... 40 more<br>
&gt;&gt;
      <br>
&gt;&gt;<br>
&gt;&gt; ---------------------------<br>
&gt;&gt;<br>
&gt;&gt;<br>
&gt;&gt; many thanks in advance,<br>
&gt;&gt;<br>
&gt;&gt; Eric<br>
&gt;&gt;<br>
&gt;&gt;<br>
&gt;&gt; --<br>
&gt;&gt; View this message in context:
      <br>
&gt;&gt; <a
 href="http://www.nabble.com/Logging-%2B-axis2-tf4580678.html#a13075879"
 target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">http://www.nabble.com/Logging-%2B-axis2-tf4580678.html#a13075879
      </a><br>
&gt;&gt; Sent from the Axis - User mailing list archive at <a
 href="http://Nabble.com" target="_blank"
 onclick="return top.js.OpenExtLink(window,event,this)">
Nabble.com</a>.<br>
&gt;&gt;<br>
&gt;&gt;<br>
&gt;&gt;
---------------------------------------------------------------------<br>
&gt;&gt; To unsubscribe, e-mail: <a
 href="mailto:axis-user-unsubscribe@ws.apache.org" target="_blank"
 onclick="return top.js.OpenExtLink(window,event,this)">
axis-user-unsubscribe@ws.apache.org
      </a><br>
&gt;&gt; For additional commands, e-mail: <a
 href="mailto:axis-user-help@ws.apache.org" target="_blank"
 onclick="return top.js.OpenExtLink(window,event,this)">axis-user-help@ws.apache.org</a><br>
&gt;&gt;<br>
&gt;&gt;
      <br>
&gt;<br>
&gt;<br>
      <br>
--<br>
View this message in context: <a
 href="http://www.nabble.com/Logging-%2B-axis2-tf4580678.html#a13102049"
 target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">
http://www.nabble.com/Logging-%2B-axis2-tf4580678.html#a13102049</a><br>
Sent from the Axis - User mailing list archive at <a
 href="http://Nabble.com" target="_blank"
 onclick="return top.js.OpenExtLink(window,event,this)">
Nabble.com</a>.<br>
      <br>
      <br>
---------------------------------------------------------------------
      <br>
To unsubscribe, e-mail: <a
 href="mailto:axis-user-unsubscribe@ws.apache.org" target="_blank"
 onclick="return top.js.OpenExtLink(window,event,this)">axis-user-unsubscribe@ws.apache.org</a><br>
For additional commands, e-mail: <a
 href="mailto:axis-user-help@ws.apache.org" target="_blank"
 onclick="return top.js.OpenExtLink(window,event,this)">axis-user-help@ws.apache.org
      </a><br>
      <br>
    </blockquote>
    </div>
    <br>
    </span></div>
  </blockquote>
  </div>
  <br>
</blockquote>
<br>
<br>
<pre class="moz-signature" cols="72">-- 
&iuml;&raquo;&iquest;
Anthony
------------------------------------- 
Anthony Bull
Senior Developer
Black Coffee Software Ltd
PO Box 10-192 The Terrace
Wellington, New Zealand
 
<a class="moz-txt-link-abbreviated" href="mailto:anthony.bull@bcsoft.co.nz">anthony.bull@bcsoft.co.nz</a>
Ph  +64 4 472 8818
Fax +64 4 472 8811
------------------------------------- 
<a class="moz-txt-link-abbreviated" href="http://www.bcsoft.co.nz">www.bcsoft.co.nz</a>
--------------------------------------------------------------- 
This email may contain confidential or privileged information, 
and is intended for use only by the addressee, or addressees. 
If you are not the intended recipient please advise the sender 
immediately and do not copy, use or disclose the contents to 
any other person or organisation.
Black Coffee Software Ltd accepts no responsibility for viruses 
received with this email, or to any changes made to the original 
content. Any views or opinions expressed in this email may be
personal to the sender and are not necessarily those of Black 
Coffee Software Ltd.
--------------------------------------------------------------- </pre>
</body>
</html>


---------------------------------------------------------------------
To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-user-help@ws.apache.org


Mime
View raw message