You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-user@axis.apache.org by Martin Gainty <mg...@hotmail.com> on 2007/11/29 01:32:32 UTC

Re: Problem with Using Spring and Hibernate with Axis2

start with a working Spring axis2 webservice sample
http://ws.apache.org/axis2/1_3/spring.html
and iterate to your ultimate goal

M--
----- Original Message -----
From: "robert lazarski" <ro...@gmail.com>
To: <ax...@ws.apache.org>
Sent: Thursday, November 29, 2007 1:32 PM
Subject: Re: Problem with Using Spring and Hibernate with Axis2


> Meant to say 'they should NOT be there
> when using spring beans in your service.xml' .
>
> Robert
>
> On Nov 29, 2007 1:30 PM, robert lazarski <ro...@gmail.com> wrote:
> > Remove 'parameter name="ServiceClass"' entries - they should be there
> > when using spring beans in your service.xml .
> >
> > Beyond that, looks like you have a spring issue and not an axis2 issue
> > - you seem to have problems with this area:
> >
> > >         <bean id="apSecurity"
> > >                 class="com.cvg.ap.service.privateservices.APSecurity">
> > >                 <property name="usersEntity">
> > >                         <ref local="usersEntityProxyBean" />
> > >                 </property>
> > >                 <property name="metadataEntity">
> > >                         <ref local="metadataEntity" />
> > >                 </property>
> > >         </bean>
> >
> > HTH,
> > Robert
> > HTH,
> > Robert
> >
> >
> > On Nov 29, 2007 1:08 PM, ndthuy <nd...@yahoo.com> wrote:
> > >
> > > Hi All,
> > >
> > > I am using Spring and Hibernate with Axis2. I have the problem with
loading
> > > the applicationContext.xml. Does anyone has similar problems?
> > > Attached are service.xml, applicationContext.xml and error meesage.
> > >
> > > Thanks a lot.
> > >
> > > service.xml
> > >
> > > <?xml version="1.0" encoding="UTF-8"?>
> > > <!-- This file was auto-generated from WSDL -->
> > > <!-- by the Apache Axis2 version: 1.3  Built on : Aug 10, 2007
(04:45:47
> > > LKT) -->
> > > <serviceGroup>
> > >         <service name="SpringInit" class="com.cvg.ap.util.SpringInit">
> > >                 <description>This web service initializes
Spring.</description>
> > >                 <parameter name="ServiceClass">
> > >                         sample.spring.service.SpringInit
> > >                 </parameter>
> > >                 <parameter name="ServiceTCCL">composite</parameter>
> > >                 <parameter name="load-on-startup">true</parameter>
> > >                 <operation name="springInit">
> > >                         <messageReceiver
> > >
class="org.apache.axis2.receivers.RawXMLINOutMessageReceiver" />
> > >                 </operation>
> > >         </service>
> > >
> > >         <service name="AdminRetrieveUserService">
> > >                 <messageReceivers>
> > >                         <messageReceiver
mep="http://www.w3.org/ns/wsdl/in-out"
> > >
> > >
class="com.cvg.ap.ws.service.publicservices.adminretrieveuserservice.AdminRe
trieveUserServiceMessageReceiverInOut"
> > > />
> > >                 </messageReceivers>
> > >                 <parameter name="ServiceClass">
> > >
com.cvg.ap.ws.service.publicservices.impl.AdminRetrieveUserServiceImpl
> > >                 </parameter>
> > >                 <parameter name="ServiceObjectSupplier">
> > >
> > >
org.apache.axis2.extensions.spring.receivers.SpringAppContextAwareObjectSupp
lier
> > >                 </parameter>
> > >                 <parameter name="SpringBeanName">
> > >                         springAdminRetrieveUserService
> > >                 </parameter>
> > >                 <parameter name="useOriginalwsdl">true</parameter>
> > >                 <parameter
name="modifyUserWSDLPortAddress">true</parameter>
> > >                 <operation name="retrieveUserProfile"
> > >                         mep="http://www.w3.org/ns/wsdl/in-out">
> > >
<actionMapping>urn:retrieveUserProfile</actionMapping>
> > >                         <outputActionMapping>
> > >
> > >
http://AdminRetrieveUserService.publicservices.service.ws.ap.cvg.com/AdminRe
trieveUserServicePortType/retrieveUserProfileResponse
> > >                         </outputActionMapping>
> > >                 </operation>
> > >         </service>
> > > </serviceGroup>
> > >
> > >
> > > ApplicationContext.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"
> > >
xsi:schemaLocation="http://www.springframework.org/schema/beans
> > > http://www.springframework.org/schema/beans/spring-beans-2.0.xsd">
> > >
> > >         <bean id="applicationContext"
> > >
> > >
class="org.apache.axis2.extensions.spring.receivers.ApplicationContextHolder
"
> > > />
> > >
> > >         <bean id="sessionFactory"
> > >
class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
> > >                 <property name="configLocation"
> > >                         value="classpath:hibernate.cfg.xml">
> > >                 </property>
> > >                 <property name="dataSource">
> > >                         <ref local="c3poDataSource" />
> > >                 </property>
> > >         </bean>
> > >         <bean id="propertyConfigurer"
> > >
> > >
class="org.springframework.beans.factory.config.PropertyPlaceholderConfigure
r">
> > >                 <property name="location">
> > >                         <value>
> > >
> > >
file:${ACCESSPOINT_WS_CFG_HOME}/accesspoint_ws/config/accesspoint_ws.propert
ies
> > >                         </value>
> > >                 </property>
> > >         </bean>
> > >         <bean id="c3poDataSource"
> > >                 class="com.mchange.v2.c3p0.ComboPooledDataSource"
> > >                 destroy-method="close">
> > >                 <property name="driverClass">
> > >                         <value>oracle.jdbc.driver.OracleDriver</value>
> > >                 </property>
> > >                 <property name="jdbcUrl">
> > >                         <value>
> > >
jdbc:oracle:thin:@${jdbc.host}:${jdbc.port}:${jdbc.database}
> > >                         </value>
> > >                 </property>
> > >
> > >                 <property name="properties">
> > >                         <props>
> > >                                 <prop
key="user">${jdbc.username}</prop>
> > >                                 <prop key="password">
> > >
${ACCESSPOINT_DB_PWD_DECRYPTED}
> > >                                 </prop>
> > >                                 <prop key="c3p0.min_size">
> > >                                         ${jdbc.connectionPool.minSize}
> > >                                 </prop>
> > >                                 <prop key="c3p0.max_size">
> > >                                         ${jdbc.connectionPool.maxSize}
> > >                                 </prop>
> > >                                 <prop key="c3p0.acquire_increment">
> > >
${jdbc.connectionPool.increment}
> > >                                 </prop>
> > >                                 <prop
key="c3p0.idle_test_period">100</prop>
> > >                         </props>
> > >                 </property>
> > >         </bean>
> > >
> > >
> > >         <bean id="GroupsDAO" class="com.cvg.ap.dao.GroupsDAO">
> > >                 <property name="sessionFactory">
> > >                         <ref bean="sessionFactory" />
> > >                 </property>
> > >         </bean>
> > >         <bean id="UsersDAO" class="com.cvg.ap.dao.UsersDAO">
> > >                 <property name="hibernateTemplate">
> > >                         <ref bean="hibernateTemplate" />
> > >                 </property>
> > >         </bean>
> > >
> > >
> > >         <bean id="MetadataDAO" class="com.cvg.ap.dao.MetadataDAO">
> > >                 <property name="sessionFactory">
> > >                         <ref bean="sessionFactory" />
> > >                 </property>
> > >         </bean>
> > >
> > >
> > >         <bean id="hibernateTemplate"
> > >
class="org.springframework.orm.hibernate3.HibernateTemplate">
> > >                 <property name="sessionFactory">
> > >                         <ref bean="sessionFactory" />
> > >                 </property>
> > >         </bean>
> > >
> > >
> > >         <bean id="transactionManager"
> > >
class="org.springframework.orm.hibernate3.HibernateTransactionManager">
> > >                 <property name="sessionFactory">
> > >                         <ref local="sessionFactory" />
> > >                 </property>
> > >         </bean>
> > >
> > >         <bean id="hibernateInterceptor"
> > >
class="org.springframework.orm.hibernate3.HibernateInterceptor">
> > >                 <property name="sessionFactory">
> > >                         <ref bean="sessionFactory" />
> > >                 </property>
> > >         </bean>
> > >
> > >         <bean id="usersEntityInterceptor"
> > >
> > >
class="org.springframework.transaction.interceptor.TransactionInterceptor">
> > >                 <property name="transactionManager">
> > >                         <ref local="transactionManager" />
> > >                 </property>
> > >                 <property name="transactionAttributes">
> > >                         <props>
> > >                                 <prop
key="get*">PROPAGATION_REQUIRED,readOnly</prop>
> > >                                 <prop
key="save*">PROPAGATION_REQUIRED</prop>
> > >                                 <prop
key="update*">PROPAGATION_REQUIRED</prop>
> > >                                 <prop
key="delete*">PROPAGATION_REQUIRED</prop>
> > >                                 <prop
key="updateUserForSuccessfulAuthentication*">
> > >                                         PROPAGATION_REQUIRED
> > >                                 </prop>
> > >                                 <prop
key="updateUserForFailedAuthentication*">
> > >                                         PROPAGATION_REQUIRED
> > >                                 </prop>
> > >                         </props>
> > >                 </property>
> > >         </bean>
> > >
> > >         <bean id="usersEntityProxyTargetBean"
> > >                 class="com.cvg.ap.dbms.UsersEntity">
> > >                 <property name="apUsersDAO">
> > >                         <ref local="UsersDAO" />
> > >                 </property>
> > >         </bean>
> > >
> > >         <bean id="usersEntityProxyBean"
> > >
class="org.springframework.aop.framework.ProxyFactoryBean">
> > >                 <property name="proxyTargetClass">
> > >                         <value>true</value>
> > >                 </property>
> > >                 <property name="interceptorNames">
> > >                         <list>
> > >                                 <value>hibernateInterceptor</value>
> > >                                 <value>usersEntityInterceptor</value>
> > >                         </list>
> > >                 </property>
> > >                 <property name="target">
> > >                         <ref local="usersEntityProxyTargetBean" />
> > >                 </property>
> > >         </bean>
> > >
> > >         <bean id="metadataEntity"
class="com.cvg.ap.dbms.MetadataEntity">
> > >                 <property name="metadataDAO">
> > >                         <ref local="MetadataDAO" />
> > >                 </property>
> > >         </bean>
> > >
> > >         <bean id="acmServicesEntity"
> > >                 class="com.cvg.ap.dbms.ACMServicesEntity">
> > >                 <property name="acmServicesDAO">
> > >                         <ref local="AcmServiceDAO" />
> > >                 </property>
> > >         </bean>
> > >
> > >         <bean id="apSecurity"
> > >                 class="com.cvg.ap.service.privateservices.APSecurity">
> > >                 <property name="usersEntity">
> > >                         <ref local="usersEntityProxyBean" />
> > >                 </property>
> > >                 <property name="metadataEntity">
> > >                         <ref local="metadataEntity" />
> > >                 </property>
> > >         </bean>
> > >
> > >         <bean id="groupsEntity" class="com.cvg.ap.dbms.GroupsEntity">
> > >                 <property name="groupsDAO">
> > >                         <ref local="GroupsDAO" />
> > >                 </property>
> > >         </bean>
> > >
> > >         <bean id="apUserManagement"
> > >
class="com.cvg.ap.service.privateservices.APUserManagement">
> > >                 <property name="usersEntity">
> > >                         <ref local="usersEntityProxyBean" />
> > >                 </property>
> > >         </bean>
> > >
> > >         <bean id="adminRetrieveUserService"
> > >
> > >
class="com.cvg.ap.service.publicservices.impl.AdminRetrieveUserServiceImpl">
> > >                 <property name="apSecurity">
> > >                         <ref local="apSecurity" />
> > >                 </property>
> > >                 <property name="apUserManagement">
> > >                         <ref local="apUserManagement" />
> > >                 </property>
> > >         </bean>
> > >
> > >
> > >
> > >         <!-- Axis2 Web Service, but to Spring, its just another bean
that has
> > > dependencies -->
> > >         <bean id="springAdminRetrieveUserService"
> > >
> > >
class="com.cvg.ap.ws.service.publicservices.impl.AdminRetrieveUserServiceImp
l">
> > >                 <property name="adminRetrieveUserService"
> > >                         ref="adminRetrieveUserService" />
> > >         </bean>
> > > </beans>
> > >
> > >
> > > Errors:
> > >
> > > org.apache.axis2.deployment.DeploymentException: Error creating bean
with
> > > name 'apSecurity' defined in class path resource
[applicationContext.xml]:
> > > Cannot resolve reference to bean 'usersEntityProxyBean' while setting
bean
> > > property 'usersEntity'; nested exception is
> > > org.springframework.beans.factory.BeanCreationException: Error
creating bean
> > > with name 'usersEntityProxyBean': FactoryBean threw exception on
object
> > > creation; nested exception is java.lang.NoClassDefFoundError
> > >         at
> > >
org.apache.axis2.deployment.ServiceGroupBuilder.populateServiceGroup(Service
GroupBuilder.java:106)
> > >         at
> > >
org.apache.axis2.deployment.repository.util.ArchiveReader.buildServiceGroup(
ArchiveReader.java:103)
> > >         at
> > >
org.apache.axis2.deployment.repository.util.ArchiveReader.processServiceGrou
p(ArchiveReader.java:172)
> > >         at
> > >
org.apache.axis2.deployment.ServiceDeployer.deploy(ServiceDeployer.java:78)
> > >         at
> > >
org.apache.axis2.deployment.repository.util.DeploymentFileData.deploy(Deploy
mentFileData.java:137)
> > >         at
> > >
org.apache.axis2.deployment.DeploymentEngine.doDeploy(DeploymentEngine.java:
571)
> > >         at
> > >
org.apache.axis2.deployment.repository.util.WSInfoList.update(WSInfoList.jav
a:141)
> > >         at
> > >
org.apache.axis2.deployment.RepositoryListener.update(RepositoryListener.jav
a:318)
> > >         at
> > >
org.apache.axis2.deployment.RepositoryListener.checkServices(RepositoryListe
ner.java:220)
> > >         at
> > >
org.apache.axis2.deployment.DeploymentEngine.loadServices(DeploymentEngine.j
ava:118)
> > >         at
> > >
org.apache.axis2.deployment.WarBasedAxisConfigurator.loadServices(WarBasedAx
isConfigurator.java:272)
> > >         at
> > >
org.apache.axis2.context.ConfigurationContextFactory.createConfigurationCont
ext(ConfigurationContextFactory.java:78)
> > >         at
> > >
org.apache.axis2.transport.http.AxisServlet.initConfigContext(AxisServlet.ja
va:500)
> > >         at
org.apache.axis2.transport.http.AxisServlet.init(AxisServlet.java:420)
> > >         at
> > >
org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:11
39)
> > >         at
org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:966)
> > >         at
> > >
org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:
3956)
> > >         at
> > >
org.apache.catalina.core.StandardContext.start(StandardContext.java:4230)
> > >         at
> > >
org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:7
60)
> > >         at
org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:740)
> > >         at
org.apache.catalina.core.StandardHost.addChild(StandardHost.java:544)
> > >         at
org.apache.catalina.startup.HostConfig.deployWAR(HostConfig.java:825)
> > >         at
org.apache.catalina.startup.HostConfig.deployWARs(HostConfig.java:714)
> > >         at
org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:490)
> > >         at
org.apache.catalina.startup.HostConfig.start(HostConfig.java:1138)
> > >         at
> > >
org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:311)
> > >         at
> > >
org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSuppor
t.java:120)
> > >         at
org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1022)
> > >         at
org.apache.catalina.core.StandardHost.start(StandardHost.java:736)
> > >         at
org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1014)
> > >         at
org.apache.catalina.core.StandardEngine.start(StandardEngine.java:443)
> > >         at
org.apache.catalina.core.StandardService.start(StandardService.java:448)
> > >         at
org.apache.catalina.core.StandardServer.start(StandardServer.java:700)
> > >         at
org.apache.catalina.startup.Catalina.start(Catalina.java:552)
> > >         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:585)
> > >         at
org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:295)
> > >         at
org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:433)
> > > Caused by: org.apache.axis2.deployment.DeploymentException: Error
creating
> > > bean with name 'apSecurity' defined in class path resource
> > > [applicationContext.xml]: Cannot resolve reference to bean
> > > 'usersEntityProxyBean' while setting bean property 'usersEntity';
nested
> > > exception is org.springframework.beans.factory.BeanCreationException:
Error
> > > creating bean with name 'usersEntityProxyBean': FactoryBean threw
exception
> > > on object creation; nested exception is java.lang.NoClassDefFoundError
> > >         at
> > >
org.apache.axis2.deployment.ServiceBuilder.populateService(ServiceBuilder.ja
va:389)
> > >         at
> > >
org.apache.axis2.deployment.ServiceGroupBuilder.populateServiceGroup(Service
GroupBuilder.java:101)
> > >         ... 39 more
> > > Caused by: org.apache.axis2.deployment.DeploymentException: Error
creating
> > > bean with name 'apSecurity' defined in class path resource
> > > [applicationContext.xml]: Cannot resolve reference to bean
> > > 'usersEntityProxyBean' while setting bean property 'usersEntity';
nested
> > > exception is org.springframework.beans.factory.BeanCreationException:
Error
> > > creating bean with name 'usersEntityProxyBean': FactoryBean threw
exception
> > > on object creation; nested exception is java.lang.NoClassDefFoundError
> > >         at
> > >
org.apache.axis2.deployment.ServiceBuilder.loadServiceLifeCycleClass(Service
Builder.java:473)
> > >         at
> > >
org.apache.axis2.deployment.ServiceBuilder.populateService(ServiceBuilder.ja
va:184)
> > >         ... 40 more
> > > Caused by: org.springframework.beans.factory.BeanCreationException:
Error
> > > creating bean with name 'apSecurity' defined in class path resource
> > > [applicationContext.xml]: Cannot resolve reference to bean
> > > 'usersEntityProxyBean' while setting bean property 'usersEntity';
nested
> > > exception is org.springframework.beans.factory.BeanCreationException:
Error
> > > creating bean with name 'usersEntityProxyBean': FactoryBean threw
exception
> > > on object creation; nested exception is java.lang.NoClassDefFoundError
> > >         at
> > >
org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolv
eReference(BeanDefinitionValueResolver.java:275)
> > >         at
> > >
org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolv
eValueIfNecessary(BeanDefinitionValueResolver.java:110)
> > >         at
> > >
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory
applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1095)
> > >         at
> > >
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory
populateBean(AbstractAutowireCapableBeanFactory.java:857)
> > >         at
> > >
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory
createBean(AbstractAutowireCapableBeanFactory.java:423)
> > >         at
> > >
org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(Ab
stractBeanFactory.java:249)
> > >         at
> > >
org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSi
ngleton(DefaultSingletonBeanRegistry.java:155)
> > >         at
> > >
org.springframework.beans.factory.support.AbstractBeanFactory.getBean(Abstra
ctBeanFactory.java:246)
> > >         at
> > >
org.springframework.beans.factory.support.AbstractBeanFactory.getBean(Abstra
ctBeanFactory.java:160)
> > >         at
> > >
org.springframework.beans.factory.support.DefaultListableBeanFactory.preInst
antiateSingletons(DefaultListableBeanFactory.java:291)
> > >         at
> > >
org.springframework.context.support.AbstractApplicationContext.refresh(Abstr
actApplicationContext.java:352)
> > >         at com.cvg.ap.util.SpringInit.startUp(SpringInit.java:60)
> > >         at
> > >
org.apache.axis2.deployment.ServiceBuilder.loadServiceLifeCycleClass(Service
Builder.java:469)
> > >         ... 41 more
> > > Caused by: org.springframework.beans.factory.BeanCreationException:
Error
> > > creating bean with name 'usersEntityProxyBean': FactoryBean threw
exception
> > > on object creation; nested exception is java.lang.NoClassDefFoundError
> > >         at
> > >
org.springframework.beans.factory.support.AbstractBeanFactory.getObjectFromF
actoryBean(AbstractBeanFactory.java:1252)
> > >         at
> > >
org.springframework.beans.factory.support.AbstractBeanFactory.getObjectForBe
anInstance(AbstractBeanFactory.java:1217)
> > >         at
> > >
org.springframework.beans.factory.support.AbstractBeanFactory.getBean(Abstra
ctBeanFactory.java:206)
> > >         at
> > >
org.springframework.beans.factory.support.AbstractBeanFactory.getBean(Abstra
ctBeanFactory.java:160)
> > >         at
> > >
org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolv
eReference(BeanDefinitionValueResolver.java:267)
> > >         ... 53 more
> > > Caused by: java.lang.NoClassDefFoundError
> > >         at
> > >
org.springframework.aop.framework.Cglib2AopProxy.createEnhancer(Cglib2AopPro
xy.java:223)
> > >         at
> > >
org.springframework.aop.framework.Cglib2AopProxy.getProxy(Cglib2AopProxy.jav
a:150)
> > >         at
> > >
org.springframework.aop.framework.ProxyFactoryBean.getProxy(ProxyFactoryBean
java:347)
> > >         at
> > >
org.springframework.aop.framework.ProxyFactoryBean.getSingletonInstance(Prox
yFactoryBean.java:302)
> > >         at
> > >
org.springframework.aop.framework.ProxyFactoryBean.getObject(ProxyFactoryBea
n.java:228)
> > >         at
> > >
org.springframework.beans.factory.support.AbstractBeanFactory.getObjectFromF
actoryBean(AbstractBeanFactory.java:1246)
> > >         ... 57 more
> > >
> > > --
> > > View this message in context:
http://www.nabble.com/Problem-with-Using-Spring-and-Hibernate-with-Axis2-tf4
898949.html#a14031519
> > > Sent from the Axis - User mailing list archive at Nabble.com.
> > >
> > >
> > > ---------------------------------------------------------------------

> > > To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
> > > For additional commands, e-mail: axis-user-help@ws.apache.org
> > >
> > >
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
> For additional commands, e-mail: axis-user-help@ws.apache.org
>
>


---------------------------------------------------------------------
To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-user-help@ws.apache.org