Re: Hibernate mappings inside aar..
Thanks for the hints. I got it working by deploying that aar-package exploded and then made reference, with MappingDirectoryLocations, to those mapping files relative to exploded axis2.war root e.g: /WEB-INF/services/Service.aar/WEB-INF/. On 5/28/2007, robert lazarski [EMAIL PROTECTED] wrote: You are using spring with hibernate right? Spring 2.0 ? Does this work for you? http://www.springframework.org/docs/api/org/springframework/orm/hibernate/LocalSessionFactoryBean.html#setMappingDirectoryLocations(org.springframework.core.io.Resource[]) Keep in mind the aar file can be deployed expanded. See the example below for a hint on using classpath locations and DEBUG mode to see what is getting picked up as locations. http://ws.apache.org/axis2/1_2/spring.html#263 HTH, Robert On 5/28/07, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: .. I noticed that hibernate is able to find that mapping file when I place it to axis2/WEB-INF/lib. So it seems that Spring is not giving that MultiParentClassLoader to Hibernate and I guess it's then trying to locate resources with TCCL. Does anyone know any solution for how to make hibernate look for those resources within aar-package? On 5/28/2007, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: Hello, I'm trying to deploy spring hibernate inside aar-package but spring doesn't seems to be able to locate hibernate mapping files. I've tried using that MultiParentClassLoader and I've tested that it finds the mapping files with getResource-method but when I give it to spring and try to load application context it still gives me FileNotFoundException for that same mapping file. I've placed all mapping files + applicationcontext-files to the root of that aar-package. Anyone have any ideas how to fix this? Here's my spring init code + test for finding that mapping file with that MultiParentClassLoader : try { ClassLoader multiParCL = new MultiParentClassLoader(new URL[0], new ClassLoader[] { AxisService.class.getClassLoader(), this.getClass().getClassLoader() }); ClassPathXmlApplicationContext appCtx = new ClassPathXmlApplicationContext(new String[] {ApplicationContextWS.xml, ApplicationContextLogic.xml}, false); System.out.print(url: + multiParCL.getResource(User.hbm.xml)); appCtx.setClassLoader(multiParCL); appCtx.refresh(); } catch (Exception ex) { ex.printStackTrace(); } which results in: ERROR [STDERR] org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'factory' defined in class path resource [ApplicationContextLogic.xml]: Invocation of init method failed; nested exception is java.io.FileNotFoundException: class path resource [User.hbm.xml] cannot be opened because it does not exist 2007-05-28 11:15:09,968 ERROR [STDERR] Caused by: 2007-05-28 11:15:09,968 ERROR [STDERR] java.io.FileNotFoundException: class path resource [User.hbm.xml] cannot be opened because it does not exist 2007-05-28 11:15:09,968 ERROR [STDERR]at org.springframework.core.io.ClassPathResource.getInputStream( ClassPathResource.java:135) 2007-05-28 11:15:09,968 ERROR [STDERR]at org.springframework.orm.hibernate3.LocalSessionFactoryBean.buildSessionFactory (LocalSessionFactoryBean.java:656) 2007-05-28 11:15:09,968 ERROR [STDERR]at org.springframework.orm.hibernate3.AbstractSessionFactoryBean.afterPropertiesSet (AbstractSessionFactoryBean.java:134) 2007-05-28 11:15:09,968 ERROR [STDERR]at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods (AbstractAutowireCapableBeanFactory.java:1202) 2007-05-28 11:15:09,968 ERROR [STDERR]at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean (AbstractAutowireCapableBeanFactory.java:1172) 2007-05-28 11:15:09,968 ERROR [STDERR]at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean (AbstractAutowireCapableBeanFactory.java:428) 2007-05-28 11:15:09,968 ERROR [STDERR]at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject( AbstractBeanFactory.java:251) 2007-05-28 11:15:09,968 ERROR [STDERR]at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton (DefaultSingletonBeanRegistry.java:156) 2007-05-28 11:15:09,968 ERROR [STDERR]at org.springframework.beans.factory.support.AbstractBeanFactory.getBean( AbstractBeanFactory.java:248) 2007-05-28 11:15:09,968 ERROR [STDERR]at org.springframework.beans.factory.support.AbstractBeanFactory.getBean( AbstractBeanFactory.java:160)
Hibernate mappings inside aar..
Hello, I'm trying to deploy spring hibernate inside aar-package but spring doesn't seems to be able to locate hibernate mapping files. I've tried using that MultiParentClassLoader and I've tested that it finds the mapping files with getResource-method but when I give it to spring and try to load application context it still gives me FileNotFoundException for that same mapping file. I've placed all mapping files + applicationcontext-files to the root of that aar-package. Anyone have any ideas how to fix this? Here's my spring init code + test for finding that mapping file with that MultiParentClassLoader : try { ClassLoader multiParCL = new MultiParentClassLoader(new URL[0], new ClassLoader[] { AxisService.class.getClassLoader(), this.getClass().getClassLoader() }); ClassPathXmlApplicationContext appCtx = new ClassPathXmlApplicationContext(new String[] {ApplicationContextWS.xml, ApplicationContextLogic.xml}, false); System.out.print(url: + multiParCL.getResource(User.hbm.xml)); appCtx.setClassLoader(multiParCL); appCtx.refresh(); } catch (Exception ex) { ex.printStackTrace(); } which results in: ERROR [STDERR] org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'factory' defined in class path resource [ApplicationContextLogic.xml]: Invocation of init method failed; nested exception is java.io.FileNotFoundException: class path resource [User.hbm.xml] cannot be opened because it does not exist 2007-05-28 11:15:09,968 ERROR [STDERR] Caused by: 2007-05-28 11:15:09,968 ERROR [STDERR] java.io.FileNotFoundException: class path resource [User.hbm.xml] cannot be opened because it does not exist 2007-05-28 11:15:09,968 ERROR [STDERR] at org.springframework.core.io.ClassPathResource.getInputStream(ClassPathResource.java:135) 2007-05-28 11:15:09,968 ERROR [STDERR] at org.springframework.orm.hibernate3.LocalSessionFactoryBean.buildSessionFactory(LocalSessionFactoryBean.java:656) 2007-05-28 11:15:09,968 ERROR [STDERR] at org.springframework.orm.hibernate3.AbstractSessionFactoryBean.afterPropertiesSet(AbstractSessionFactoryBean.java:134) 2007-05-28 11:15:09,968 ERROR [STDERR] at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1202) 2007-05-28 11:15:09,968 ERROR [STDERR] at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1172) 2007-05-28 11:15:09,968 ERROR [STDERR] at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:428) 2007-05-28 11:15:09,968 ERROR [STDERR] at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:251) 2007-05-28 11:15:09,968 ERROR [STDERR] at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:156) 2007-05-28 11:15:09,968 ERROR [STDERR] at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:248) 2007-05-28 11:15:09,968 ERROR [STDERR] at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:160) 2007-05-28 11:15:09,968 ERROR [STDERR] at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:284) 2007-05-28 11:15:09,968 ERROR [STDERR] at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:352) but that url for that mapping file is printed ok.. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Hibernate mappings inside aar..
.. I noticed that hibernate is able to find that mapping file when I place it to axis2/WEB-INF/lib. So it seems that Spring is not giving that MultiParentClassLoader to Hibernate and I guess it's then trying to locate resources with TCCL. Does anyone know any solution for how to make hibernate look for those resources within aar-package? On 5/28/2007, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: Hello, I'm trying to deploy spring hibernate inside aar-package but spring doesn't seems to be able to locate hibernate mapping files. I've tried using that MultiParentClassLoader and I've tested that it finds the mapping files with getResource-method but when I give it to spring and try to load application context it still gives me FileNotFoundException for that same mapping file. I've placed all mapping files + applicationcontext-files to the root of that aar-package. Anyone have any ideas how to fix this? Here's my spring init code + test for finding that mapping file with that MultiParentClassLoader : try { ClassLoader multiParCL = new MultiParentClassLoader(new URL[0], new ClassLoader[] { AxisService.class.getClassLoader(), this.getClass().getClassLoader() }); ClassPathXmlApplicationContext appCtx = new ClassPathXmlApplicationContext(new String[] {ApplicationContextWS.xml, ApplicationContextLogic.xml}, false); System.out.print(url: + multiParCL.getResource(User.hbm.xml)); appCtx.setClassLoader(multiParCL); appCtx.refresh(); } catch (Exception ex) { ex.printStackTrace(); } which results in: ERROR [STDERR] org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'factory' defined in class path resource [ApplicationContextLogic.xml]: Invocation of init method failed; nested exception is java.io.FileNotFoundException: class path resource [User.hbm.xml] cannot be opened because it does not exist 2007-05-28 11:15:09,968 ERROR [STDERR] Caused by: 2007-05-28 11:15:09,968 ERROR [STDERR] java.io.FileNotFoundException: class path resource [User.hbm.xml] cannot be opened because it does not exist 2007-05-28 11:15:09,968 ERROR [STDERR]at org.springframework.core.io.ClassPathResource.getInputStream(ClassPathResource.java:135) 2007-05-28 11:15:09,968 ERROR [STDERR]at org.springframework.orm.hibernate3.LocalSessionFactoryBean.buildSessionFactory(LocalSessionFactoryBean.java:656) 2007-05-28 11:15:09,968 ERROR [STDERR]at org.springframework.orm.hibernate3.AbstractSessionFactoryBean.afterPropertiesSet(AbstractSessionFactoryBean.java:134) 2007-05-28 11:15:09,968 ERROR [STDERR]at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1202) 2007-05-28 11:15:09,968 ERROR [STDERR]at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1172) 2007-05-28 11:15:09,968 ERROR [STDERR]at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:428) 2007-05-28 11:15:09,968 ERROR [STDERR]at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:251) 2007-05-28 11:15:09,968 ERROR [STDERR]at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:156) 2007-05-28 11:15:09,968 ERROR [STDERR]at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:248) 2007-05-28 11:15:09,968 ERROR [STDERR]at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:160) 2007-05-28 11:15:09,968 ERROR [STDERR]at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:284) 2007-05-28 11:15:09,968 ERROR [STDERR]at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:352) but that url for that mapping file is printed ok.. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]