Community   SpringSource   Projects    Downloads    Documentation    Forums    Training   Exchange   Blogs

Go Back   Spring Community Forums > SpringSource dm Server > dm Server General

Reply
 
Thread Tools Display Modes
  #1  
Old Jun 26th, 2009, 08:46 AM
WeaZeLb0y WeaZeLb0y is offline
Junior Member
 
Join Date: Dec 2004
Posts: 9
Default Exporting Properties Packages - Rome RSS

For some reason when using Rome, it can't load its own properties file. I've posted the exception, code and my MANIFEST.MF below. Let me know if you need anything else to help me out.

Thanks!

Code:
	SyndFeedInput input = new SyndFeedInput();
			InputStream stream = get(feed.getUrl());
			InputStreamReader reader = new InputStreamReader(stream);
			SyndFeed syndFeed = input.build(reader);
			List<SyndEntry> entries = syndFeed.getEntries();

Manifest-Version: 1.0
Export-Package: com.monkily.rssexplorer.model;version="1.0.0";uses:="javax.persistence",
 com.monkily.rssexplorer.service;version="1.0.0"
Import-Library: org.hibernate.ejb;version="[3.3.2.GA,3.4.0)",
 org.springframework.spring
Bundle-Name: Monkily RssExplorer
Import-Bundle:  com.monkily.user;version="[1.0.0,1.0.0]",
 com.monkily.content;version="[1.0.0,1.0.0]",
 com.springsource.org.jdom;version="[1.0.0,1.0.0]",
 com.springsource.com.sun.syndication;version="[1.0.0,1.0.0]",
 com.springsource.org.apache.commons.httpclient;version="[3.1.0,4.0.0)",
 com.springsource.com.sun.syndication;version="[1.0.0,2.0.0)"
Bundle-Vendor: Monkily
Application-TraceLevels: *=info,com.monkily.*=debug
Bundle-Version: 1.0.0
Bundle-ManifestVersion: 2
Import-Package: com.monkily.content.model,
 com.monkily.content.service,
 com.monkily.utils,
 com.mysql.jdbc.jdbc2.optional,
 javax.persistence,
 javax.sql,
 org.apache.commons.logging,
 org.hibernate.ejb,
 org.springframework.beans.factory.annotation,
 org.springframework.beans.factory.config,
 org.springframework.orm.jpa,
 org.springframework.orm.jpa.vendor,
 org.springframework.osgi.context.event,
 org.springframework.stereotype,
 org.springframework.transaction.annotation
Bundle-SymbolicName: com.monkily.rssexplorer



