2014-02-09 72 views
0

我已經在amazon ec2 ubuntu instance上部署了我的play framework 1.2.5應用程序。我根據什麼play.1.2.5 production tutorial says配置。啓動我的應用程序後,它將引發用於休眠配置的異常。我非常努力地在production上部署和配置我的應用程序。信息跟蹤就是這樣。Play框架1.x'hibernate.properties not found'問題

2014-02-09 16:51:41,531 - Precompiling ... 
2014-02-09 16:52:36,885 - Connected to jdbc:mysql://127.0.0.1/emirbazaridb?useUnicode=yes&characterEncoding=UTF-8&connectionCollation=utf8_general_ci 
2014-02-09 16:52:37,194 - Hibernate Commons Annotations 3.2.0.Final 
2014-02-09 16:52:37,202 - Hibernate 3.6.10.Final 
2014-02-09 16:52:37,203 - hibernate.properties not found 
2014-02-09 16:52:37,206 - Bytecode provider name : javassist 
2014-02-09 16:52:37,212 - using JDK 1.4 java.sql.Timestamp handling 
2014-02-09 16:52:37,325 - Hibernate EntityManager 3.6.10.Final 
2014-02-09 16:52:37,426 - Binding entity from annotated class: models.Comments 
2014-02-09 16:52:37,463 - Bind entity models.Comments on table Comments 
2014-02-09 16:52:37,583 - Binding entity from annotated class: models.Prod 
2014-02-09 16:52:37,663 - Binding entity from annotated class: models.CommentDetail 
2014-02-09 16:52:37,663 - Bind entity models.CommentDetail on table commentdetail 
2014-02-09 16:52:37,667 - Binding entity from annotated class: models.UserMetaData 
2014-02-09 16:52:37,668 - Bind entity models.UserMetaData on table usermetadata 
2014-02-09 16:52:37,683 - Binding entity from annotated class: models.Messages 
2014-02-09 16:52:37,683 - Bind entity models.Messages on table messages 
2014-02-09 16:52:38,636 - Database -> 
     name : MySQL 
    version : 5.5.35-0ubuntu0.12.04.2 
     major : 5 
     minor : 5 
2014-02-09 16:52:38,636 - Driver -> 
     name : MySQL-AB JDBC Driver 
    version : mysql-connector-java-5.1.20 (Revision: [email protected]) 
     major : 5 
     minor : 1 
2014-02-09 16:52:38,646 - Using default transaction strategy (direct JDBC transactions) 
2014-02-09 16:52:38,649 - No TransactionManagerLookup configured (in JTA environment, use of read-write or transactional second-level cache is not recommended) 
2014-02-09 16:52:38,649 - Automatic flush during beforeCompletion(): disabled 
2014-02-09 16:52:38,649 - Automatic session close at end of transaction: disabled 
2014-02-09 16:52:38,649 - JDBC batch size: 15 
2014-02-09 16:52:38,649 - JDBC batch updates for versioned data: disabled 
2014-02-09 16:52:38,650 - Scrollable result sets: enabled 
2014-02-09 16:52:38,650 - JDBC3 getGeneratedKeys(): enabled 
2014-02-09 16:52:38,650 - Connection release mode: auto 
2014-02-09 16:52:38,650 - Maximum outer join fetch depth: 2 
2014-02-09 16:52:38,650 - Default batch fetch size: 1 
2014-02-09 16:52:38,650 - Generate SQL with comments: disabled 
2014-02-09 16:52:38,651 - Order SQL updates by primary key: disabled 
2014-02-09 16:52:38,651 - Order SQL inserts for batching: disabled 
2014-02-09 16:52:38,651 - Query translator: org.hibernate.hql.ast.ASTQueryTranslatorFactory 
2014-02-09 16:52:38,657 - Using ASTQueryTranslatorFactory 
2014-02-09 16:52:38,657 - Query language substitutions: {} 
2014-02-09 16:52:38,658 - JPA-QL strict compliance: enabled 
2014-02-09 16:52:38,658 - Second-level cache: enabled 
2014-02-09 16:52:38,658 - Query cache: disabled 
2014-02-09 16:52:38,658 - Cache region factory : org.hibernate.cache.impl.NoCachingRegionFactory 
2014-02-09 16:52:38,659 - Optimize cache for minimal puts: disabled 
2014-02-09 16:52:38,659 - Structured second-level cache entries: disabled 
2014-02-09 16:52:38,671 - Statistics: disabled 
2014-02-09 16:52:38,671 - Deleted entity synthetic identifier rollback: disabled 
2014-02-09 16:52:38,671 - Default entity-mode: pojo 
2014-02-09 16:52:38,671 - Named query checking : enabled 
2014-02-09 16:52:38,671 - Check Nullability in Core (should be disabled when Bean Validation is on): disabled 
2014-02-09 16:52:38,704 - building session factory 
2014-02-09 16:52:38,714 - Type registration [clob] overrides previous : [email protected] 
2014-02-09 16:52:38,714 - Type registration [java.sql.Clob] overrides previous : [email protected] 
2014-02-09 16:52:38,714 - Type registration [wrapper_materialized_blob] overrides previous : [email protected] 
2014-02-09 16:52:38,714 - Type registration [characters_clob] overrides previous : [email protected] 
2014-02-09 16:52:38,714 - Type registration [wrapper_characters_clob] overrides previous : [email protected] 
2014-02-09 16:52:38,714 - Type registration [blob] overrides previous : [email protected] 
2014-02-09 16:52:38,714 - Type registration [java.sql.Blob] overrides previous : [email protected] 
2014-02-09 16:52:38,714 - Type registration [materialized_clob] overrides previous : [email protected] 
2014-02-09 16:52:38,715 - Type registration [materialized_blob] overrides previous : [email protected] 
2014-02-09 16:52:39,801 - Not binding factory to JNDI, no JNDI name configured 
2014-02-09 16:52:40,421 - Application 'EB' is now started ! 
2014-02-09 16:52:41,196 - Listening for HTTP on port 9000 ... 

