Foros de discusión

Service Builder ext-spring Error creating bean with name 'myAppHibernateSes

ton dev, modificado hace 11 años.

Service Builder ext-spring Error creating bean with name 'myAppHibernateSes

New Member Mensajes: 18 Fecha de incorporación: 9/02/12 Mensajes recientes
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

16:47:11,498 ERROR [ContextLoader:220] Context initialization failed
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
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1412)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:519)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:456)
        at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:291)
        at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)
        at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:288)
        at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:190)
        at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:558)
        at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:895)
        at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:425)
        at org.springframework.web.context.ContextLoader.createWebApplicationContext(ContextLoader.java:276)
        at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:197)
        at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:47)
        at com.liferay.portal.spring.context.PortletContextLoaderListener.contextInitialized(PortletContextLoaderListener.java:71)
        at com.liferay.portal.kernel.servlet.PortalClassLoaderServletContextListener.doPortalInit(PortalClassLoaderServletContextListener.java:91)
        at com.liferay.portal.kernel.util.BasePortalLifecycle.portalInit(BasePortalLifecycle.java:42)
        at com.liferay.portal.kernel.util.PortalLifecycleUtil.register(PortalLifecycleUtil.java:52)
        at com.liferay.portal.kernel.util.BasePortalLifecycle.registerPortalLifecycle(BasePortalLifecycle.java:50)
        at com.liferay.portal.kernel.servlet.PortalClassLoaderServletContextListener.contextInitialized(PortalClassLoaderServletContextListener.java:52)
        at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:3972)
        at org.apache.catalina.core.StandardContext.start(StandardContext.java:4467)
        at org.apache.catalina.startup.HostConfig.checkResources(HostConfig.java:1244)
        at org.apache.catalina.startup.HostConfig.check(HostConfig.java:1342)
        at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:303)
        at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:119)
        at org.apache.catalina.core.ContainerBase.backgroundProcess(ContainerBase.java:1337)
        at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.processChildren(ContainerBase.java:1601)
        at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.processChildren(ContainerBase.java:1610)
        at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.run(ContainerBase.java:1590)
        at java.lang.Thread.run(Thread.java:619)
Caused by: java.lang.AbstractMethodError
        at com.liferay.portal.spring.hibernate.DialectDetector.getDialect(DialectDetector.java:66)
        at com.liferay.portal.spring.hibernate.DialectDetector.determineDialect(DialectDetector.java:44)
        at com.liferay.portal.spring.hibernate.PortalHibernateConfiguration.determineDialect(PortalHibernateConfiguration.java:52)
        at com.liferay.portal.spring.hibernate.PortalHibernateConfiguration.newConfiguration(PortalHibernateConfiguration.java:83)
        at org.springframework.orm.hibernate3.LocalSessionFactoryBean.buildSessionFactory(LocalSessionFactoryBean.java:549)
        at org.springframework.orm.hibernate3.AbstractSessionFactoryBean.afterPropertiesSet(AbstractSessionFactoryBean.java:211)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1469)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1409)
        ... 29 more
16: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
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
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1412)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:519)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:456)
        at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:291)
        at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)
        at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:288)
        at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:190)
        at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:558)
        at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:895)
        at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:425)
        at org.springframework.web.context.ContextLoader.createWebApplicationContext(ContextLoader.java:276)
        at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:197)
        at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:47)
        at com.liferay.portal.spring.context.PortletContextLoaderListener.contextInitialized(PortletContextLoaderListener.java:71)
        at com.liferay.portal.kernel.servlet.PortalClassLoaderServletContextListener.doPortalInit(PortalClassLoaderServletContextListener.java:91)
        at com.liferay.portal.kernel.util.BasePortalLifecycle.portalInit(BasePortalLifecycle.java:42)
        at com.liferay.portal.kernel.util.PortalLifecycleUtil.register(PortalLifecycleUtil.java:52)
        at com.liferay.portal.kernel.util.BasePortalLifecycle.registerPortalLifecycle(BasePortalLifecycle.java:50)
        at com.liferay.portal.kernel.servlet.PortalClassLoaderServletContextListener.contextInitialized(PortalClassLoaderServletContextListener.java:52)
        at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:3972)
        at org.apache.catalina.core.StandardContext.start(StandardContext.java:4467)
        at org.apache.catalina.startup.HostConfig.checkResources(HostConfig.java:1244)
        at org.apache.catalina.startup.HostConfig.check(HostConfig.java:1342)
        at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:303)
        at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:119)
        at org.apache.catalina.core.ContainerBase.backgroundProcess(ContainerBase.java:1337)
        at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.processChildren(ContainerBase.java:1601)
        at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.processChildren(ContainerBase.java:1610)
        at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.run(ContainerBase.java:1590)
        at java.lang.Thread.run(Thread.java:619)
