2014-05-14 3 views
0

최대 절전 모드를 Mule과 통합하려고합니다. Mule은 Hibernate Transport를 지원합니까?제목이 다음으로 변경되었습니다 : Mule JPA 모듈 관련 문제

안녕 @ 데이비드는

나는 뮬 JPA 모듈 작업을 시도했다. 하지만 저는 아래의 문제에 직면하고 있습니다. 친절하게 도와주세요. 여기

내 applicationContect.xml

<?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:p="http://www.springframework.org/schema/p" xmlns:aop="http://www.springframework.org/schema/aop" 
     xmlns:context="http://www.springframework.org/schema/context" xmlns:jee="http://www.springframework.org/schema/jee" 
     xmlns:tx="http://www.springframework.org/schema/tx" 
     xsi:schemaLocation=" 
      http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-2.5.xsd 
      http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd 
      http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-2.5.xsd 
      http://www.springframework.org/schema/jee http://www.springframework.org/schema/jee/spring-jee-2.5.xsd 
      http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-2.5.xsd"> 

    <context:property-placeholder location="classpath:jdbc.properties"/> 

    <!-- Connection Pool --> 
    <bean id="dataSource" class="com.mchange.v2.c3p0.ComboPooledDataSource" destroy-method="close"> 
     <property name="driverClass" value="${jdbc.driverClass}"/> 
     <property name="jdbcUrl" value="${jdbc.url}"/> 
     <property name="user" value="${jdbc.username}"/> 
     <property name="password" value="${jdbc.password}"/> 
    </bean> 

    <!-- JPA EntityManagerFactory --> 
    <bean id="entityManagerFactory" class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean" 
      p:dataSource-ref="dataSource"> 
     <property name="jpaVendorAdapter"> 
      <bean class="org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter"> 
        <property name="database" value="${jdbc.database}"/> 
        <property name="showSql" value="${jdbc.showSql}"/>  
      </bean>  
     </property> 
    </bean> 

    <!-- Transaction manager for a single JPA EntityManagerFactory (alternative to JTA) --> 
    <bean id="transactionManager" class="org.springframework.orm.jpa.JpaTransactionManager" 
      p:entityManagerFactory-ref="entityManagerFactory"/> 

    <!-- Activates various annotations to be detected in bean classes for eg @Autowired--> 
    <context:annotation-config/> 

     <!-- enable the configuration of transactional behavior based on annotations --> 
     <tx:annotation-driven transaction-manager="transactionManager"/> 

    <!-- Property Configurator --> 
    <bean id="propertyConfigurer" class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer"> 
     <property name="location" value="jdbc.properties"/> 
    </bean> 



    <context:component-scan base-package="com.test.dao"/> 

    <bean id="contactService" class="com.test.service.ContactServiceImpl"/> 

</beans> 

이며,이 내 mflow 파일

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

<mule xmlns:http="http://www.mulesoft.org/schema/mule/http" xmlns="http://www.mulesoft.org/schema/mule/core" xmlns:doc="http://www.mulesoft.org/schema/mule/documentation" 
    xmlns:spring="http://www.springframework.org/schema/beans" version="EE-3.4.1" 
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
    xmlns:jpa="http://www.mulesoft.org/schema/mule/jpa" 
    xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-current.xsd 
http://www.mulesoft.org/schema/mule/core http://www.mulesoft.org/schema/mule/core/current/mule.xsd 
http://www.mulesoft.org/schema/mule/http http://www.mulesoft.org/schema/mule/http/current/mule-http.xsd 
http://www.mulesoft.org/schema/mule/jpa http://www.mulesoft.org/schema/mule/jpa/current/mule-jpa.xsd"> 

    <spring:beans> 
      <spring:import resource="classpath:applicationContext.xml" /> 
    </spring:beans> 


     <jpa:config name="Java_Persistence_API" entityManagerFactory-ref="entityManagerFactory" doc:name="Java Persistence API"/> 
    <flow name="jpa-exampleFlow1" doc:name="jpa-exampleFlow1"> 
     <http:inbound-endpoint exchange-pattern="request-response" host="localhost" port="8081" doc:name="HTTP"/> 

    <!-- code to be written --> 
     <logger level="INFO" doc:name="Logger"/> 
    </flow> 
