You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cxf.apache.org by Saiful Haqqi <sa...@gmail.com> on 2008/10/10 00:51:03 UTC
Spring + Hibernate + Apache CXF Error
hi all,
I try build WS with apache cxf + Sring + Hibernate, but get some error when
implementation with hibernate.
1. Without Hibernate
my [appContext.xml]
<?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:context="http://www.springframework.org/schema/context"
xmlns:cxf="http://cxf.apache.org/core"
xmlns:jaxws="http://cxf.apache.org/jaxws"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context-2.5.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"
>
<!-- Load CXF modules from cxf.jar -->
<import resource="classpath:META-INF/cxf/cxf.xml" />
<import resource="classpath:META-INF/cxf/cxf-extension-soap.xml" />
<import resource="classpath:META-INF/cxf/cxf-servlet.xml" />
<!-- Enable message logging using the CXF logging feature -->
<cxf:bus>
<cxf:features>
<cxf:logging/>
</cxf:features>
</cxf:bus>
<!-- Service endpoint -->
<!-- See http://incubator.apache.org/cxf/faq.html regarding CXF + Spring
AOP -->
<jaxws:endpoint id="contactUsService"
implementor="contactus.ContactUsServiceImpl"
address="/contactus">
</jaxws:endpoint>
<!-- EOF -->
</beans>
that WS work and can response dump data with method
http://localhost:8080/SpringWS/contactus/getMessages.
2. With Hibernate
my [appContext.xml]
<?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:context="http://www.springframework.org/schema/context"
xmlns:cxf="http://cxf.apache.org/core"
xmlns:jaxws="http://cxf.apache.org/jaxws"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context-2.5.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"
>
<!-- Load CXF modules from cxf.jar -->
<import resource="classpath:META-INF/cxf/cxf.xml" />
<import resource="classpath:META-INF/cxf/cxf-extension-soap.xml" />
<import resource="classpath:META-INF/cxf/cxf-servlet.xml" />
<!-- Enable message logging using the CXF logging feature -->
<cxf:bus>
<cxf:features>
<cxf:logging/>
</cxf:features>
</cxf:bus>
<!-- Service endpoint -->
<!-- See http://incubator.apache.org/cxf/faq.html regarding CXF + Spring
AOP -->
<jaxws:endpoint id="contactUsService"
implementor="contactus.ContactUsServiceImpl"
address="/contactus">
</jaxws:endpoint>
<!-- web service registered -->
<jaxws:endpoint id="occHwDailyService"
implementor="com.wesolve.dvas.spring.ws.domain.service.OccHwDailyServiceImpl"
address="/occHwDaily">
</jaxws:endpoint>
<!-- Loader -->
<bean
id="propertyConfigurer"
class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
<property name="location" value="classpath:jdbc.properties"/>
</bean>
<!-- Hibernate Session Factory -->
<bean
id="dataSource"
class="org.apache.commons.dbcp.BasicDataSource"
destroy-method="close">
<property name="driverClassName">
<value>${jdbc.driver}</value>
</property>
<property name="url">
<value>${jdbc.url}</value>
</property>
<property name="username">
<value>${jdbc.username}</value>
</property>
<property name="password">
<value>${jdbc.password}</value>
</property>
</bean>
<!-- hibernate mapper -->
<bean
id="factory"
class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
<property name="configLocation"
value="classpath:hibernate.cfg.xml"/>
<property name="hibernateProperties">
<props>
<prop key="hibernate.dialect">${hibernate.dialect}
</prop>
<prop key="hibernate.show_sql">${hibernate.show_sql}
</prop>
</props>
</property>
<property name="dataSource">
<ref bean="dataSource"/>
</property>
</bean>
<!-- bean's DAO Hibernate -->
<bean
id="WinOccHwDailyBean"
class="com.wesolve.dvas.spring.hibernate.dao.WinOccHwDailyDaoImpl">
<property name="sessionFactory" ref="factory"/>
</bean>
<!-- EOF -->
</beans>
that will get exception
10 Okt 08 5:48:16
org.springframework.beans.factory.support.DefaultSingletonBeanRegistry
destroySingletons
INFO: Destroying singletons in
org.springframework.beans.factory.support.DefaultListableBeanFactory@156d7c8:
defining beans
[cxf,org.apache.cxf.bus.spring.BusWiringBeanFactoryPostProcessor,org.apache.cxf.bus.spring.Jsr250BeanPostProcessor,org.apache.cxf.bus.spring.BusExtensionPostProcessor,org.apache.cxf.resource.ResourceManager,org.apache.cxf.configuration.Configurer,org.apache.cxf.binding.BindingFactoryManager,org.apache.cxf.transport.DestinationFactoryManager,org.apache.cxf.transport.ConduitInitiatorManager,org.apache.cxf.wsdl.WSDLManager,org.apache.cxf.phase.PhaseManager,org.apache.cxf.workqueue.WorkQueueManager,org.apache.cxf.buslifecycle.BusLifeCycleManager,org.apache.cxf.endpoint.ServerRegistry,org.apache.cxf.endpoint.ServerLifeCycleManager,org.apache.cxf.endpoint.ClientLifeCycleManager,org.apache.cxf.transports.http.QueryHandlerRegistry,org.apache.cxf.endpoint.EndpointResolverRegistry,org.apache.cxf.headers.HeaderManager,org.apache.cxf.catalog.OASISCatalogManager,org.apache.cxf.endpoint.ServiceContractResolverRegistry,org.apache.cxf.binding.soap.SoapBindingFactory,org.apache.cxf.binding.soap.SoapTransportFactory,org.apache.cxf.binding.soap.customEditorConfigurer,org.apache.cxf.transport.servlet.ServletTransportFactory,contactUsService,occHwDailyService,propertyConfigurer,dataSource,factory,WinOccHwDailyBean];
root of factory hierarchy
10 Okt 08 5:48:16 org.springframework.web.context.ContextLoader
initWebApplicationContext
SEVERE: Context initialization failed
org.springframework.beans.factory.BeanCreationException: Error creating bean
with name 'factory' defined in ServletContext resource
[/WEB-INF/appContext.xml]: Invocation of init method failed; nested
exception is java.lang.NoSuchMethodError:
org.objectweb.asm.ClassVisitor.visit(IILjava/lang/String;Ljava/lang/String;[Ljava/lang/String;Ljava/lang/String;)V
at
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1362)
at
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:540)
at
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory$1.run(AbstractAutowireCapableBeanFactory.java:485)
at java.security.AccessController.doPrivileged(Native Method)
at
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:455)
at
org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:251)
Any body known about this exception, i read some site that is bug of ASM
with CGLLIB where using Spring, Hibernate, and Apache CXF?
~ saiful haqqi ~
--
View this message in context: http://www.nabble.com/Spring-%2B-Hibernate-%2B-Apache-CXF-Error-tp19908825p19908825.html
Sent from the cxf-dev mailing list archive at Nabble.com.
Re: Spring + Hibernate + Apache CXF Error
Posted by Saiful Haqqi <sa...@gmail.com>.
Saiful Haqqi wrote:
>
>> The version of you are using asm jars (with
>> org.objectweb.asm.ClassVisitor)
>> is not match with current spring ,try a newer.
>>
>> Good luck!
>
> I am just use asm-all and cglib-nodep now and does't get any exception
> when deploying spring application.
>
> But I get new exception when call the method of web service
>
> INFO: Application has thrown exception, unwinding now
> org.apache.cxf.interceptor.Fault: ApplicationObjectSupport instance
> [OccHwDailyServiceImpl@a33414] does not run in an ApplicationContext
> at
> org.apache.cxf.service.invoker.AbstractInvoker.createFault(AbstractInvoker.java:119)
>
> that is still related with asm or cglib ... ?!
>
> ~ saiful haqqi ~
>
>
--
View this message in context: http://www.nabble.com/Spring-%2B-Hibernate-%2B-Apache-CXF-Error-tp19908825p19910764.html
Sent from the cxf-dev mailing list archive at Nabble.com.
Re: Spring + Hibernate + Apache CXF Error
Posted by Willem Jiang <wi...@gmail.com>.
Please use the CXF shipped asm for CXF, and use the cglib-nodep for
hibernate.
Willem
Saiful Haqqi wrote:
>> The version of you are using asm jars (with org.objectweb.asm.ClassVisitor)
>> is not match with current spring ,try a newer.
>>
>> Good luck!
>>
>
> In my wat file containt with more than one asm jar file
>
> 1. asm <--- hibernate
> 2. asm-2.2.3 <-- apache cxf
> 3. asm-all-3.1 <--- my own add
> 4. asm-attrs <--- hibernate
> 5. cglib-2.1.3 <-- hibernate
> 6. cglib-nodep-2.1_3 <---- my own add
>
> with one is the right jar file asm-all-3.1 or cglib-nodep-2.1_3 or both must
> be included in my war file?
>
> ~ saiful haqqi ~
>
>
Re: Spring + Hibernate + Apache CXF Error
Posted by Saiful Haqqi <sa...@gmail.com>.
> The version of you are using asm jars (with org.objectweb.asm.ClassVisitor)
> is not match with current spring ,try a newer.
>
> Good luck!
In my wat file containt with more than one asm jar file
1. asm <--- hibernate
2. asm-2.2.3 <-- apache cxf
3. asm-all-3.1 <--- my own add
4. asm-attrs <--- hibernate
5. cglib-2.1.3 <-- hibernate
6. cglib-nodep-2.1_3 <---- my own add
with one is the right jar file asm-all-3.1 or cglib-nodep-2.1_3 or both must
be included in my war file?
~ saiful haqqi ~
--
View this message in context: http://www.nabble.com/Spring-%2B-Hibernate-%2B-Apache-CXF-Error-tp19908825p19910531.html
Sent from the cxf-dev mailing list archive at Nabble.com.
Re: Spring + Hibernate + Apache CXF Error
Posted by 王洪伟 <te...@gmail.com>.
The version of you are using asm jars (with org.objectweb.asm.ClassVisitor)
is not match with current spring ,try a newer.
Good luck!
2008/10/10 Saiful Haqqi <sa...@gmail.com>
>
> hi all,
>
> I try build WS with apache cxf + Sring + Hibernate, but get some error when
> implementation with hibernate.
>
> 1. Without Hibernate
>
> my [appContext.xml]
>
> <?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:context="http://www.springframework.org/schema/context"
> xmlns:cxf="http://cxf.apache.org/core"
> xmlns:jaxws="http://cxf.apache.org/jaxws"
> xsi:schemaLocation="http://www.springframework.org/schema/beans
> http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
> http://www.springframework.org/schema/context
>
> http://www.springframework.org/schema/context/spring-context-2.5.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"
> >
>
> <!-- Load CXF modules from cxf.jar -->
> <import resource="classpath:META-INF/cxf/cxf.xml" />
> <import resource="classpath:META-INF/cxf/cxf-extension-soap.xml" />
> <import resource="classpath:META-INF/cxf/cxf-servlet.xml" />
>
> <!-- Enable message logging using the CXF logging feature -->
> <cxf:bus>
> <cxf:features>
> <cxf:logging/>
> </cxf:features>
> </cxf:bus>
>
> <!-- Service endpoint -->
> <!-- See http://incubator.apache.org/cxf/faq.html regarding CXF +
> Spring
> AOP -->
> <jaxws:endpoint id="contactUsService"
> implementor="contactus.ContactUsServiceImpl"
> address="/contactus">
> </jaxws:endpoint>
>
> <!-- EOF -->
> </beans>
>
> that WS work and can response dump data with method
> http://localhost:8080/SpringWS/contactus/getMessages.
>
> 2. With Hibernate
>
> my [appContext.xml]
>
> <?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:context="http://www.springframework.org/schema/context"
> xmlns:cxf="http://cxf.apache.org/core"
> xmlns:jaxws="http://cxf.apache.org/jaxws"
> xsi:schemaLocation="http://www.springframework.org/schema/beans
> http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
> http://www.springframework.org/schema/context
>
> http://www.springframework.org/schema/context/spring-context-2.5.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"
> >
>
> <!-- Load CXF modules from cxf.jar -->
> <import resource="classpath:META-INF/cxf/cxf.xml" />
> <import resource="classpath:META-INF/cxf/cxf-extension-soap.xml" />
> <import resource="classpath:META-INF/cxf/cxf-servlet.xml" />
>
> <!-- Enable message logging using the CXF logging feature -->
> <cxf:bus>
> <cxf:features>
> <cxf:logging/>
> </cxf:features>
> </cxf:bus>
>
> <!-- Service endpoint -->
> <!-- See http://incubator.apache.org/cxf/faq.html regarding CXF +
> Spring
> AOP -->
> <jaxws:endpoint id="contactUsService"
> implementor="contactus.ContactUsServiceImpl"
> address="/contactus">
> </jaxws:endpoint>
>
> <!-- web service registered -->
> <jaxws:endpoint id="occHwDailyService"
>
>
> implementor="com.wesolve.dvas.spring.ws.domain.service.OccHwDailyServiceImpl"
> address="/occHwDaily">
> </jaxws:endpoint>
>
> <!-- Loader -->
> <bean
> id="propertyConfigurer"
>
> class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
> <property name="location" value="classpath:jdbc.properties"/>
> </bean>
>
> <!-- Hibernate Session Factory -->
> <bean
> id="dataSource"
> class="org.apache.commons.dbcp.BasicDataSource"
> destroy-method="close">
> <property name="driverClassName">
> <value>${jdbc.driver}</value>
> </property>
> <property name="url">
> <value>${jdbc.url}</value>
> </property>
> <property name="username">
> <value>${jdbc.username}</value>
> </property>
> <property name="password">
> <value>${jdbc.password}</value>
> </property>
> </bean>
>
> <!-- hibernate mapper -->
> <bean
> id="factory"
> class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
> <property name="configLocation"
> value="classpath:hibernate.cfg.xml"/>
> <property name="hibernateProperties">
> <props>
> <prop key="hibernate.dialect">${hibernate.dialect}
> </prop>
> <prop key="hibernate.show_sql">${hibernate.show_sql}
> </prop>
> </props>
> </property>
> <property name="dataSource">
> <ref bean="dataSource"/>
> </property>
> </bean>
>
> <!-- bean's DAO Hibernate -->
> <bean
> id="WinOccHwDailyBean"
> class="com.wesolve.dvas.spring.hibernate.dao.WinOccHwDailyDaoImpl">
> <property name="sessionFactory" ref="factory"/>
> </bean>
>
> <!-- EOF -->
> </beans>
>
> that will get exception
> 10 Okt 08 5:48:16
> org.springframework.beans.factory.support.DefaultSingletonBeanRegistry
> destroySingletons
> INFO: Destroying singletons in
>
> org.springframework.beans.factory.support.DefaultListableBeanFactory@156d7c8
> :
> defining beans
>
> [cxf,org.apache.cxf.bus.spring.BusWiringBeanFactoryPostProcessor,org.apache.cxf.bus.spring.Jsr250BeanPostProcessor,org.apache.cxf.bus.spring.BusExtensionPostProcessor,org.apache.cxf.resource.ResourceManager,org.apache.cxf.configuration.Configurer,org.apache.cxf.binding.BindingFactoryManager,org.apache.cxf.transport.DestinationFactoryManager,org.apache.cxf.transport.ConduitInitiatorManager,org.apache.cxf.wsdl.WSDLManager,org.apache.cxf.phase.PhaseManager,org.apache.cxf.workqueue.WorkQueueManager,org.apache.cxf.buslifecycle.BusLifeCycleManager,org.apache.cxf.endpoint.ServerRegistry,org.apache.cxf.endpoint.ServerLifeCycleManager,org.apache.cxf.endpoint.ClientLifeCycleManager,org.apache.cxf.transports.http.QueryHandlerRegistry,org.apache.cxf.endpoint.EndpointResolverRegistry,org.apache.cxf.headers.HeaderManager,org.apache.cxf.catalog.OASISCatalogManager,org.apache.cxf.endpoint.ServiceContractResolverRegistry,org.apache.cxf.binding.soap.SoapBindingFactory,org.apache.cxf.binding.soap.SoapTransportFactory,org.apache.cxf.binding.soap.customEditorConfigurer,org.apache.cxf.transport.servlet.ServletTransportFactory,contactUsService,occHwDailyService,propertyConfigurer,dataSource,factory,WinOccHwDailyBean];
> root of factory hierarchy
> 10 Okt 08 5:48:16 org.springframework.web.context.ContextLoader
> initWebApplicationContext
> SEVERE: Context initialization failed
> org.springframework.beans.factory.BeanCreationException: Error creating
> bean
> with name 'factory' defined in ServletContext resource
> [/WEB-INF/appContext.xml]: Invocation of init method failed; nested
> exception is java.lang.NoSuchMethodError:
>
> org.objectweb.asm.ClassVisitor.visit(IILjava/lang/String;Ljava/lang/String;[Ljava/lang/String;Ljava/lang/String;)V
> at
>
> org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1362)
> at
>
> org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:540)
> at
>
> org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory$1.run(AbstractAutowireCapableBeanFactory.java:485)
> at java.security.AccessController.doPrivileged(Native Method)
> at
>
> org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:455)
> at
>
> org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:251)
>
> Any body known about this exception, i read some site that is bug of ASM
> with CGLLIB where using Spring, Hibernate, and Apache CXF?
>
> ~ saiful haqqi ~
>
> --
> View this message in context:
> http://www.nabble.com/Spring-%2B-Hibernate-%2B-Apache-CXF-Error-tp19908825p19908825.html
> Sent from the cxf-dev mailing list archive at Nabble.com.
>
>