(cc-ing dev for some more opinions)
I'm not quite sure what to do here. We could put in a system property to use the classloader returned by getClass.getClassloader() to do all class and resource loading.
However, that seems.. wrong. We are doing the correct thing here, and while I don't mind putting work-around in place the way axis2 works there seems - at first glance anyway - to be badly thought-out.
Most well-designed libraries that do classloading will use Thread.currentThread().getContextClassloader() to load classes and/or resources, because if they didn't they won't work properly in web applications. That's a much bigger set of applications than axis2 service archives. Does axis2 really expect all those libraries to be re-written to work with axis2?!
For example, it looks as though Spring/Hibernate have exactly the same issue if run inside axis2:
http://ws.apache.org/axis2/1_3/spring.html#263Based on that, it looks as though there might be a axis parameter called "ServiceTCCL" which is documented at
http://wso2.org/blog/dims/1131That looks like it may turn on more normal behaviour.
Nick
-----Original Message-----
From: Daniel Cox [mailto:daniel.cox@valtech.com]
Sent: Friday, 23 January 2009 7:28 AM
To: users@rome.dev.java.net
Subject: RE: problem with rome
We have some more on this:
Looks like ROME maybe using the wrong class loader. The properties loader
code uses Thread.currentThread().getContextClassLoader() to load
rome.properties files, and (I'm assuming) to load the classes listed in the
properties file.
I think the Thread in Axis2 that is handling our requests is loading a
classloader so that it can isolate the classpath of the service archive.
This is so each archive can have it's own set of jars that don't depend on
or get in the way of Axis2 or any other service loaded in Axis2.
In our situation, when ROME uses Thread.currentThread() it is accessing
Axis2's classpath, and not the classpath of the service in which it is
loaded.
We did a little experiment where we changed the code of the properties
loader to use .class and ROME got farther. It died later, presumably
because of the further use of Thread's class loader. We didn't go any
further with it.
ROME could use the MyClass.class.getClassLoader() for accessing class
loaders and it would work, in this situation.
We're going to put ROME in the lib path of Axis2 for now ... - Daniel
Daniel Cox wrote:
>
> Nick,
>
> So, we are using Axis2 and are deploying service archives to contain our
> service definitions. We are putting ROME in the service archive and it is
> having trouble loading the properties file at
> com.sun.syndication....rome.properties
>
> If we put ROME in the lib path for Axis2 it works fine.
>
> We decompiled some of the ROME classes and it looks to be the right code,
> so we're scratching our heads.
>
> Regards,
>
> Daniel
>
>
>
> Nick Lothian wrote:
>>
>> Hi Daniel,
>>
>> This sounds pretty interesting - can you be more specific?
>>
>> I've used ROME in standard web applications for some time without
>> problems.
>>
>> What exactly do you mean by a "component archive"?
>>
>> -----Original Message-----
>> From: Daniel Cox [mailto:daniel.cox@valtech.com]
>> Sent: Wednesday, 21 January 2009 9:56 AM
>> To: users@rome.dev.java.net
>> Subject: Re: problem with rome
>>
>>
>> Are you using a web container or some such beast where you are deploying
>> some
>> kind of component archive? Using Axis2?
>>
>> We had the same issue today. ROME needs to use a the class loader to
>> load
>> resources instead of the file system. In our service archives ROME can't
>> load the prop file and we get a null pointer exception. On the axis2 lib
>> path there's no problem.
>>
>> Daniel
>>
>>
>> fabian büttner wrote:
>>>
>>> Hi,
>>> thanks for your answer.
>>>
>>> When I wrote the last mail I no modules.jar in my classpath at all
>>> because there was no hint on the tutorial page to do so.
>>>
>>> With the modules.jar in my classpath(I am using bluej, so i just added
>>> the
>>> modules.jar to my libraries)
>>> I am getting the very same error:
>>> java.lang.ExceptionInInitializerError
>>> at
>>> com.sun.syndication.io.SyndFeedInput.build(SyndFeedInput.java:122)
>>> at FeedExample.main(FeedExample.java:374)
>>> Caused by: java.lang.NullPointerException
>>> at java.util.Properties$LineReader.readLine(Properties.java:435)
>>> at java.util.Properties.load0(Properties.java:354)
>>> at java.util.Properties.load(Properties.java:342)
>>> at
>>> com.sun.syndication.io.impl.PropertiesLoader.<init>(PropertiesLoader.java:74)
>>> at
>>> com.sun.syndication.io.impl.PropertiesLoader.getPropertiesLoader(PropertiesLoader.java:46)
>>> at
>>> com.sun.syndication.io.impl.PluginManager.<init>(PluginManager.java:54)
>>> at
>>> com.sun.syndication.io.impl.PluginManager.<init>(PluginManager.java:46)
>>> at
>>> com.sun.syndication.feed.synd.impl.Converters.<init>(Converters.java:40)
>>> at
>>> com.sun.syndication.feed.synd.SyndFeedImpl.<clinit>(SyndFeedImpl.java:56)
>>> at
>>> com.sun.syndication.io.SyndFeedInput.build(SyndFeedInput.java:122)
>>> at FeedExample.main(FeedExample.java:374)
>>> at __SHELL1.run(__SHELL1.java:7)
>>> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>>> at
>>> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
>>> at
>>> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
>>> at java.lang.reflect.Method.invoke(Method.java:616)
>>> at bluej.runtime.ExecServer$3.run(ExecServer.java:798)
>>>
>>> regards,
>>> fabian
>>>
>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: users-unsubscribe@rome.dev.java.net
>>> For additional commands, e-mail: users-help@rome.dev.java.net
>>>
>>>
>>>
>>
>> --
>> View this message in context:
>>
http://www.nabble.com/problem-with-rome-tp21407091p21574008.html>> Sent from the Rome - Users mailing list archive at Nabble.com.
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@rome.dev.java.net
>> For additional commands, e-mail: users-help@rome.dev.java.net
>>
>>
>> IMPORTANT: This e-mail, including any attachments, may contain private or
>> confidential information. If you think you may not be the intended
>> recipient, or if you have received this e-mail in error, please contact
>> the sender immediately and delete all copies of this e-mail. If you are
>> not the intended recipient, you must not reproduce any part of this
>> e-mail or disclose its contents to any other party. This email represents
>> the views of the individual sender, which do not necessarily reflect
>> those of Education.au except where the sender expressly states otherwise.
>> It is your responsibility to scan this email and any files transmitted
>> with it for viruses or any other defects. education.au limited will not
>> be liable for any loss, damage or consequence caused directly or
>> indirectly by this email.
>>
>>
>
>
--
View this message in context:
http://www.nabble.com/problem-with-rome-tp21407091p21613022.htmlSent from the Rome - Users mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@rome.dev.java.net
For additional commands, e-mail: users-help@rome.dev.java.net
IMPORTANT: This e-mail, including any attachments, may contain private or confidential information. If you think you may not be the intended recipient, or if you have received this e-mail in error, please contact the sender immediately and delete all copies of this e-mail. If you are not the intended recipient, you must not reproduce any part of this e-mail or disclose its contents to any other party. This email represents the views of the individual sender, which do not necessarily reflect those of Education.au except where the sender expressly states otherwise. It is your responsibility to scan this email and any files transmitted with it for viruses or any other defects. education.au limited will not be liable for any loss, damage or consequence caused directly or indirectly by this email.