Announcement Announcement Module
Collapse
No announcement yet.
Integration Spring Struts2 Hibernate Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Integration Spring Struts2 Hibernate

    Hi everyone and i need help PLEASE!!
    i'm developing a web project using Spring Struts2 and Hibernate this is my struts.xml.

    PHP Code:
    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE struts PUBLIC
        "-//Apache Software Foundation//DTD Struts Configuration 2.0//EN"
        "http://struts.apache.org/dtds/struts-2.0.dtd">
        
        <struts>
            
            
            
            <package name="publico" namespace="/" extends="struts-default">
            
                <action name="log" method="execute" class="com.action.Ingresar" >
                        <result name="success">/menu.jsp</result>
                        <result name="input">/index.jsp</result>
                </action>
            
            </package>
        
        
        </struts>
    If i use that class my project run's normally but if i use as a class="ingresar" the name of the bean i have the next error
    PHP Code:
    Unable to instantiate Actioningresar,  defined for 'log' in namespace '/'Error creating bean with name 'ingresar' defined in ServletContext resource [/WEB-INF/applicationContext.xml]: 1 constructor arguments specified but no matching constructor found in bean 'ingresar' (hintspecify index and/or type arguments for simple parameters to avoid type ambiguities)
        
    com.opensymphony.xwork2.DefaultActionInvocation.createAction(DefaultActionInvocation.java:306)
        
    com.opensymphony.xwork2.DefaultActionInvocation.init(DefaultActionInvocation.java:387)
        
    com.opensymphony.xwork2.DefaultActionProxy.prepare(DefaultActionProxy.java:186)
        
    org.apache.struts2.impl.StrutsActionProxy.prepare(StrutsActionProxy.java:61)
        
    org.apache.struts2.impl.StrutsActionProxyFactory.createActionProxy(StrutsActionProxyFactory.java:39)
        
    com.opensymphony.xwork2.DefaultActionProxyFactory.createActionProxy(DefaultActionProxyFactory.java:47)
        
    org.apache.struts2.dispatcher.Dispatcher.serviceAction(Dispatcher.java:458)
        
    org.apache.struts2.dispatcher.FilterDispatcher.doFilter(FilterDispatcher.java:395)
        
    org.springframework.orm.jpa.support.OpenEntityManagerInViewFilter.doFilterInternal(OpenEntityManagerInViewFilter.java:111)
        
    org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:75)


    causa raz 

    org
    .springframework.beans.factory.BeanCreationExceptionError creating bean with name 'ingresar' defined in ServletContext resource [/WEB-INF/applicationContext.xml]: 1 constructor arguments specified but no matching constructor found in bean 'ingresar' (hintspecify index and/or type arguments for simple parameters to avoid type ambiguities)
        
    org.springframework.beans.factory.support.ConstructorResolver.autowireConstructor(ConstructorResolver.java:167)
        
    org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.autowireConstructor(AbstractAutowireCapableBeanFactory.java:957)
        
    org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:869)
        
    org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:514)
        
    org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory$1.run(AbstractAutowireCapableBeanFactory.java:485)
        
    java.security.AccessController.doPrivileged(Native Method)
        
    org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:455)
        
    org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:270)
        
    org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:170)
        
    org.springframework.context.support.AbstractApplicationContext.getBean(AbstractApplicationContext.java:883)
        
    com.opensymphony.xwork2.spring.SpringObjectFactory.buildBean(SpringObjectFactory.java:126)
        
    com.opensymphony.xwork2.ObjectFactory.buildBean(ObjectFactory.java:139)
        
    com.opensymphony.xwork2.ObjectFactory.buildAction(ObjectFactory.java:109)
        
    com.opensymphony.xwork2.DefaultActionInvocation.createAction(DefaultActionInvocation.java:287)
        
    com.opensymphony.xwork2.DefaultActionInvocation.init(DefaultActionInvocation.java:387)
        
    com.opensymphony.xwork2.DefaultActionProxy.prepare(DefaultActionProxy.java:186)
        
    org.apache.struts2.impl.StrutsActionProxy.prepare(StrutsActionProxy.java:61)
        
    org.apache.struts2.impl.StrutsActionProxyFactory.createActionProxy(StrutsActionProxyFactory.java:39)
        
    com.opensymphony.xwork2.DefaultActionProxyFactory.createActionProxy(DefaultActionProxyFactory.java:47)
        
    org.apache.struts2.dispatcher.Dispatcher.serviceAction(Dispatcher.java:458)
        
    org.apache.struts2.dispatcher.FilterDispatcher.doFilter(FilterDispatcher.java:395)
        
    org.springframework.orm.jpa.support.OpenEntityManagerInViewFilter.doFilterInternal(OpenEntityManagerInViewFilter.java:111)
        
    org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:75
    and this is my applicationContext.xml
    PHP Code:
    <?xml version="1.0" encoding="UTF-8"?>
    <beans xmlns="http://www.springframework.org/schema/beans"
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        xmlns:aop="http://www.springframework.org/schema/aop"
        xmlns:tx="http://www.springframework.org/schema/tx"
        xsi:schemaLocation="
        http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
        http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-2.0.xsd
        http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-2.0.xsd">
        
        
        <bean class="org.springframework.orm.jpa.support.PersistenceAnnotationBeanPostProcessor"/>
        
        <bean id="operaciones" class="com.dao.OperacionesImp" />
        
        
        <bean id="entityManagerFactory" class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean">
            <property name="dataSource" ref="dataSource"/>
            <property name="jpaVendorAdapter">
                <bean class="org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter">
                        <property name="database" value="MYSQL"/>
                        <property name="showSql" value="true"/>
                </bean>
            </property>
        </bean>
        
        <bean id="dataSource" class="org.springframework.jdbc.datasource.DriverManagerDataSource">
                <property name="driverClassName" value="com.mysql.jdbc.Driver"/>
                <property name="url" value="jdbc:mysql://localhost:3306/cajeroautomatico"/>
                <property name="username" value="root" />
                <property name="password" value="root" />
        </bean>    
        
        <bean id="transactionManager" class="org.springframework.orm.jpa.JpaTransactionManager">
                <property name="entityManagerFactory" ref="entityManagerFactory" />
        </bean>
        
        <tx:annotation-driven transaction-manager="transactionManager"/>
        
        <bean id="ingresar" scope="prototype" class="com.action.Ingresar">
            <constructor-arg  ref="operaciones" />
        </bean>
        
    </beans>
    please help me i dont know who is the problem!!

  • #2
    PLease post your question on Spring WEB and Hibernate forums. THis forum is for Spring Integration project http://www.springsource.org/spring-integration

    Comment

    Working...
    X