</mule> 

이 내 엔티티 클래스입니다

package com.test.entities; 

import javax.persistence.Entity; 
import javax.persistence.GeneratedValue; 
import javax.persistence.GenerationType; 
import javax.persistence.Table; 
import javax.persistence.Transient; 

import javax.persistence.*; 
import com.test.vo.Contact; 
import com.test.vo.ContactVO; 

@Entity 
@Table(name="contact") 

public class ContactEO implements Contact{ 

    @Transient 
    Contact contact; 

    @Transient 
    public Contact getContact() { 
     return contact; 
    } 

    public void setContact(Contact contact) { 
     this.contact = contact; 
    } 

    public ContactEO(){ 
     contact = new ContactVO(); 
    } 

    public ContactEO(Contact contact){ 
     this.contact = contact; 
    } 

    @Column(name="FIRSTNAME") 
    public String getFirstName() { 
     return contact.getFirstName(); 
    } 

    public void setFirstName(String firstName) { 
     contact.setFirstName(firstName); 
    } 

    @Column(name="LASTNAME") 
    public String getLastName() { 
     return contact.getLastName(); 
    } 

    public void setLastName(String lastName) { 
     contact.setLastName(lastName); 
    } 

    @Column(name="EMAIL") 
    public String getEmail() { 
     return contact.getEmail(); 
    } 
    public void setEmail(String email) { 
     contact.setEmail(email); 
    } 

    @Id 
    @GeneratedValue(strategy = GenerationType.IDENTITY) 
    @Column(name="ID") 
    public long getId() { 
     return contact.getId(); 
    } 

    public void setId(long id) { 
     contact.setId(id); 
    } 



} 

아래 예외 상황 해결 방법을 알려주십시오.

