2017-01-15 6 views
0

作業を停止し、Tomcatを使用して、GradleのとMySQLデータベースといくつかのエンティティをマッピングするために/春を休止します。私がTomcatを起動するたびに、アプリケーションは一定期間(最大5日間)動作しますが、Tomcatを再起動するまで、すべてのSQLクエリで例外がスローされます。私は手動でMySQLのスキームを作成し、ツールをLiquiBaseを使用しているため<prop key="hibernate.hbm2ddl.auto">create</prop>がコメントしているHibernateマッピングは、私は、サーバーアプリを書いています随時

<beans xmlns="http://www.springframework.org/schema/beans" 
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
    xmlns:tx="http://www.springframework.org/schema/tx" 
    xmlns:context="http://www.springframework.org/schema/context" 
    xmlns:task="http://www.springframework.org/schema/task" 
    xmlns:aop="http://www.springframework.org/schema/aop" 
    xsi:schemaLocation="http://www.springframework.org/schema/beans 
    http://www.springframework.org/schema/beans/spring-beans-4.0.xsd 
    http://www.springframework.org/schema/tx 
    http://www.springframework.org/schema/tx/spring-tx-4.0.xsd 
    http://www.springframework.org/schema/context 
    http://www.springframework.org/schema/context/spring-context-4.0.xsd 
    http://www.springframework.org/schema/task   http://www.springframework.org/schema/task/spring-task-4.0.xsd 
    http://www.springframework.org/schema/aop 
    http://www.springframework.org/schema/aop/spring-aop-4.0.xsd"> 

<tx:annotation-driven transaction-manager="transactionManager"/> 
<context:annotation-config /> 
<context:component-scan base-package="entertainment.service" /> 

<bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource" 
     destroy-method="close"> 
    <property name="driverClassName" value="com.mysql.jdbc.Driver" /> 
    <property name="url" value="jdbc:mysql://localhost/mmd?characterEncoding=UTF-8" /> 
    <property name="username" value="root" /> 
    <property name="password" value="plannidev" /> 

    <!--Configuration--> 
    <property name="validationQuery" value="SELECT 1" /> 
    <property name="validationQueryTimeout" value="60" /> 
    <property name="testOnBorrow" value="true" /> 
    <property name="removeAbandoned" value="true" /> 
    <property name="removeAbandonedTimeout" value="60" /> 

    <property name="initialSize" value="8" /> 
    <property name="maxActive" value="10" /> 
    <property name="maxIdle" value="10" /> 
    <property name="minIdle" value="0" /> 
    <property name="maxWait" value="10000" /> 

    <property name="timeBetweenEvictionRunsMillis" value="28800000" /> <!--8 hours--> 
    <property name="testWhileIdle" value="true" /> 

</bean> 

<bean id="sessionFactory" 
     class="org.springframework.orm.hibernate4.LocalSessionFactoryBean "> 
    <property name="dataSource" ref="dataSource" /> 
    <property name="annotatedClasses"> 
     <list> 
      <!-- my entity classes --> 
     </list> 
    </property> 
    <property name="hibernateProperties"> 
     <props> 
      <prop key="hibernate.dialect">org.hibernate.dialect.MySQLDialect</prop> 
      <prop key="show_sql">true</prop> 
      <prop key="format_sql">true</prop> 
      <!-- <prop key="hibernate.hbm2ddl.auto">create</prop> --> 
      <prop key="connection.pool_size">10</prop> 
      <prop key="hibernate.enable_lazy_load_no_trans">true</prop> 
      <prop key="hibernate.connection.charSet">utf8</prop> 
      <prop key="hibernate.connection.characterEncoding">utf8</prop> 
      <prop key="hibernate.connection.useUnicode">true</prop> 
     </props> 
    </property> 
</bean> 

<bean id="transactionManager" 
       class="org.springframework.orm.hibernate4.HibernateTransactionManager"> 
    <property name="sessionFactory" ref="sessionFactory"/> 
</bean> 

<!-- my beans here--> 

</beans> 

プロパティ:ここ

could not extract ResultSet 
org.hibernate.exception.internal.StandardSQLExceptionConverter.convert(StandardSQLExceptionConverter.java:54) 
org.hibernate.engine.jdbc.spi.SqlExceptionHelper.convert(SqlExceptionHelper.java:126) 
org.hibernate.engine.jdbc.spi.SqlExceptionHelper.convert(SqlExceptionHelper.java:112) 
org.hibernate.engine.jdbc.internal.ResultSetReturnImpl.extract(ResultSetReturnImpl.java:91) 
org.hibernate.loader.Loader.getResultSet(Loader.java:2066) 
org.hibernate.loader.Loader.executeQueryStatement(Loader.java:1863) 
org.hibernate.loader.Loader.executeQueryStatement(Loader.java:1839) 
org.hibernate.loader.Loader.doQuery(Loader.java:910) 
org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:355) 
org.hibernate.loader.Loader.doList(Loader.java:2554) 
org.hibernate.loader.Loader.doList(Loader.java:2540) 
org.hibernate.loader.Loader.listIgnoreQueryCache(Loader.java:2370) 
org.hibernate.loader.Loader.list(Loader.java:2365) 
org.hibernate.loader.criteria.CriteriaLoader.list(CriteriaLoader.java:126) 
org.hibernate.internal.SessionImpl.list(SessionImpl.java:1682) 
org.hibernate.internal.CriteriaImpl.list(CriteriaImpl.java:380) 

