Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Virgo » ServiceConfigurationError(Intermittenly getting java.util.ServiceConfigurationError Exception)
ServiceConfigurationError [message #1716618] Sun, 06 December 2015 13:38 Go to next message
Setya Nugdjaja is currently offline Setya NugdjajaFriend
Messages: 567
Registered: July 2009
Senior Member
Hi all,

I intermittenly getting below exception when deploying my application on Virgo:

Caused by: java.util.ServiceConfigurationError: org.axonframework.serializer.ContentTypeConverter: Provider org.axonframework.serializer.converters.ByteArrayToInputStreamConverter not a subtype
	at java.util.ServiceLoader.fail(ServiceLoader.java:231)
	at java.util.ServiceLoader.access$300(ServiceLoader.java:181)
	at java.util.ServiceLoader$LazyIterator.next(ServiceLoader.java:369)
	at java.util.ServiceLoader$1.next(ServiceLoader.java:445)
	at org.axonframework.serializer.ChainingConverterFactory.<init>(ChainingConverterFactory.java:51)
	at org.axonframework.serializer.AbstractXStreamSerializer.<init>(AbstractXStreamSerializer.java:106)
	at org.axonframework.serializer.AbstractXStreamSerializer.<init>(AbstractXStreamSerializer.java:81)
	at org.axonframework.serializer.AbstractXStreamSerializer.<init>(AbstractXStreamSerializer.java:70)
	at org.axonframework.serializer.xml.XStreamSerializer.<init>(XStreamSerializer.java:53)
	at org.axonframework.contextsupport.spring.FileSystemEventStoreBeanDefinitionParser.doParse(FileSystemEventStoreBeanDefinitionParser.java:76)
	at org.springframework.beans.factory.xml.AbstractSingleBeanDefinitionParser.parseInternal(AbstractSingleBeanDefinitionParser.java:85)
	at org.springframework.beans.factory.xml.AbstractBeanDefinitionParser.parse(AbstractBeanDefinitionParser.java:59)
	at org.springframework.beans.factory.xml.NamespaceHandlerSupport.parse(NamespaceHandlerSupport.java:73)
	at org.springframework.beans.factory.xml.BeanDefinitionParserDelegate.parseCustomElement(BeanDefinitionParserDelegate.java:1438)
	at org.springframework.beans.factory.xml.BeanDefinitionParserDelegate.parseCustomElement(BeanDefinitionParserDelegate.java:1428)
	at org.springframework.beans.factory.xml.DefaultBeanDefinitionDocumentReader.parseBeanDefinitions(DefaultBeanDefinitionDocumentReader.java:195)
	at org.springframework.beans.factory.xml.DefaultBeanDefinitionDocumentReader.doRegisterBeanDefinitions(DefaultBeanDefinitionDocumentReader.java:139)
	at org.springframework.beans.factory.xml.DefaultBeanDefinitionDocumentReader.registerBeanDefinitions(DefaultBeanDefinitionDocumentReader.java:108)
	at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.registerBeanDefinitions(XmlBeanDefinitionReader.java:493)
	at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.doLoadBeanDefinitions(XmlBeanDefinitionReader.java:390)
	... 21 common frames omitted

The above error does not always show up, but even if so, if I restart Virgo the error could be thrown.

I suspect that this is a classloading issue but I'm not sure where to begin investigating since I never encountered this in non-OSGI environment or when I launch OSGI via Eclipse OSGI framework launcher.

Below is the version:

Virgo Tomcat/Jetty Server : 3.6.4
Spring: 3.2.5

Any help would be greatly appreciated.

Regards,
Setya
Re: ServiceConfigurationError [message #1716843 is a reply to message #1716618] Tue, 08 December 2015 14:10 Go to previous messageGo to next message
daniel marthaler is currently offline daniel marthalerFriend
Messages: 77
Registered: April 2012
Location: Z├╝rich
Member
Hi Setya

Usually when you try to consume frameworks which use java.util.ServiceLoader in an OSGi environment you will have a number of issues. Please read the article [1] which explains in more detail what is causing those issues.

To get it to work you must use an implementation of the OSGi ServiceLoader Mediator specification, chapter 133 in the OSGi Enterprise Specification Version 5.
As far as i know there is only one implementation of this specification from Apache Aries called SPI Fly [2].

Regards,
Dani

[1] https://www.google.ch/?gws_rd=ssl#safe=off&q=java.util.ServiceLoader+osgi
[2] http://aries.apache.org/modules/spi-fly.html
Re: ServiceConfigurationError [message #1717141 is a reply to message #1716843] Thu, 10 December 2015 09:19 Go to previous messageGo to next message
Setya Nugdjaja is currently offline Setya NugdjajaFriend
Messages: 567
Registered: July 2009
Senior Member
Hi Daniel,

Thank you for your information.

I've tried SPI Fly and get confirmed by the author that the problem is different from what SPI Fly addresses.

The problem comes from the fact the service interface & implementation were loaded by different classloader hence considered not assignable.

I've added -XX:+TraceClassLoading JVM parameter when starting Virgo and found the following when the problem occurs:
[Loaded org.axonframework.serializer.AnnotationRevisionResolver from file:/usr/apps/virgo-jetty-server-3.6.4.RELEASE/work/deployer/s/axonframework.plan-2.4/5/0/axon-core-2.4.jar/]
[Loaded org.axonframework.serializer.ChainingConverterFactory from file:/usr/apps/virgo-jetty-server-3.6.4.RELEASE/work/deployer/s/axonframework.plan-2.4/5/0/axon-core-2.4.jar/]
[Loaded org.axonframework.serializer.ContentTypeConverter from file:/usr/apps/virgo-jetty-server-3.6.4.RELEASE/work/deployer/s/axonframework.plan-2.4/5/0/axon-core-2.4.jar/]
[Loaded org.axonframework.serializer.ContentTypeConverter from file:/usr/apps/virgo-jetty-server-3.6.4.RELEASE/./repository/usr/axon-core-2.4.jar]
[Loaded org.axonframework.serializer.AbstractContentTypeConverter from file:/usr/apps/virgo-jetty-server-3.6.4.RELEASE/./repository/usr/axon-core-2.4.jar]
[Loaded org.axonframework.serializer.converters.ByteArrayToInputStreamConverter from file:/usr/apps/virgo-jetty-server-3.6.4.RELEASE/./repository/usr/axon-core-2.4.jar]
[Loaded java.util.ServiceConfigurationError from /usr/lib/jvm/jdk1.7.0_71-x64/jre/lib/rt.jar]
[Loaded org.springframework.core.NestedExceptionUtils from file:/usr/apps/virgo-jetty-server-3.6.4.RELEASE/repository/ext/org.springframework.core-3.2.5.RELEASE.jar]

From above log we see that class org.axonframework.serializer.ContentTypeConverter was loaded twice from different location, when the problem does not occure, it only gets loaded from repository/usr folder.

Thanks & Regards,
Setya
Re: ServiceConfigurationError [message #1718132 is a reply to message #1717141] Sun, 20 December 2015 15:49 Go to previous message
Setya Nugdjaja is currently offline Setya NugdjajaFriend
Messages: 567
Registered: July 2009
Senior Member
Hi Daniel,

Any insight on this ?

Regards,
Setya
Previous Topic:Problem with Spring NamespaceHandler
Next Topic:VIRGO NANO doesn't respond for multiple requests
Goto Forum:
  


Current Time: Fri Sep 21 23:03:42 GMT 2018

Powered by FUDForum. Page generated in 0.01888 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top