Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Provider com.sun.xml.stream.ZephyrParserFactory not found using annotation-driven [SWS-752] #840

Closed
gregturn opened this issue Jan 23, 2012 · 6 comments
Assignees
Milestone

Comments

@gregturn
Copy link
Member

@gregturn gregturn commented Jan 23, 2012

Martin Vanek opened SWS-752 and commented

Error message appears when <sws:annotation-driven /> is used.

org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.ws.server.endpoint.adapter.method.SourcePayloadMethodProcessor#0': Instantiation of bean failed; nested exception is org.springframework.beans.BeanInstantiationException: Could not instantiate bean class [org.springframework.ws.server.endpoint.adapter.method.SourcePayloadMethodProcessor]: Constructor threw exception; nested exception is javax.xml.stream.FactoryFinder$ConfigurationError: Provider com.sun.xml.stream.ZephyrParserFactory not found
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateBean(AbstractAutowireCapableBeanFactory.java:965)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:911)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:485)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:456)
        at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:293)
        at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)
        at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:290)
        at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:192)
        at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:585)
        at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:895)
        at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:425)
        at org.springframework.web.servlet.FrameworkServlet.createWebApplicationContext(FrameworkServlet.java:467)
        at org.springframework.web.servlet.FrameworkServlet.createWebApplicationContext(FrameworkServlet.java:483)
        at org.springframework.web.servlet.FrameworkServlet.initWebApplicationContext(FrameworkServlet.java:358)
        at org.springframework.web.servlet.FrameworkServlet.initServletBean(FrameworkServlet.java:325)
        at org.springframework.web.servlet.HttpServletBean.init(HttpServletBean.java:127)
        at javax.servlet.GenericServlet.init(GenericServlet.java:241)
        at org.mortbay.jetty.servlet.ServletHolder.initServlet(ServletHolder.java:431)
        at org.mortbay.jetty.servlet.ServletHolder.doStart(ServletHolder.java:263)
        at org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:50)
        at org.mortbay.jetty.servlet.ServletHandler.initialize(ServletHandler.java:667)
        at org.mortbay.jetty.servlet.Context.startContext(Context.java:140)
        at org.mortbay.jetty.webapp.WebAppContext.startContext(WebAppContext.java:1239)
        at org.mortbay.jetty.handler.ContextHandler.doStart(ContextHandler.java:517)
        at org.mortbay.jetty.webapp.WebAppContext.doStart(WebAppContext.java:466)
        at org.mortbay.jetty.plugin.Jetty6PluginWebAppContext.doStart(Jetty6PluginWebAppContext.java:124)
        at org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:50)
        at org.mortbay.jetty.handler.HandlerCollection.doStart(HandlerCollection.java:152)
        at org.mortbay.jetty.handler.ContextHandlerCollection.doStart(ContextHandlerCollection.java:156)
        at org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:50)
        at org.mortbay.jetty.handler.HandlerCollection.doStart(HandlerCollection.java:152)
        at org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:50)
        at org.mortbay.jetty.handler.HandlerWrapper.doStart(HandlerWrapper.java:130)
        at org.mortbay.jetty.Server.doStart(Server.java:222)
        at org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:50)
        at org.mortbay.jetty.plugin.Jetty6PluginServer.start(Jetty6PluginServer.java:132)
        at org.mortbay.jetty.plugin.AbstractJettyMojo.startJetty(AbstractJettyMojo.java:441)
        at org.mortbay.jetty.plugin.AbstractJettyMojo.execute(AbstractJettyMojo.java:383)
        at org.mortbay.jetty.plugin.AbstractJettyRunMojo.execute(AbstractJettyRunMojo.java:205)
        at org.mortbay.jetty.plugin.Jetty6RunMojo.execute(Jetty6RunMojo.java:184)
        at org.apache.maven.plugin.DefaultPluginManager.executeMojo(DefaultPluginManager.java:490)
        at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(DefaultLifecycleExecutor.java:694)
        at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeStandaloneGoal(DefaultLifecycleExecutor.java:569)
        at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoal(DefaultLifecycleExecutor.java:539)
        at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalAndHandleFailures(DefaultLifecycleExecutor.java:387)
        at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeTaskSegments(DefaultLifecycleExecutor.java:348)
        at org.apache.maven.lifecycle.DefaultLifecycleExecutor.execute(DefaultLifecycleExecutor.java:180)
        at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:328)
        at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:138)
        at org.apache.maven.cli.MavenCli.main(MavenCli.java:362)
        at org.apache.maven.cli.compat.CompatibleMain.main(CompatibleMain.java:60)
        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.codehaus.classworlds.Launcher.launchEnhanced(Launcher.java:315)
        at org.codehaus.classworlds.Launcher.launch(Launcher.java:255)
        at org.codehaus.classworlds.Launcher.mainWithExitCode(Launcher.java:430)
        at org.codehaus.classworlds.Launcher.main(Launcher.java:375)