末的錯誤跟蹤:

@6h7p4k2lk 
Internal Server Error (500) for request GET/

Execution exception (In /app/controllers/ControllerUtility.java around line 33) 
PersistenceException occured : org.hibernate.exception.SQLGrammarException: could not execute query 

play.exceptions.JavaExecutionException: org.hibernate.exception.SQLGrammarException: could not execute query 
    at play.mvc.ActionInvoker.invoke(ActionInvoker.java:237) 
    at Invocation.HTTP Request(Play!) 
Caused by: javax.persistence.PersistenceException: org.hibernate.exception.SQLGrammarException: could not execute query 
    at org.hibernate.ejb.AbstractEntityManagerImpl.convert(AbstractEntityManagerImpl.java:1389) 
    at org.hibernate.ejb.AbstractEntityManagerImpl.convert(AbstractEntityManagerImpl.java:1317) 
    at org.hibernate.ejb.QueryImpl.getResultList(QueryImpl.java:255) 
    at play.db.jpa.JPQL.findAll(JPQL.java:32) 
    at models.Categories.findAll(Categories.java) 
    at controllers.ControllerUtility.checkPopUp(ControllerUtility.java:33) 
    at play.mvc.ActionInvoker.invoke(ActionInvoker.java:510) 
    at play.mvc.ActionInvoker.invokeControllerMethod(ActionInvoker.java:484) 
    at play.mvc.ActionInvoker.invokeControllerMethod(ActionInvoker.java:479) 
    at play.mvc.ActionInvoker.handleBefores(ActionInvoker.java:328) 
    at play.mvc.ActionInvoker.invoke(ActionInvoker.java:142) 
    ... 1 more 
Caused by: org.hibernate.exception.SQLGrammarException: could not execute query 
    at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:92) 
    at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:66) 
    at org.hibernate.loader.Loader.doList(Loader.java:2545) 
    at org.hibernate.loader.Loader.listIgnoreQueryCache(Loader.java:2276) 
    at org.hibernate.loader.Loader.list(Loader.java:2271) 
    at org.hibernate.loader.hql.QueryLoader.list(QueryLoader.java:459) 
    at org.hibernate.hql.ast.QueryTranslatorImpl.list(QueryTranslatorImpl.java:365) 
    at org.hibernate.engine.query.HQLQueryPlan.performList(HQLQueryPlan.java:196) 
    at org.hibernate.impl.SessionImpl.list(SessionImpl.java:1268) 
    at org.hibernate.impl.QueryImpl.list(QueryImpl.java:102) 
    at org.hibernate.ejb.QueryImpl.getResultList(QueryImpl.java:246) 
    ... 9 more 
Caused by: com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: Table 'emirbazaridb.CATEGORIES' doesn't exist 
    at com.mysql.jdbc.Util.handleNewInstance(Util.java:411) 
    at com.mysql.jdbc.Util.getInstance(Util.java:386) 
    at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:1052) 
    at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:4096) 
    at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:4028) 
    at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:2490) 
    at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2651) 
    at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2683) 
    at com.mysql.jdbc.PreparedStatement.executeInternal(PreparedStatement.java:2144) 
    at com.mysql.jdbc.PreparedStatement.executeQuery(PreparedStatement.java:2310) 
    at org.hibernate.jdbc.AbstractBatcher.getResultSet(AbstractBatcher.java:208) 
    at org.hibernate.loader.Loader.getResultSet(Loader.java:1953) 
    at org.hibernate.loader.Loader.doQuery(Loader.java:802) 
    at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:274) 
    at org.hibernate.loader.Loader.doList(Loader.java:2542) 
    ... 17 more 
2014-02-09 16:53:33,457 - Table 'emirbazaridb.CATEGORIES' doesn't exist 

回答

1

我覺得沒有找到hibernate.properties消息可能是一個紅色的鯡魚。您的堆棧跟蹤的最後一行可能是問題所在:

Table 'emirbazaridb.CATEGORIES' doesn't exist 

是否存在CATEGORIES表?

+0

不,它不存在。我只是將我的應用程序部署到服務器,並嘗試以prod模式啓動它。所以我期望jpa創建我的表格。我錯了嗎? – Emilla

+0

如果您希望JPA執行創建表的工作,那麼您需要確保application.properties中的「jpa.ddl」未設置爲「none」。請注意,[建議在生產環境中禁用自動模式更新](http://www.playframework.com/documentation/1.2.7/production) - 最好通過[evolutions]管理模式更改(http:// www。改爲使用playframework.com/documentation/1.2.7/evolutions)。 –

+0

啊,是的,我得到了。我無法相信我犯了這樣的錯誤。謝謝。我接受你的回答:) – Emilla