java.lang.ExceptionInInitializerError
	at com.sun.syndication.io.SyndFeedInput.build(SyndFeedInput.java:122)
	at com.monkily.rssexplorer.internal.service.impl.RssServiceImpl.checkFeed(RssServiceImpl.java:68)
	at com.monkily.rssexplorer.internal.service.impl.RssServiceImpl.checkAll(RssServiceImpl.java:58)
	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:597)
	at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:307)
	at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:198)
	at $Proxy138.checkAll(Unknown Source)
	at com.monkily.rssexplorer.internal.scheduler.RssExplorerScheduler.start(RssExplorerScheduler.java:54)
	at com.monkily.rssexplorer.internal.scheduler.RssExplorerScheduler.onOsgiApplicationEvent(RssExplorerScheduler.java:43)
	at sun.reflect.GeneratedMethodAccessor10.invoke(Unknown Source)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
	at java.lang.reflect.Method.invoke(Method.java:597)
	at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:307)
	at org.springframework.osgi.service.importer.support.internal.aop.ServiceInvoker.doInvoke(ServiceInvoker.java:58)
	at org.springframework.osgi.service.importer.support.internal.aop.ServiceInvoker.invoke(ServiceInvoker.java:62)
	at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
	at org.springframework.aop.support.DelegatingIntroductionInterceptor.doProceed(DelegatingIntroductionInterceptor.java:131)
	at org.springframework.aop.support.DelegatingIntroductionInterceptor.invoke(DelegatingIntroductionInterceptor.java:119)
	at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
	at org.springframework.osgi.service.util.internal.aop.ServiceTCCLInterceptor.invoke(ServiceTCCLInterceptor.java:36)
	at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
	at org.springframework.osgi.service.importer.support.LocalBundleContextAdvice.invoke(LocalBundleContextAdvice.java:59)
	at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
	at org.springframework.aop.support.DelegatingIntroductionInterceptor.doProceed(DelegatingIntroductionInterceptor.java:131)
	at org.springframework.aop.support.DelegatingIntroductionInterceptor.invoke(DelegatingIntroductionInterceptor.java:119)
	at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
	at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204)
	at $Proxy3.onOsgiApplicationEvent(Unknown Source)
	at org.springframework.osgi.extender.internal.activator.ListListenerAdapter.onOsgiApplicationEvent(ListListenerAdapter.java:52)
	at org.springframework.osgi.context.event.ApplicationListenerAdapter.onApplicationEvent(ApplicationListenerAdapter.java:45)
	at org.springframework.context.event.SimpleApplicationEventMulticaster$1.run(SimpleApplicationEventMulticaster.java:78)
	at org.springframework.core.task.SyncTaskExecutor.execute(SyncTaskExecutor.java:49)
	at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:76)
	at org.springframework.osgi.context.event.OsgiBundleApplicationContextEventMulticasterAdapter.multicastEvent(OsgiBundleApplicationContextEventMulticasterAdapter.java:63)
	at org.springframework.osgi.context.support.AbstractDelegatedExecutionApplicationContext.sendRefreshedEvent(AbstractDelegatedExecutionApplicationContext.java:370)
	at org.springframework.osgi.context.support.AbstractDelegatedExecutionApplicationContext.completeRefresh(AbstractDelegatedExecutionApplicationContext.java:294)
	at org.springframework.osgi.extender.internal.dependencies.startup.DependencyWaiterApplicationContextExecutor$CompleteRefreshTask.run(DependencyWaiterApplicationContextExecutor.java:145)
	at com.springsource.server.kernel.dm.ContextPropagatingTaskExecutor$2.run(ContextPropagatingTaskExecutor.java:82)
	at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
	at java.lang.Thread.run(Thread.java:619)
Caused by: java.lang.NullPointerException
	at java.util.Properties$LineReader.readLine(Properties.java:418)
	at java.util.Properties.load0(Properties.java:337)
	at java.util.Properties.load(Properties.java:325)
	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)
	... 44 more
Reply With Quote
  #2  
Old Jul 16th, 2009, 12:28 AM
jsbournival jsbournival is offline
Junior Member
 
Join Date: Sep 2008
Location: Mont-Saint-Hilaire, QC
Posts: 16
Default

have you found a workaround?
Reply With Quote
  #3  
Old Jul 28th, 2009, 07:59 AM
Costin Leau's Avatar
Costin Leau Costin Leau is offline
Spring DM Lead
Spring Modules TeamSpring Team
 
Join Date: Jan 2005
Location: Bucharest, Romania
Posts: 5,110
Default

Moving this thread to the dm Server forum...
__________________
Costin Leau
SpringSource - http://www.SpringSource.com- Spring Training, Consulting, and Support - "From the Source"
http://twitter.com/costinl
Please use [ c o d e ] [ / c o d e ] tags
Reply With Quote
  #4  
Old Jul 28th, 2009, 10:44 AM
Andy Wilkinson Andy Wilkinson is offline
Senior Member
 
Join Date: Oct 2008
Posts: 390
Default

Rome appears to use the thread context class loader when it's looking for its Properties file. Unfortunately it doesn't check for getResourceAsStream returning null, hence the NullPointerException.

If possible, I'd add some debug immediately before you call into Rome to see what the thread context class loader is. If you post back with that information it should be possible to figure out what the problem is.
__________________
Andy Wilkinson
SpringSource
Reply With Quote
  #5  
Old Jul 31st, 2009, 03:06 PM
jsbournival jsbournival is offline
Junior Member
 
