If you can share the testcase, we can take a look.

Btw, do you want to upgrade to Tuscany 2.x? We have enhanced the spring 
integration quite a bit in the new code?

Raymond Feng
Sent from my iPhone

On May 26, 2011, at 11:02 AM, Anubhav Jain <[email protected]> wrote:

> Hi Raymond,
> 
>  
> 
> Thanks for your prompt response.
> 
>  
> 
> I already have the dependency added.
> 
>  
> 
> Also if I don’t expose the service as a Tuscany component and use it directly 
> by loading the beans.xml using XMLBeanFactory then everything works fine.
> 
>  
> 
> Code :-
> 
>  
> 
> FileSystemResource res = new FileSystemResource("spring/beans.xml");
> 
> XmlBeanFactory springFactory = new XmlBeanFactory(res);
> 
> DataService dataService = (DataService) springFactory.getBean("dataService");
> 
>  
> 
> Moreover, the was that is packed, has the spring-orm.jar in the lib folder, 
> so the corresponding class file is present, but the classloader is unable to 
> load it.
> 
>  
> 
> Do I need to add anything to my web.xml ?
> 
>  
> 
> Thanks
> 
> Anubhav
> 
>  
> 
> From: Raymond Feng [mailto:[email protected]] 
> Sent: Thursday, May 26, 2011 10:14 PM
> To: [email protected]
> Subject: Re: Tucany - Spring+Hibernate - ClassNotFoundException: 
> org.springframework.orm.hibernate3.annotation.AnnotationSessionFactoryBean
> 
>  
> 
> Can you try to add the following dependency?
> 
>  
> 
> <dependency>
>     <groupId>org.springframework</groupId>
>     <artifactId>spring-orm</artifactId>
>     <version>3.0.5.RELEASE</version>
> </dependency>
>  
> 
> Thanks,
> 
> Raymond
> 
> ________________________________________________________________ 
> 
> Raymond Feng
> 
> [email protected]
> Apache Tuscany PMC member and committer: tuscany.apache.org
> Co-author of Tuscany SCA In Action book: www.tuscanyinaction.com
> Personal Web Site: www.enjoyjava.com
> 
> ________________________________________________________________
> 
>  
> 
> On May 26, 2011, at 5:37 AM, Anubhav Jain wrote:
> 
> 
> 
> 
> Hi All,
> 
>  
> 
> I am using below configuration :-
> 
>  
> 
> Tuscany 1.6.1
> 
> Spring – 3.0.5
> 
> Hibernate – 3.6.3
> 
> Jetty – 6.1.18
> 
>  
> 
> I am developing a service layer to handle any database access. Service layer 
> is developed using Spring + Hibernate integration. Now I am declaring this 
> Service as a Tuscany component.
> 
>  
> 
> To accomplish the above I have done below steps :-
> 
>  
> 
> 1> Added <sca:service> in beans.xml of spring :-
> 
>  
> 
> <sca:service name="DataService"
> 
>         type="com.test.DataService" target="dataService"/>
> 
>  
> 
> 2> Added below in composite.xml :-
> 
>  
> 
> <service name="DataService" promote="DataServiceComponent">
> 
>                     <interface.java interface="com.test.DataService"/>
> 
>     </service>
> 
>    
> 
>     <component name="DataServiceComponent">
> 
>         <implementation.spring location="META-INF/spring/beans.xml"/>
> 
>     </component>
> 
>  
> 
> 3>  Now I just create an exploded war using Maven build and copy it in the 
> webapps folder of jetty.
> 
>  
> 
> 4> Next I start jetty from command-line.
> 
>  
> 
> Server start up fails complaining ClassNotFoundException: 
> org.springframework.orm.hibernate3.annotation.AnnotationSessionFactoryBean
> 
>  
> 
> Below is the stacktrace :-
> 
>  
> 
> org.osoa.sca.ServiceRuntimeException: 
> java.lang.reflect.InvocationTargetException
> 
>         at 
> org.apache.tuscany.sca.host.embedded.SCADomain.createNewInstance(SCADomain.java:220)
> 
>         at 
> org.apache.tuscany.sca.host.embedded.SCADomain.newInstance(SCADomain.java:76)
> 
> ……..
> 
>         at org.mortbay.start.Main.start(Main.java:523)
> 
>         at org.mortbay.start.Main.main(Main.java:119)
> 
> Caused by: java.lang.reflect.InvocationTargetException
> 
>         at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native 
> Method)
> 
>         ……….
> 
>         at 
> org.apache.tuscany.sca.host.embedded.SCADomain.createNewInstance(SCADomain.java:199)
> 
>         ... 25 more
> 
> Caused by: org.osoa.sca.ServiceRuntimeException: 
> org.apache.tuscany.sca.contribution.service.ContributionResolveException: 
> org.apache.tuscany.sca.contribution.service.Contributi
> 
> onReadException: java.lang.ClassNotFoundException: 
> org.springframework.orm.hibernate3.annotation.AnnotationSessionFactoryBean
> 
>         at org.apache.tuscany.sca.node.impl.NodeImpl.<init>(NodeImpl.java:386)
> 
>         at 
> org.apache.tuscany.sca.node.impl.NodeFactoryImpl.createSCANode(NodeFactoryImpl.java:47)
> 
> …………..
> 
>         at 
> org.apache.tuscany.sca.host.webapp.WebSCADomain.<init>(WebSCADomain.java:41)
> 
>         ... 30 more
> 
> Caused by: 
> org.apache.tuscany.sca.contribution.service.ContributionResolveException: 
> org.apache.tuscany.sca.contribution.service.ContributionReadException: 
> java.lang.ClassNotFou
> 
> ndException: 
> org.springframework.orm.hibernate3.annotation.AnnotationSessionFactoryBean
> 
>         at 
> org.apache.tuscany.sca.implementation.spring.xml.SpringImplementationProcessor.resolve(SpringImplementationProcessor.java:206)
> 
>         at 
> org.apache.tuscany.sca.implementation.spring.xml.SpringImplementationProcessor.resolve(SpringImplementationProcessor.java:56)
> 
>         at 
> org.apache.tuscany.sca.contribution.processor.DefaultStAXArtifactProcessorExtensionPoint$LazyStAXArtifactProcessor.resolve(DefaultStAXArtifactProcessorExtensionPoint.
> 
> java:388)
> 
>         at 
> org.apache.tuscany.sca.contribution.processor.ExtensibleStAXArtifactProcessor.resolve(ExtensibleStAXArtifactProcessor.java:183)
> 
> ………….
> 
>         at 
> org.apache.tuscany.sca.contribution.processor.DefaultStAXArtifactProcessorExtensionPoint$LazyStAXArtifactProcessor.resolve(DefaultStAXArtifactProcessorExtensionPoint.
> 
> java:388)
> 
>         at 
> org.apache.tuscany.sca.contribution.processor.ExtensibleStAXArtifactProcessor.resolve(ExtensibleStAXArtifactProcessor.java:183)
> 
>         at 
> org.apache.tuscany.sca.assembly.xml.CompositeDocumentProcessor.resolve(CompositeDocumentProcessor.java:231)
> 
>         at 
> org.apache.tuscany.sca.assembly.xml.CompositeDocumentProcessor.resolve(CompositeDocumentProcessor.java:59)
> 
> …………..
> 
>         at 
> org.apache.tuscany.sca.node.impl.NodeImpl.configureNode(NodeImpl.java:524)
> 
>         at org.apache.tuscany.sca.node.impl.NodeImpl.<init>(NodeImpl.java:381)
> 
>         ... 34 more
> 
> Caused by: 
> org.apache.tuscany.sca.contribution.service.ContributionReadException: 
> java.lang.ClassNotFoundException: 
> org.springframework.orm.hibernate3.annotation.AnnotationSessi
> 
> onFactoryBean
> 
>         at 
> org.apache.tuscany.sca.implementation.spring.introspect.SpringXMLComponentTypeLoader.generateComponentType(SpringXMLComponentTypeLoader.java:580)
> 
>         at 
> org.apache.tuscany.sca.implementation.spring.introspect.SpringXMLComponentTypeLoader.loadFromXML(SpringXMLComponentTypeLoader.java:188)
> 
>         at 
> org.apache.tuscany.sca.implementation.spring.introspect.SpringXMLComponentTypeLoader.load(SpringXMLComponentTypeLoader.java:126)
> 
>         at 
> org.apache.tuscany.sca.implementation.spring.xml.SpringImplementationProcessor.resolve(SpringImplementationProcessor.java:204)
> 
>         ... 50 more
> 
> Caused by: java.lang.ClassNotFoundException: 
> org.springframework.orm.hibernate3.annotation.AnnotationSessionFactoryBean
> 
>         at 
> org.apache.tuscany.sca.implementation.spring.introspect.SpringXMLComponentTypeLoader.resolveClass(SpringXMLComponentTypeLoader.java:138)
> 
>         at 
> org.apache.tuscany.sca.implementation.spring.introspect.SpringXMLComponentTypeLoader.generateComponentType(SpringXMLComponentTypeLoader.java:507)
> 
>  
> 
> Any help or samples for Tuscany + Sring+Hibernate used as a webapp is much 
> appreciated.
> 
>  
> 
> Thanks
> 
>  
> 
> <image001.jpg>
> 
> Anubhav Jain
> 
> Adobe Systems 
> i -1A, Sec - 25A, Noida, UP, INDIA.  Pin: 201301
> Extn: 0120 - 2444711- 33023 
> Mobile: +91-742-834-0396
> 
>  
> 
>  
> 
>  

Reply via email to