Caused by: org.springframework.beans.BeanInstantiationException: Could not instantiate bean class [org.springframework.ws.server.endpoint.adapter.method.SourceP
ayloadMethodProcessor]: Constructor threw exception; nested exception is javax.xml.stream.FactoryFinder$ConfigurationError: Provider com.sun.xml.stream.ZephyrPa
rserFactory not found
        at org.springframework.beans.BeanUtils.instantiateClass(BeanUtils.java:141)
        at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:74)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateBean(AbstractAutowireCapableBeanFactory.java:958)
        ... 58 more
Caused by: javax.xml.stream.FactoryFinder$ConfigurationError: Provider com.sun.xml.stream.ZephyrParserFactory not found
        at javax.xml.stream.FactoryFinder.newInstance(FactoryFinder.java:154)
        at javax.xml.stream.FactoryFinder.findJarServiceProvider(FactoryFinder.java:308)
        at javax.xml.stream.FactoryFinder.find(FactoryFinder.java:233)
        at javax.xml.stream.XMLInputFactory.newInstance(XMLInputFactory.java:123)
        at org.springframework.ws.server.endpoint.adapter.method.SourcePayloadMethodProcessor.createXmlInputFactory(SourcePayloadMethodProcessor.java:128)
        at org.springframework.ws.server.endpoint.adapter.method.SourcePayloadMethodProcessor.<init>(SourcePayloadMethodProcessor.java:48)
        at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
        at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
        at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
        at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
        at org.springframework.beans.BeanUtils.instantiateClass(BeanUtils.java:126)
        ... 60 more

The error message does not appear in previous versions.

I have tried to trace the problem and I have found out, that due task: "SWS:697: Support maven 3" library wsit-rt (wsit-rt-1.1.jar) has been added as an dependency. This library became part of my ear and therefore part of the my classpath.

This library contains /META-INF/services/javax.xml.stream.XMLInputFactory, which contains com.sun.xml.stream.ZephyrParserFactory. This overrides default settings without saying a word.

The simple workaround is to remove the related dependencies:
Fox example:

<dependency>
      <groupId>org.springframework.ws</groupId>
      <artifactId>spring-ws-security</artifactId>
      <exclusions>
      	<exclusion>
            <groupId>com.sun.xml.wsit</groupId>
            <artifactId>xws-security</artifactId>
        </exclusion>
        <exclusion>
          <groupId>com.sun.xml.wsit</groupId>
          <artifactId>wsit-rt</artifactId>
      	</exclusion>
      </exclusions>
    </dependency>

Still I believe this is wrong behavior and has to be fixed.


Affects: 2.0.3

@gregturn
Copy link
Member Author

@gregturn gregturn commented Jan 24, 2012

Arjen Poutsma commented

Added formatting.

@gregturn
Copy link
Member Author

@gregturn gregturn commented Jan 25, 2012

Arjen Poutsma commented

Unfortunately, there is very little I can do about fixing that wsit-rt jar. I contacted the Oracle guys about it, but got no response so far.

As an alternative to excluding the dependency altogether, you can also make sure that your preferred StAX parser (Woodstox) comes before wsit-rt on the class path. This will put Woodstox's /META-INF/services/javax.xml.stream.XMLInputFactory before the one in wsit-rt, thus overriding it.

@gregturn
Copy link
Member Author

@gregturn gregturn commented Jan 25, 2012

Martin Vanek commented

Hi, thanks for the quick answer.

You are right, classpath alternation is possible but because the Maven creates the EAR and classpath MANIFEST within it is quite uncontrolled what comes first. And because of more 100 jar libraries in our ear, it is even harder.

I do not know code of spring-ws in detail, but why is wsit-rt dependency of spring-ws?

@gregturn
Copy link
Member Author

@gregturn gregturn commented Jan 25, 2012

Arjen Poutsma commented

wsit-rt.jar contains an implementation of WS-Security called XWWS. As such, it's a dependency of the security module of spring-ws.

@gregturn
Copy link
Member Author

@gregturn gregturn commented Mar 15, 2012

Steve Jones commented

The following Maven dependency setup worked for me. I am Running on Tomcat 6, Java 7.

com.sun.xml.stream.ZephyrParserFactory is a reference to the Sun Java Streaming XML Parser (apparently this was a code name at one point).

<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-web</artifactId>
<version>3.1.0.RELEASE</version>
</dependency>
<dependency>
<groupId>org.springframework.ws</groupId>
<artifactId>spring-ws-security</artifactId>
<version>2.0.4.RELEASE</version>
</dependency>
<!-- spring-ws-security depends on Sun Java Streaming XML Parser -->
<dependency>
<groupId>com.sun.xml.stream</groupId>
<artifactId>sjsxp</artifactId>
<version>1.0.1</version>
</dependency>
Pay it forward ;)

@gregturn
Copy link
Member Author

@gregturn gregturn commented May 4, 2012

Arjen Poutsma commented

Closing old issues

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants
You can’t perform that action at this time.