Caused by: java.lang.AbstractMethodError
        at com.liferay.portal.spring.hibernate.DialectDetector.getDialect(DialectDetector.java:66)
        at com.liferay.portal.spring.hibernate.DialectDetector.determineDialect(DialectDetector.java:44)
        at com.liferay.portal.spring.hibernate.PortalHibernateConfiguration.determineDialect(PortalHibernateConfiguration.java:52)
        at com.liferay.portal.spring.hibernate.PortalHibernateConfiguration.newConfiguration(PortalHibernateConfiguration.java:83)
        at org.springframework.orm.hibernate3.LocalSessionFactoryBean.buildSessionFactory(LocalSessionFactoryBean.java:549)
        at org.springframework.orm.hibernate3.AbstractSessionFactoryBean.afterPropertiesSet(AbstractSessionFactoryBean.java:211)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1469)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1409)
        ... 29 more



this is my ext-spring

<!--?xml version="1.0" encoding="UTF-8"?-->

<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">
    <bean id="myAppDataSourceTarget" class="com.liferay.portal.spring.jndi.JndiObjectFactoryBean" lazy-init="true">
        <property name="jndiName">
            <value>jdbc/as400conn</value>
        </property>
    </bean>
    <bean id="myAppDataSource" class="org.springframework.jdbc.datasource.LazyConnectionDataSourceProxy">
          <property name="targetDataSource">
            <ref bean="myAppDataSourceTarget" />
        </property>
    </bean>
    <bean id="myAppHibernateSessionFactory" class="com.liferay.portal.spring.hibernate.PortletHibernateConfiguration">
        <property name="dataSource">
            <ref bean="myAppDataSource" />
        </property>
    </bean>
    <bean id="myAppSessionFactory" class="com.liferay.portal.dao.orm.hibernate.SessionFactoryImpl">
          <property name="sessionFactoryImplementor">
            <ref bean="myAppHibernateSessionFactory" />
        </property>
    </bean>
    <bean id="myAppTransactionManager" class="org.springframework.orm.hibernate3.HibernateTransactionManager">
        <property name="dataSource">
            <ref bean="myAppDataSource" />
        </property>
        <property name="sessionFactory">
            <ref bean="myAppHibernateSessionFactory" />
        </property>
    </bean>
</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??
thumbnail
Jan Geißler, modificado hace 11 años.

RE: Service Builder ext-spring Error creating bean with name 'myAppHibernat

Liferay Master Mensajes: 735 Fecha de incorporación: 5/07/11 Mensajes recientes
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 ;)
thumbnail
David H Nebinger, modificado hace 11 años.

RE: Service Builder ext-spring Error creating bean with name 'myAppHibernat

Liferay Legend Mensajes: 14916 Fecha de incorporación: 2/09/06 Mensajes recientes
ton dev:
    <bean id="myAppDataSourceTarget" class="com.liferay.portal.spring.jndi.JndiObjectFactoryBean" lazy-init="true">
        <property name="jndiName">
            <value>jdbc/as400conn</value>
        </property>
    </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, modificado hace 11 años.

RE: Service Builder ext-spring Error creating bean with name 'myAppHibernat

New Member Mensajes: 18 Fecha de incorporación: 9/02/12 Mensajes recientes
im using tomcat in defining datasource

this is the one i put in context.xml

<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
thumbnail
Jan Geißler, modificado hace 11 años.

RE: Service Builder ext-spring Error creating bean with name 'myAppHibernat

Liferay Master Mensajes: 735 Fecha de incorporación: 5/07/11 Mensajes recientes
Are you Using DB2 as Database, is that Correct?
ton dev, modificado hace 11 años.

RE: Service Builder ext-spring Error creating bean with name 'myAppHibernat

New Member Mensajes: 18 Fecha de incorporación: 9/02/12 Mensajes recientes
AS400, the old database being used in RPG programming, i tried using db2jcc4.jar, still no luck
thumbnail
Jan Geißler, modificado hace 11 años.

RE: Service Builder ext-spring Error creating bean with name 'myAppHibernat

Liferay Master Mensajes: 735 Fecha de incorporación: 5/07/11 Mensajes recientes
Don't know if AS400 is supported by LIferay (Hibernate). Maybe you should start investigating in that direction.