引起:java.sql.SQLSyntaxErrorException:使用JPA的WildFly 10中的ora-00904?

时间:2017-08-08 12:50:04

标签: java oracle hibernate tomcat jpa

我有一个非常奇怪的情况,当我试图使它与wildFly一起工作时我的应用程序与tomcat正常工作它只会为两个实体抛出以下错误...

我已经完成了对wildfly的更改,BTW我正在使用pom.xml所以对于所有hibernate依赖我已经将范围更改为提供并更改了JNDI配置....当我运行我的应用程序时,我看到许多查询成功运行但是有两个查询会抛出错误。但是在tomcat中没有看到这个错误......服务器都在使用oracle10g

这是我的错误......

  

引起:java.sql.SQLSyntaxErrorException:
  ORA-00904:" PRIVILEGE0 _"。" APPRESOURCES_RECORD_ID":无效标识符

     

at oracle.jdbc.driver.SQLStateMapping.newSQLException(SQLStateMapping.java:91)
  在oracle.jdbc.driver.DatabaseError.newSQLException(DatabaseError.java:133)
  at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:206)
  在oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:455)
  在oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:413)
  在oracle.jdbc.driver.T4C8Oall.receive(T4C8Oall.java:1034)
  at oracle.jdbc.driver.T4CPreparedStatement.doOall8(T4CPreparedStatement.java:194)
  at oracle.jdbc.driver.T4CPreparedStatement.executeForDescribe(T4CPreparedStatement.java:791)
  at oracle.jdbc.driver.T4CPreparedStatement.executeMaybeDescribe(T4CPreparedStatement.java:866)
  在oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStatement.java:1186)
  at oracle.jdbc.driver.OraclePreparedStatement.executeInternal(OraclePreparedStatement.java:3387)
  在oracle.jdbc.driver.OraclePreparedStatement.executeQuery(OraclePreparedStatement.java:3431)
  at oracle.jdbc.driver.OraclePreparedStatementWrapper.executeQuery(OraclePreparedStatementWrapper.java:1491)
  在org.jboss.jca.adapters.jdbc.WrappedPreparedStatement.executeQuery(WrappedPreparedStatement.java:504)
  在org.hibernate.engine.jdbc.internal.ResultSetReturnImpl.extract(ResultSetReturnImpl.java:70)
  ... 53更多

     

17:54:09,067 ERROR [org.jboss.msc.service.fail](ServerService线程池 - 84)MSC000001:无法启动服务jboss.undertow.deployment.default-server.default-host./XYZ :服务jboss.undertow.deployment.default-server.default-host./XYZ中的org.jboss.msc.service.StartException:java.lang.RuntimeException:
  org.springframework.beans.factory.BeanCreationException:创建名称为' contextLoaderUtil'的bean时出错。在" / E中定义:/wildfly-10.0.0.Final/standalone/deployments/XYZ.war/WEB-INF/classes/com/XYZcore/coder/cache/util/ContextLoaderUtil.class":调用init方法失败;嵌套异常是org.hibernate.exception.SQLGrammarException:无法提取ResultSet

     

at org.wildfly.extension.undertow.deployment.UndertowDeploymentService $ 1.run(UndertowDeploymentService.java:85)
  at java.util.concurrent.Executors $ RunnableAdapter.call(Unknown Source)
  at java.util.concurrent.FutureTask.run(Unknown Source)
  at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
  at java.util.concurrent.ThreadPoolExecutor $ Worker.run(Unknown Source)
  在java.lang.Thread.run(未知来源)
  在org.jboss.threads.JBossThread.run(JBossThread.java:320)

     

引起:java.lang.RuntimeException:org.springframework.beans.factory.BeanCreationException:创建名称为' contextLoaderUtil'的bean时出错在" / E中定义:/wildfly-10.0.0.Final/standalone/deployments/XYZ.war/WEB-INF/classes/com/XYZcore/coder/cache/util/ContextLoaderUtil.class":调用init方法失败;嵌套异常是org.hibernate.exception.SQLGrammarException:无法提取ResultSet

     

