Forums

Home » Liferay Portal » English » 3. Development

Combination View Flat View Tree View
Threads [ Previous | Next ]
ton dev
Service Builder ext-spring Error creating bean with name 'myAppHibernateSes
December 5, 2012 1:05 AM
Answer

ton dev

Rank: New Member

Posts: 18

Join Date: February 8, 2012

Recent Posts

i want to make a persistent layer for an existing table using service builder because i've read its doable.

i followed the example in Liferay in Action MEAP on service builder and

i copied the sample contents for ext-spring suggested in the book but when i deployed the application the exception is this

 116:47:11,498 ERROR [ContextLoader:220] Context initialization failed
 2org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'myAppHibernateSessionFactory' defined in ServletContext resource [/WEB-INF/classes/META-INF/ext-spring.xml]: Invocation of init method failed; nested exception is java.lang.AbstractMethodError
 3        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1412)
 4        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:519)
 5        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:456)
 6        at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:291)
 7        at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)
 8        at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:288)
 9        at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:190)
10        at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:558)
11        at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:895)
12        at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:425)
13        at org.springframework.web.context.ContextLoader.createWebApplicationContext(ContextLoader.java:276)
14        at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:197)
15        at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:47)
16        at com.liferay.portal.spring.context.PortletContextLoaderListener.contextInitialized(PortletContextLoaderListener.java:71)
17        at com.liferay.portal.kernel.servlet.PortalClassLoaderServletContextListener.doPortalInit(PortalClassLoaderServletContextListener.java:91)
18        at com.liferay.portal.kernel.util.BasePortalLifecycle.portalInit(BasePortalLifecycle.java:42)
19        at com.liferay.portal.kernel.util.PortalLifecycleUtil.register(PortalLifecycleUtil.java:52)
20        at com.liferay.portal.kernel.util.BasePortalLifecycle.registerPortalLifecycle(BasePortalLifecycle.java:50)
21        at com.liferay.portal.kernel.servlet.PortalClassLoaderServletContextListener.contextInitialized(PortalClassLoaderServletContextListener.java:52)
22        at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:3972)
23        at org.apache.catalina.core.StandardContext.start(StandardContext.java:4467)
24        at org.apache.catalina.startup.HostConfig.checkResources(HostConfig.java:1244)
25        at org.apache.catalina.startup.HostConfig.check(HostConfig.java:1342)
26        at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:303)
27        at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:119)
28        at org.apache.catalina.core.ContainerBase.backgroundProcess(ContainerBase.java:1337)
29        at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.processChildren(ContainerBase.java:1601)
30        at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.processChildren(ContainerBase.java:1610)
31        at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.run(ContainerBase.java:1590)
32        at java.lang.Thread.run(Thread.java:619)
33Caused by: java.lang.AbstractMethodError
34        at com.liferay.portal.spring.hibernate.DialectDetector.getDialect(DialectDetector.java:66)
35        at com.liferay.portal.spring.hibernate.DialectDetector.determineDialect(DialectDetector.java:44)
36        at com.liferay.portal.spring.hibernate.PortalHibernateConfiguration.determineDialect(PortalHibernateConfiguration.java:52)
37        at com.liferay.portal.spring.hibernate.PortalHibernateConfiguration.newConfiguration(PortalHibernateConfiguration.java:83)
38        at org.springframework.orm.hibernate3.LocalSessionFactoryBean.buildSessionFactory(LocalSessionFactoryBean.java:549)
39        at org.springframework.orm.hibernate3.AbstractSessionFactoryBean.afterPropertiesSet(AbstractSessionFactoryBean.java:211)
40        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1469)
41        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1409)
42        ... 29 more
4316:47:11,592 ERROR [PortalClassLoaderServletContextListener:94] org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'myAppHibernateSessionFactory' defined in ServletContext resource [/WEB-INF/classes/META-INF/ext-spring.xml]: Invocation of init method failed; nested exception is java.lang.AbstractMethodError
44org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'myAppHibernateSessionFactory' defined in ServletContext resource [/WEB-INF/classes/META-INF/ext-spring.xml]: Invocation of init method failed; nested exception is java.lang.AbstractMethodError
45        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1412)
46        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:519)
47        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:456)
48        at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:291)
49        at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)
50        at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:288)
51        at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:190)
52        at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:558)
53        at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:895)
54        at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:425)
55        at org.springframework.web.context.ContextLoader.createWebApplicationContext(ContextLoader.java:276)
56        at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:197)
57        at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:47)
58        at com.liferay.portal.spring.context.PortletContextLoaderListener.contextInitialized(PortletContextLoaderListener.java:71)
59        at com.liferay.portal.kernel.servlet.PortalClassLoaderServletContextListener.doPortalInit(PortalClassLoaderServletContextListener.java:91)
60        at com.liferay.portal.kernel.util.BasePortalLifecycle.portalInit(BasePortalLifecycle.java:42)
61        at com.liferay.portal.kernel.util.PortalLifecycleUtil.register(PortalLifecycleUtil.java:52)
62        at com.liferay.portal.kernel.util.BasePortalLifecycle.registerPortalLifecycle(BasePortalLifecycle.java:50)
63        at com.liferay.portal.kernel.servlet.PortalClassLoaderServletContextListener.contextInitialized(PortalClassLoaderServletContextListener.java:52)
64        at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:3972)
65        at org.apache.catalina.core.StandardContext.start(StandardContext.java:4467)
66        at org.apache.catalina.startup.HostConfig.checkResources(HostConfig.java:1244)
67        at org.apache.catalina.startup.HostConfig.check(HostConfig.java:1342)
68        at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:303)
69        at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:119)
70        at org.apache.catalina.core.ContainerBase.backgroundProcess(ContainerBase.java:1337)
71        at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.processChildren(ContainerBase.java:1601)
72        at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.processChildren(ContainerBase.java:1610)
73        at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.run(ContainerBase.java:1590)
74        at java.lang.Thread.run(Thread.java:619)
75Caused by: java.lang.AbstractMethodError
76        at com.liferay.portal.spring.hibernate.DialectDetector.getDialect(DialectDetector.java:66)
77        at com.liferay.portal.spring.hibernate.DialectDetector.determineDialect(DialectDetector.java:44)
78        at com.liferay.portal.spring.hibernate.PortalHibernateConfiguration.determineDialect(PortalHibernateConfiguration.java:52)
79        at com.liferay.portal.spring.hibernate.PortalHibernateConfiguration.newConfiguration(PortalHibernateConfiguration.java:83)
80        at org.springframework.orm.hibernate3.LocalSessionFactoryBean.buildSessionFactory(LocalSessionFactoryBean.java:549)
81        at org.springframework.orm.hibernate3.AbstractSessionFactoryBean.afterPropertiesSet(AbstractSessionFactoryBean.java:211)
82        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1469)
83        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1409)
84        ... 29 more