Exception in thread "main" org.mule.module.launcher.DeploymentInitException: IllegalAccessError: tried to access method org.hibernate.engine.CascadeStyle.()V from class org.hibernate.engine.EJB3CascadeStyle$1 at org.mule.module.launcher.application.DefaultMuleApplication.init(DefaultMuleApplication.java:219) at org.mule.module.launcher.application.ApplicationWrapper.init(ApplicationWrapper.java:64) at org.mule.module.launcher.DefaultMuleDeployer.deploy(DefaultMuleDeployer.java:47) at org.mule.tooling.server.application.ApplicationDeployer.main(ApplicationDeployer.java:127) Caused by: org.mule.api.config.ConfigurationException: Error creating bean with name 'entityManagerFactory' defined in class path resource [applicationContext.xml]: Invocation of init method failed; nested exception is java.lang.IllegalAccessError: tried to access method org.hibernate.engine.CascadeStyle.()V from class org.hibernate.engine.EJB3CascadeStyle$1 (org.mule.api.lifecycle.InitialisationException) (org.mule.api.config.ConfigurationException) at org.mule.config.builders.AbstractConfigurationBuilder.configure(AbstractConfigurationBuilder.java:52) at org.mule.config.builders.AbstractResourceConfigurationBuilder.configure(AbstractResourceConfigurationBuilder.java:78) at org.mule.context.DefaultMuleContextFactory.createMuleContext(DefaultMuleContextFactory.java:84) at org.mule.module.launcher.application.DefaultMuleApplication.init(DefaultMuleApplication.java:207) ... 3 more Caused by: org.mule.api.config.ConfigurationException: Error creating bean with name 'entityManagerFactory' defined in class path resource [applicationContext.xml]: Invocation of init method failed; nested exception is java.lang.IllegalAccessError: tried to access method org.hibernate.engine.CascadeStyle.()V from class org.hibernate.engine.EJB3CascadeStyle$1 (org.mule.api.lifecycle.InitialisationException) at org.mule.config.builders.AbstractConfigurationBuilder.configure(AbstractConfigurationBuilder.java:52) at org.mule.config.builders.AbstractResourceConfigurationBuilder.configure(AbstractResourceConfigurationBuilder.java:78) at org.mule.config.builders.AutoConfigurationBuilder.autoConfigure(AutoConfigurationBuilder.java:101) at org.mule.config.builders.AutoConfigurationBuilder.doConfigure(AutoConfigurationBuilder.java:57) at org.mule.config.builders.AbstractConfigurationBuilder.configure(AbstractConfigurationBuilder.java:46) ... 6 more Caused by: org.mule.api.lifecycle.InitialisationException: Error creating bean with name 'entityManagerFactory' defined in class path resource [applicationContext.xml]: Invocation of init method failed; nested exception is java.lang.IllegalAccessError: tried to access method org.hibernate.engine.CascadeStyle.()V from class org.hibernate.engine.EJB3CascadeStyle$1 at org.mule.registry.AbstractRegistry.initialise(AbstractRegistry.java:117) at org.mule.config.spring.SpringXmlConfigurationBuilder.createSpringRegistry(SpringXmlConfigurationBuilder.java:119) at org.mule.config.spring.SpringXmlConfigurationBuilder.doConfigure(SpringXmlConfigurationBuilder.java:73) at org.mule.config.builders.AbstractConfigurationBuilder.configure(AbstractConfigurationBuilder.java:46) ... 10 more Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'entityManagerFactory' defined in class path resource [applicationContext.xml]: Invocation of init method failed; nested exception is java.lang.IllegalAccessError: tried to access method org.hibernate.engine.CascadeStyle.()V from class org.hibernate.engine.EJB3CascadeStyle$1 at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1486) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:524) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:461) at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:295) at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:223) at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:292) at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:194) at org.springframework.context.support.AbstractApplicationContext.getBean(AbstractApplicationContext.java:1117) at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:922) at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:479) at org.mule.config.spring.SpringRegistry.doInitialise(SpringRegistry.java:89) at org.mule.registry.AbstractRegistry.initialise(AbstractRegistry.java:109) ... 13 more Caused by: java.lang.IllegalAccessError: tried to access method org.hibernate.engine.CascadeStyle.()V from class org.hibernate.engine.EJB3CascadeStyle$1 at org.hibernate.engine.EJB3CascadeStyle$1.(EJB3CascadeStyle.java:24) at org.hibernate.engine.EJB3CascadeStyle.(EJB3CascadeStyle.java:19) at org.hibernate.ejb.event.EJB3PersistEventListener.(EJB3PersistEventListener.java:19) at org.hibernate.ejb.EventListenerConfigurator.(EventListenerConfigurator.java:81) at org.hibernate.ejb.Ejb3Configuration.(Ejb3Configuration.java:136) at org.hibernate.ejb.HibernatePersistence.createContainerEntityManagerFactory(HibernatePersistence.java:130) at org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean.createNativeEntityManagerFactory(LocalContainerEntityManagerFactoryBean.java:225) at org.springframework.orm.jpa.AbstractEntityManagerFactoryBean.afterPropertiesSet(AbstractEntityManagerFactoryBean.java:308) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1545) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1483) ... 24 more

답변

0

JPA 커넥터는 무엇입니까? http://www.mulesoft.org/connectors/jpa-connector?

+0

JPA 커넥터로 문제를 해결하려고했습니다. 친절하게 그 문제를 해결하도록 도와주세요. 미리 감사드립니다 –

+0

귀하의 질문은 지금 중복 : http://stackoverflow.com/q/19952468/387927;) 거기에 대한 답변을 확인하십시오 :) –

+0

Thanks @DavidDossot. 그것은 많은 도움이되었습니다. http://stackoverflow.com/questions/23858446/mule-jpa-persist-is-not-inserting-or-updating 링크에 질문이 하나 더 있습니다. –