cxf-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Elias Dorneles (Commented) (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (CXF-3377) NPE in creating client after upgrading from 2.3.2 to 2.3.3
Date Wed, 18 Apr 2012 18:44:40 GMT

    [ https://issues.apache.org/jira/browse/CXF-3377?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13256808#comment-13256808
] 

Elias Dorneles commented on CXF-3377:
-------------------------------------

I have this same issue happening with an app, and spent some time debugging it.
I think that, in my case, the problem is that ClientProxyFactoryBean calls configureObject()
early in create() method, but I'm not familiar enough with CXF code to understand how all
of this works...

I don't know if this is the case with the OP, but in my case, I am creating Spring beans for
the WebService clients in a Spring XML config file that goes like this:

{noformat}
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:aop="http://www.springframework.org/schema/aop"
	xmlns:context="http://www.springframework.org/schema/context" xmlns:p="http://www.springframework.org/schema/p"
xmlns:lang="http://www.springframework.org/schema/lang"
	xmlns:jaxws="http://cxf.apache.org/jaxws" xmlns:cxf="http://cxf.apache.org/core"
	xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
		http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop.xsd
	    http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd
	    http://www.springframework.org/schema/lang http://www.springframework.org/schema/lang/spring-lang.xsd
	    http://cxf.apache.org/core http://cxf.apache.org/schemas/core.xsd
	    http://cxf.apache.org/jaxws http://cxf.apache.org/schemas/jaxws.xsd">
	<cxf:bus />

	<!-- service factory that will be shared by the WS proxy factories -->
	<bean id="serviceFactory" class="org.apache.cxf.jaxws.support.JaxWsServiceFactoryBean"
scope="prototype">
		<property name="dataBinding">
			<bean class="org.apache.cxf.aegis.databinding.AegisDatabinding" scope="prototype" />
		</property>
		<property name="serviceConfigurations">
			<list>
				<bean class="org.apache.cxf.jaxws.support.JaxWsServiceConfiguration" />
				<bean class="org.apache.cxf.aegis.databinding.AegisServiceConfiguration" />
				<bean class="org.apache.cxf.service.factory.DefaultServiceConfiguration" />
				<bean class="org.apache.cxf.aegis.databinding.XFireCompatibilityServiceConfiguration"
/>
			</list>
		</property>
	</bean>

        <!-- proxy factory for myService -->
	<bean id="myServiceFactory" class="org.apache.cxf.jaxws.JaxWsProxyFactoryBean">
		<property name="serviceClass" value="package.of.MyService" />
		<property name="address" value="http://path/to/MyService" />
		<property name="username" value="uSeRnAmE" />
		<property name="password" value="pAsSwOrD" />
		<property name="serviceFactory" ref="serviceFactory" />
	</bean>

        <!-- This will cause an NPE with CXF >= 2.3.3 -->
	<bean id="myService" class="package.of.MyService" factory-bean="myServiceFactory" factory-method="create"
/>
</beans>
{noformat}

This works perfectly fine using cxf-2.3.2, but fails with NPE using cxf-2.3.3:

{noformat}
Caused by: java.lang.NullPointerException
	at org.apache.cxf.jaxws.JaxWsProxyFactoryBean.getConfiguredName(JaxWsProxyFactoryBean.java:73)
	at org.apache.cxf.frontend.ClientProxyFactoryBean.configureObject(ClientProxyFactoryBean.java:99)
	at org.apache.cxf.frontend.ClientProxyFactoryBean.create(ClientProxyFactoryBean.java:120)
{noformat}

I created a simple project to verify this, I can provide it if necessary, but I only tested
it against an internal-use-only WebService.
But here are the dependencies of it (except the JAR containing the interface of the WS):

{noformat}
aopalliance.jar
commons-logging-1.1.1.jar
cxf-2.3.3.jar (this gives the NPE, but with cxf-2.3.2.jar it works)
neethi-2.0.4.jar
org.springframework.aop-3.1.1.RELEASE.jar
org.springframework.asm-3.1.1.RELEASE.jar
org.springframework.aspects-3.1.1.RELEASE.jar
org.springframework.beans-3.1.1.RELEASE.jar
org.springframework.context-3.1.1.RELEASE.jar
org.springframework.context.support-3.1.1.RELEASE.jar
org.springframework.core-3.1.1.RELEASE.jar
org.springframework.expression-3.1.1.RELEASE.jar
org.springframework.oxm-3.1.1.RELEASE.jar
org.springframework.transaction-3.1.1.RELEASE.jar
org.springframework.web-3.1.1.RELEASE.jar
org.springframework.web.servlet-3.1.1.RELEASE.jar
wsdl4j-1.6.2.jar
XmlSchema-1.4.7.jar
{noformat}

...and here is the main class:

{noformat}
package springcxftest;

import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

public class TestApp {
	private ApplicationContext context;

	public void init() {
		context = new ClassPathXmlApplicationContext(
				"classpath:/appContext.xml");
	}

	public static void main(String[] args) {
		TestApp app = new TestApp();
		app.init();
		System.out.println("App initialized");
	}

}
{noformat}

Using cxf-2.3.3, it will throw the Exception and never get to the "App initialized" message.
I hope this helps to clarify the problem!
                
> NPE in creating client after upgrading from 2.3.2 to 2.3.3
> ----------------------------------------------------------
>
>                 Key: CXF-3377
>                 URL: https://issues.apache.org/jira/browse/CXF-3377
>             Project: CXF
>          Issue Type: Bug
>          Components: JAX-WS Runtime
>    Affects Versions: 2.3.3
>            Reporter: Jara Cesnek
>            Priority: Critical
>             Fix For: Invalid
>
>
> {code}
> org.springframework.beans.factory.BeanDefinitionStoreException: Factory method [public
java.lang.Object org.apache.cxf.jaxws.JaxWsProxyFactoryBean.create()] threw exception; nested
exception is java.lang.NullPointerException
> 	at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:444)
~[spring-2.5.6.jar:2.5.6]
> 	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateUsingFactoryMethod(AbstractAutowireCapableBeanFactory.java:903)
~[spring-2.5.6.jar:2.5.6]
> 	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:817)
~[spring-2.5.6.jar:2.5.6]
> 	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:440)
~[spring-2.5.6.jar:2.5.6]
> 	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory$1.run(AbstractAutowireCapableBeanFactory.java:409)
~[spring-2.5.6.jar:2.5.6]
> 	at java.security.AccessController.doPrivileged(Native Method) ~[na:1.6.0_15]
> 	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:380)
~[spring-2.5.6.jar:2.5.6]
> 	at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:264)
~[spring-2.5.6.jar:2.5.6]
> 	at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)
~[spring-2.5.6.jar:2.5.6]
> 	at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:261)
~[spring-2.5.6.jar:2.5.6]
> 	at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:185)
~[spring-2.5.6.jar:2.5.6]
> 	at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:164)
~[spring-2.5.6.jar:2.5.6]
> 	at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:429)
~[spring-2.5.6.jar:2.5.6]
> 	at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:728)
~[spring-2.5.6.jar:2.5.6]
> 	at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:380)
~[spring-2.5.6.jar:2.5.6]
> 	at cz.marbes.daisy.sysmodules.childcontext.ChildContext.createChildContext(ChildContext.java:119)
~[daisy-core-3.12.8.0-SNAPSHOT.jar:na]
> 	at cz.marbes.daisy.sysmodules.childcontext.BeanFromChildContext.onApplicationEvent(BeanFromChildContext.java:84)
~[daisy-core-3.12.8.0-SNAPSHOT.jar:na]
> 	at org.springframework.context.event.SimpleApplicationEventMulticaster$1.run(SimpleApplicationEventMulticaster.java:78)
~[spring-2.5.6.jar:2.5.6]
> 	at org.springframework.core.task.SyncTaskExecutor.execute(SyncTaskExecutor.java:49)
~[spring-2.5.6.jar:2.5.6]
> 	at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:76)
~[spring-2.5.6.jar:2.5.6]
> 	at org.springframework.context.support.AbstractApplicationContext.publishEvent(AbstractApplicationContext.java:274)
~[spring-2.5.6.jar:2.5.6]
> 	at org.springframework.context.support.AbstractApplicationContext.finishRefresh(AbstractApplicationContext.java:736)
~[spring-2.5.6.jar:2.5.6]
> 	at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:383)
~[spring-2.5.6.jar:2.5.6]
> 	at cz.marbes.daisy.sysmodules.support.SwitchableXmlWebApplicationContext.refresh(SwitchableXmlWebApplicationContext.java:82)
~[daisy-core-3.12.8.0-SNAPSHOT.jar:na]
> 	at org.springframework.web.context.ContextLoader.createWebApplicationContext(ContextLoader.java:255)
~[spring-2.5.6.jar:2.5.6]
> 	at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:199)
~[spring-2.5.6.jar:2.5.6]
> 	at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:45)
~[spring-2.5.6.jar:2.5.6]
> 	at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:3764)
[catalina.jar:na]
> 	at org.apache.catalina.core.StandardContext.start(StandardContext.java:4216) [catalina.jar:na]
> 	at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:760) [catalina.jar:na]
> 	at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:740) [catalina.jar:na]
> 	at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:544) [catalina.jar:na]
> 	at org.apache.catalina.startup.HostConfig.deployDescriptor(HostConfig.java:626) [catalina.jar:na]
> 	at org.apache.catalina.startup.HostConfig.deployDescriptors(HostConfig.java:553) [catalina.jar:na]
> 	at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:488) [catalina.jar:na]
> 	at org.apache.catalina.startup.HostConfig.start(HostConfig.java:1138) [catalina.jar:na]
> 	at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:311) [catalina.jar:na]
> 	at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:120)
[catalina.jar:na]
> 	at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1022) [catalina.jar:na]
> 	at org.apache.catalina.core.StandardHost.start(StandardHost.java:736) [catalina.jar:na]
> 	at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1014) [catalina.jar:na]
> 	at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:443) [catalina.jar:na]
> 	at org.apache.catalina.core.StandardService.start(StandardService.java:448) [catalina.jar:na]
> 	at org.apache.catalina.core.StandardServer.start(StandardServer.java:700) [catalina.jar:na]
> 	at org.apache.catalina.startup.Catalina.start(Catalina.java:552) [catalina.jar:na]
> 	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.6.0_15]
> 	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) ~[na:1.6.0_15]
> 	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
~[na:1.6.0_15]
> 	at java.lang.reflect.Method.invoke(Method.java:597) ~[na:1.6.0_15]
> 	at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:295) [bootstrap.jar:na]
> 	at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:433) [bootstrap.jar:na]
> Caused by: org.springframework.beans.factory.BeanDefinitionStoreException: Factory method
[public java.lang.Object org.apache.cxf.jaxws.JaxWsProxyFactoryBean.create()] threw exception;
nested exception is java.lang.NullPointerException
> 	at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:127)
~[spring-2.5.6.jar:2.5.6]
> 	at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:435)
~[spring-2.5.6.jar:2.5.6]
> 	... 50 common frames omitted
> Caused by: java.lang.NullPointerException: null
> 	at org.apache.cxf.jaxws.JaxWsProxyFactoryBean.getConfiguredName(JaxWsProxyFactoryBean.java:73)
~[cxf-bundle-2.3.3.jar:2.3.3]
> 	at org.apache.cxf.frontend.ClientProxyFactoryBean.configureObject(ClientProxyFactoryBean.java:99)
~[cxf-bundle-2.3.3.jar:2.3.3]
> 	at org.apache.cxf.frontend.ClientProxyFactoryBean.create(ClientProxyFactoryBean.java:120)
~[cxf-bundle-2.3.3.jar:2.3.3]
> 	at org.apache.cxf.jaxws.JaxWsProxyFactoryBean.create(JaxWsProxyFactoryBean.java:133)
~[cxf-bundle-2.3.3.jar:2.3.3]
> 	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.6.0_15]
> 	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) ~[na:1.6.0_15]
> 	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
~[na:1.6.0_15]
> 	at java.lang.reflect.Method.invoke(Method.java:597) ~[na:1.6.0_15]
> 	at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:115)
~[spring-2.5.6.jar:2.5.6]
> 	... 51 common frames omitted
> {code}

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Mime
View raw message