this is my ext-spring

 1<?xml version="1.0" encoding="UTF-8"?>
 2
 3<beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" default-destroy-method="destroy" default-init-method="afterPropertiesSet" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd">
 4    <bean id="myAppDataSourceTarget"
 5          class="com.liferay.portal.spring.jndi.JndiObjectFactoryBean"
 6          lazy-init="true">
 7        <property name="jndiName">
 8            <value>jdbc/as400conn</value>
 9        </property>
10    </bean>
11    <bean id="myAppDataSource"
12          class="org.springframework.jdbc.datasource.LazyConnectionDataSourceProxy">
13          <property name="targetDataSource">
14            <ref bean="myAppDataSourceTarget" />
15        </property>
16    </bean>
17    <bean id="myAppHibernateSessionFactory"
18          class="com.liferay.portal.spring.hibernate.PortletHibernateConfiguration">
19        <property name="dataSource">
20            <ref bean="myAppDataSource" />
21        </property>
22    </bean>
23    <bean id="myAppSessionFactory"
24          class="com.liferay.portal.dao.orm.hibernate.SessionFactoryImpl">
25          <property name="sessionFactoryImplementor">
26            <ref bean="myAppHibernateSessionFactory" />
27        </property>
28    </bean>
29    <bean id="myAppTransactionManager"
30          class="org.springframework.orm.hibernate3.HibernateTransactionManager">
31        <property name="dataSource">
32            <ref bean="myAppDataSource" />
33        </property>
34        <property name="sessionFactory">
35            <ref bean="myAppHibernateSessionFactory" />
36        </property>
37    </bean>
38</beans>