at io.undertow.servlet.core.DeploymentManagerImpl.deploy(DeploymentManagerImpl.java:231)
  在org.wildfly.extension.undertow.deployment.UndertowDeploymentService.startContext(UndertowDeploymentService.java:100)
  在org.wildfly.extension.undertow.deployment.UndertowDeploymentService $ 1.run(UndertowDeploymentService.java:82)           ......还有6个       引起:org.springframework.beans.factory.BeanCreationException:创建名称为' contextLoaderUtil'的bean时出错在" / E中定义:/wildfly-10.0.0.Final/standalone/deployments/XYZ.war/WEB-INF/classes/com/XYZcore/coder/cache/util/ContextLoaderUtil.class":调用init方法失败;嵌套异常是org.hibernate.exception.SQLGrammarException:无法提取ResultSet           在org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1553)           在org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:539)           在org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:475)           at org.springframework.beans.factory.support.AbstractBeanFactory $ 1.getObject(AbstractBeanFactory.java:304)           在org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:228)           在org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:300)           在org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:195)           at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:703)           在org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:760)           at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:482)           at org.springframework.web.context.ContextLoader.configureAndRefreshWebApplicationContext(ContextLoader.java:403)           在org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:306)           在org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:106)           at io.undertow.servlet.core.ApplicationListeners.contextInitialized(ApplicationListeners.java:187)           在io.undertow.servlet.core.DeploymentManagerImpl.deploy(DeploymentManagerImpl.java:198)           ......还有8个       引起:org.hibernate.exception.SQLGrammarException:无法提取ResultSet           在org.hibernate.exception.internal.SQLExceptionTypeDelegate.convert(SQLExceptionTypeDelegate.java:63)           在org.hibernate.exception.internal.StandardSQLExceptionConverter.convert(StandardSQLExceptionConverter.java:42)           在org.hibernate.engine.jdbc.spi.SqlExceptionHelper.convert(SqlExceptionHelper.java:109)           在org.hibernate.engine.jdbc.spi.SqlExceptionHelper.convert(SqlExceptionHelper.java:95)           at org.hibernate.engine.jdbc.internal.ResultSetReturnImpl.extract(ResultSetReturnImpl.java:79)           在org.hibernate.loader.plan.exec.internal.AbstractLoadPlanBasedLoader.getResultSet(AbstractLoadPlanBasedLoader.java:434)           在org.hibernate.loader.plan.exec.internal.AbstractLoadPlanBasedLoader.executeQueryStatement(AbstractLoadPlanBasedLoader.java:186)           在org.hibernate.loader.plan.exec.internal.AbstractLoadPlanBasedLoader.executeLoad(AbstractLoadPlanBasedLoader.java:121)           在org.hibernate.loader.plan.exec.internal.AbstractLoadPlanBasedLoader.executeLoad(AbstractLoadPlanBasedLoader.java:86)           at org.hibernate.loader.collection.plan.AbstractLoadPlanBasedCollectionInitializer.initialize(AbstractLoadPlanBasedCollectionInitializer.java:88)           at org.hibernate.persister.collection.AbstractCollectionPersister.initialize(AbstractCollectionPersister.java:682)           at org.hibernate.event.internal.DefaultInitializeCollectionEventListener.onInitializeCollection(DefaultInitializeCollectionEventListener.java:75)           at org.hibernate.internal.SessionImpl.initializeCollection(SessionImpl.java:1991)           在org.hibernate.collection.internal.AbstractPersistentCollection $ 4.doWork(AbstractPersistentCollection.java:550)           at org.hibernate.collection.internal.AbstractPersistentCollection.withTemporarySessionIfNeeded(AbstractPersistentCollection.java:248)           at org.hibernate.collection.internal.AbstractPersistentCollection.initialize(AbstractPersistentCollection.java:546)           在org.hibernate.collection.internal.AbstractPersistentCollection.read(AbstractPersistentCollection.java:133)           在org.hibernate.collection.internal.PersistentBag.get(PersistentBag.java:449)           在com.XYZcore.core.appRole.ui.ACAppResourceModel.populateDetails(ACAppResourceModel.java:117)           at com.XYZcore.coder.context.service.impl.ContextServiceImpl.loadAllResources(ContextServiceImpl.java:86)           at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)           at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)           at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)           at java.lang.reflect.Method.invoke(Unknown Source)           在org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:317)           在org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:190)           在org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:157)           at org.springframework.transaction.interceptor.TransactionInterceptor $ 1.proceedWithInvocation(TransactionInterceptor.java:98)           at org.springframework.transaction.interceptor.TransactionAspectSupport.invokeWithinTransaction(TransactionAspectSupport.java:262)           at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:95)           在org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)           在org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:207)           at com.sun.proxy。$ Proxy94.loadAllResources(Unknown Source)           at com.XYZcore.coder.cache.util.ContextLoaderUtil.afterPropertiesSet(ContextLoaderUtil.java:45)           在org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1612)           在org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1549)           ......还有22个       引起:java.sql.SQLSyntaxErrorException:ORA-00904:" PRIVILEGE0 _"。" APPRESOURCES_RECORD_ID":无效标识符

     

分析之后,我看到了@ManyToMany实体的不同行为   就像tomcat中的列是APP_RESOURCES_RECORD_ID一样   我运行此实体的列时是野生动物是APPRESOURCES_RECORD_ID   你看到_在wildfly中缺少_

注意:当我在wildfly中部署时,hibernate依赖关系将为<scope>provided</scope>

我正在使用的Hibernate版本是

<!-- Hibernate 4.3.6 core library library -->
        <dependency>
            <groupId>org.hibernate</groupId>
            <artifactId>hibernate-core</artifactId>
            <version>4.3.6.Final</version>
            <exclusions>
                <exclusion>
                    <groupId>xml-apis</groupId>
                    <artifactId>xml-apis</artifactId>
                </exclusion>
            </exclusions>
        <!-- <scope>provided</scope> Uncomment for wildFly 10.0 FINAL --> 
        </dependency>

        <!-- Hibernate 4.3.6 JPA support -->
        <dependency>
            <groupId>org.hibernate</groupId>
            <artifactId>hibernate-entitymanager</artifactId>
            <version>4.3.6.Final</version>
            <!-- <scope>provided</scope> Uncomment for wildFly 10.0 FINAL --> 
        </dependency>

0 个答案:

没有答案