Join Date: Sep 2008
Location: Mont-Saint-Hilaire, QC
Posts: 16
Default

For what I can understand, the fault comes from Rome com.sun.syndication.io.impl.PropertiesLoader. This class have the responsibility of parsing the properties files specifying implementations of various IO components.

The code stores the properties, alongside the class loader in which to retrieve the implementation classes. The class loader used is Thread.currentThread().getContextClassLoader().

Code:
            
PropertiesLoader loader = (PropertiesLoader)
                clMap.get(Thread.currentThread().getContextClassLoader());
if (loader == null) {
    try {
        loader = new PropertiesLoader(MASTER_PLUGIN_FILE, EXTRA_PLUGIN_FILE);
        clMap.put(Thread.currentThread().getContextClassLoader(), loader);
    } catch (IOException ex) {
        throw new RuntimeException(ex);
    }
}

return loader;
Is this the information you were looking for? I don't understand OSGi class loading issues very well.
Reply With Quote
  #6  
Old Aug 3rd, 2009, 06:01 AM
Andy Wilkinson Andy Wilkinson is offline
Senior Member
 
Join Date: Oct 2008
Posts: 390
Default

Almost I was hoping to learn what the thread context class loader is before the call into Rome that fails is made. So, for example, for the code that generated the stack trace listed above the debug code would be added prior to calling SyndFeedInput.build:

Code:
ClassLoader tccl = Thread.currentThread().getContextClassLoader();
debug("Calling Rome with tccl " + tccl);
SyndFeedInput.build();
An alternative would be to place a breakpoint in Rome and use a debugger to look at the classloader that it's trying to use.
__________________
Andy Wilkinson
SpringSource
Reply With Quote
  #7  
Old Aug 4th, 2009, 07:17 AM
jsbournival jsbournival is offline
Junior Member
 
Join Date: Sep 2008
Location: Mont-Saint-Hilaire, QC
Posts: 16
Default

I think I partially* figured out what went wrong here. To put you guys in context, I'm using Rome inside a JAX-RS resource class so I can convert RSS -> ATOM and vice-versa. Now, I inspected what was the classloader that caused me all this trouble: Thread.currentThread().getContextClassLoader(). The answer was:

[Apache ServiceMix CXF Transport for OSGi (org.apache.servicemix.cxf.transport.osgi)]

... which obviously isn't what is needed here since rome.properties/plugins impl are in the Rome bundle, and in an OSGi runtime each bundle has its own private class loader. Now, to obtain the correct CL, I think I have to specify:

<rome_class>.getClass().getClassLoader()

Resulting in: [211.0]

... which is Rome bundle ID in my smx4 runtime. And now it's working, plugins gets loaded correctly.

When I look into Rome source code, there are about 10 places in which the currentThreadClassLoader is invoked (instead of the bundle CL). I guess the easy solution would be to replace these calls and then see if something breaks in the unit tests. At this point I'm not sure if such a fix has an impact on how Rome is working internally.


* When I said partially I meant that I don't fully understand why the CXF transport bundle (JAX-RS impl) is my currentThread CL.
Reply With Quote
  #8  
Old Aug 4th, 2009, 01:53 PM
jsbournival jsbournival is offline
Junior Member
 
Join Date: Sep 2008
Location: Mont-Saint-Hilaire, QC
Posts: 16
Default

I blogged about this. The post provides more info:

http://js.jipiju.com/2009/08/04/osgi...soading-hoops/

Feel free to comment.
Reply With Quote
  #9  
Old Mar 24th, 2010, 09:12 AM
splatch splatch is offline
Junior Member
 
Join Date: Mar 2009
Location: Warsaw, Poland
Posts: 2
Default

We had same problem with ROME with camel-rss. We created rome bundle in ServiceMix repository which contains fix for this bug.

If you're interest please review:
https://issues.apache.org/activemq/browse/SMX4-510
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -5. The time now is 10:11 PM.


Contegix provides first-class managed hosting and partial sponsorship of these forums.

Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.