は私のXML設定ファイルの一部です。ここでは、常に同じである例外スタックは、ありますdbをパススルーするためのものです。残念ながら、私はここでそれをコードを投稿するエンティティクラスの多くを持って

dependencies { 
compile fileTree(dir: 'libs', include: ['*.jar']) 
compile 'org.slf4j:slf4j-api:1.7.7' 
compile 'com.factual:factual-java-driver:1.8.8' 
compile 'com.google.code.gson:gson:2.3.1' 
compile 'org.jsoup:jsoup:1.8.1' 
compile 'de.u-mass:lastfm-java:0.1.2' 
compile 'com.sun.jersey:jersey-server:1.19' 
compile 'junit:junit:4.12' 
compile 'org.hibernate:hibernate-core:4.3.8.Final' 
compile 'org.hibernate:hibernate-entitymanager:4.3.8.Final' 
compile 'org.hibernate:hibernate-validator:5.1.3.Final' 
compile 'org.hibernate:hibernate-commons-annotations:3.2.0.Final' 
compile 'org.hibernate.javax.persistence:hibernate-jpa-2.1-api:1.0.0.Final' 
compile 'org.jboss.logging:jboss-logging:3.2.1.Final' 
compile 'com.sun.jersey:jersey-core:1.19' 
compile 'com.sun.jersey:jersey-server:1.19' 
compile 'com.sun.jersey:jersey-servlet:1.19' 

compile 'jstl:jstl:1.2' 
compile 'com.sun.jersey:jersey-json:1.19' 
compile 'mysql:mysql-connector-java:5.1.35' 
compile 'joda-time:joda-time-hibernate:1.3' 
compile 'org.jadira.usertype:usertype.core:3.2.0.GA' 
compile 'javax.mail:mail:1.4.7' 
compile 'com.squareup.okhttp3:okhttp:3.2.0' 
compile 'com.javadocmd:simplelatlng:1.3.1' 
compile 'com.intersult:jpa-fix:1.1' 

compile 'com.mashape.unirest:unirest-java:1.4.9' 
compile 'commons-logging:commons-logging:1.2' 
compile 'org.apache.httpcomponents:httpasyncclient:4.1.2' 
compile 'org.apache.httpcomponents:httpcore:4.4.5' 
compile 'org.apache.httpcomponents:httpclient:4.5.2' 
compile 'org.apache.httpcomponents:httpcore-nio:4.4.5' 
compile 'org.apache.httpcomponents:httpmime:4.5.2' 
compile 'org.json:json:20160212' 

compile 'org.springframework:spring-core:4.3.1.RELEASE' 
compile 'org.springframework:spring-context-support:4.3.1.RELEASE' 
compile 'org.springframework:spring-web:4.3.1.RELEASE' 
compile 'org.springframework:spring-orm:4.3.1.RELEASE' 
compile 'org.springframework:spring-tx:4.3.1.RELEASE' 
compile 'org.springframework:spring-aop:4.3.1.RELEASE' 

compile 'org.neo4j.driver:neo4j-java-driver:1.0.3' 
compile 'org.neo4j.test:neo4j-harness:3.1.0-M05' 

compile 'com.sun.jersey.contribs:jersey-spring:1.8' 

compile 'commons-dbcp:commons-dbcp:1.4' 

compile 'org.apache.commons:commons-lang3:3.4' 
compile 'org.apache.commons:commons-collections4:4.1' 

compile 'org.liquibase:liquibase-core:3.5.1' 
compile 'com.amazonaws:aws-java-sdk:1.11.26' 

compile 'io.reactivex:rxjava:1.1.9' 
compile 'com.restfb:restfb:1.30.0' 

compile group: 'com.github.davidmoten', name: 'geo', version: '0.7.1' 
compile group: 'org.aspectj', name: 'aspectjweaver', version: '1.6.10' 
compile group: 'org.springframework.retry', name: 'spring-retry', version: '1.1.2.RELEASE' 

providedCompile 'javax.servlet:servlet-api:2.5' 
providedCompile 'org.apache.tomcat:tomcat-jsp-api:7.0.55' 

testCompile "junit:junit:4.11" 
testCompile "org.mockito:mockito-all:1.9.5" 

} 

は、ここに私の依存関係です。おそらく誰かが私の設定ですべてがOKであるかどうか私を助けることができましたか?または、誰かが同様の問題に直面したのでしょうか?あらかじめありがとうございます。など

+0

は完全なスタックトレースをポストするかもしれませんか?エラーの原因となったクエリ? –

+0

各SQLクエリは、私が自動で外部キーとしてマークされている一部の列は、スキーマを作成したことがわかった。この同じスタックトレース –

答えて

1

あなたはおそらく休止状態は、モデルへのDBからの値をマッピングすることはできませんので、uはあなたのエンティティ内のプロパティをint型または有効な列挙値ではなくバインドするバインディング文字列をしようとしているとき、それが起こる可能性があり、このエラーを取得している

hbm2dllでhibernateを実行しようとしますの値

+0

で終わる(I *が設定されている場合、<キー=「hibernate.hbm2ddl.auto」を支える> *を作成する)ようにマークされていません私の手動で作成されたスキーマでは、それは理由かもしれませんか?私はそうは思わない –

+0

、 エンティティーが存在しない、あなたの外部キーによって参照するときに、例外を取得しますが、uは検証モードでhbm2dllで休止状態走っている間、それはあなたが任意の例外を取得していないEntityNotFoundException – Bartun

+0

でしょうか? – Bartun

関連する問題