JPA Hibernate不适用于JBoss Fuse 6.0

时间:2015-05-10 08:47:20

标签: hibernate jpa osgi apache-camel jbossfuse

我一直在尝试在Jboss Fuse 6.0上部署和运行我的骆驼路线。 对于开发,我一直在使用JBoss Developer Studio,并且能够在我的本地机器上成功运行。

但是一旦我将代码部署到JBoss Fuse 6.0,就会给出运行时异常, `

@current_user = User.find_by(:id => session[:user_id])

以下是我的配置 骆驼context.xml中

CaughtExceptionType:org.apache.camel.CamelExecutionException, CaughtExceptionMessage:Exception occurred during execution on the exchange: Exchange[null], StackTrace:org.apache.camel.CamelExecutionException: Exception occurred during execution on the exchange: Exchange[null] at org.apache.camel.util.ObjectHelper.wrapCamelExecutionException(ObjectHelper.java:1342)`

来自persistence.xml

<bean id="entityManagerFactory"  class="org.springframework.orm.jpa.LocalEntityManagerFactoryBean">
    <property name="persistenceUnitName" value="mydb"/>
    <property name="jpaVendorAdapter">
    <bean class="org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter">
        <property name="showSql" value="true" />
        <property name="databasePlatform" value="org.hibernate.dialect.OracleDialect" />
    </bean>
</property>

路线代码

<persistence-unit name="mydb" transaction-type="RESOURCE_LOCAL">
<!--        <provider>org.apache.openjpa.persistence.PersistenceProviderImpl -->
<!--        </provider> -->
        <!-- <provider>org.hibernate.jpa.HibernatePersistenceProvide</provider>
 -->
        <class>some.database.model.DataModel</class>

        <properties>
            <property name="hibernate.dialect" value="org.hibernate.dialect.Oracle10gDialect" />
            <property name="hibernate.connection.driver_class" value="oracle.jdbc.OracleDriver" />
            <property name="hibernate.connection.url"
                value="jdbc:oracle:thin:@(DESCRIPTION=(LOAD_BALANCE=yes)(ADDRESS=(PROTOCOL=TCP)(HOST= some.database.hostname.com.au)(PORT=1521))(CONNECT_DATA=(SERVER=DEDICATED)(SERVICE_NAME= TESTIT)))" />
            <property name="hibernate.connection.username" value="USER" />
            <property name="hibernate.connection.password" value="PASS" />

            <!-- <property name="hibernate.hbm2ddl.auto" value="create"/> -->

            <!-- debugging flags -->
            <!-- <property name="hibernate.show_sql" value="true"/> <property name="hibernate.format_sql" 
                value="true"/> -->
        </properties>

在运行时执行此部分代码时发生异常。

         <route>
            <from uri="{{from.file.local.location}}" />
            <unmarshal ref="inputJaxb" />
            <bean ref="processXml" method="processXmlFile" />
            <to uri="log:insertLog" />
        </route>

任何人都可以告诉我我做错了什么。

1 个答案:

答案 0 :(得分:0)

似乎你的包没有识别persistence.xml 请在pom.xml中添加值为 META-INF / persistence.xml Meta-Persistence 指令