i guess it has something to do with spring,, i have no idea what's spring is

any suggestions how to correct this error??
Jan Geißler
RE: Service Builder ext-spring Error creating bean with name 'myAppHibernat
December 5, 2012 1:14 AM
Answer

Jan Geißler

Rank: Expert

Posts: 358

Join Date: July 5, 2011

Recent Posts

Well, Spring is a Framework which offers apart from other Modules:
Dependency Injection (Inversion of control pattern) , Portlet and Servlet MVC Framework, ..., .....
As for you error, you are trying to call a Method of an Abstract Class. To be more Precise: Spring is trying to call that method on initializing the ServiceContext of your application ;)
Bean:
myAppHibernateSessionFactory
Cause:
Invocation of init method failed
java.lang.AbstractMethodError

So it seems to me that:
com.liferay.portal.spring.hibernate.PortletHibernateConfiguration
is an Abstact class.
To be honest, I am not sure about this, because I've never tried to use Existing tables with Liferay ;)
David H Nebinger
RE: Service Builder ext-spring Error creating bean with name 'myAppHibernat
December 5, 2012 5:48 AM
Answer

David H Nebinger

Rank: Liferay Legend

Posts: 7227

Join Date: September 1, 2006

Recent Posts

ton dev:
1    <bean id="myAppDataSourceTarget"
2          class="com.liferay.portal.spring.jndi.JndiObjectFactoryBean"
3          lazy-init="true">
4        <property name="jndiName">
5            <value>jdbc/as400conn</value>
6        </property>
7    </bean>


any suggestions how to correct this error??



How is as400conn defined as a data source? The AbstractMethodException would seem to indicate that you're using either an invalid driver or one that Hibernate cannot determine the dialect for...
ton dev
RE: Service Builder ext-spring Error creating bean with name 'myAppHibernat
December 5, 2012 4:15 PM
Answer

ton dev

Rank: New Member

Posts: 18

Join Date: February 8, 2012

Recent Posts

im using tomcat in defining datasource

this is the one i put in context.xml
1
2<Resource auth="Container" driverClassName="com.ibm.as400.access.AS400JDBCDriver" maxActive="100" maxIdle="4" name="jdbc/as400conn" password="password" type="javax.sql.DataSource" url="jdbc:as400://schema" username="uname"/>


i used jt400.jar as my connector

what would be the right config when using as400... thanks for the help
Jan Geißler
RE: Service Builder ext-spring Error creating bean with name 'myAppHibernat
December 6, 2012 2:29 AM
Answer

Jan Geißler

Rank: Expert

Posts: 358

Join Date: July 5, 2011

Recent Posts

Are you Using DB2 as Database, is that Correct?
ton dev
RE: Service Builder ext-spring Error creating bean with name 'myAppHibernat
December 9, 2012 5:38 PM
Answer

ton dev

Rank: New Member

Posts: 18

Join Date: February 8, 2012

Recent Posts

AS400, the old database being used in RPG programming, i tried using db2jcc4.jar, still no luck
Jan Geißler
RE: Service Builder ext-spring Error creating bean with name 'myAppHibernat
December 10, 2012 12:46 AM
Answer

Jan Geißler

Rank: Expert

Posts: 358

Join Date: July 5, 2011

Recent Posts

Don't know if AS400 is supported by LIferay (Hibernate). Maybe you should start investigating in that direction.