Search code examples
databaseplayframeworkproduction

Playframework cannot read database table on production?


I use play 1.2.1 to generate my war app. I use tomcat 6 in production with mysql 5 db. I've created my database, and importing all local tables to production database.

After I deploy my app to myapps tomcat dir then I restarting my server everything is fine as you can see on Log file like this.

Jul 23, 2011 11:20:52 PM org.apache.catalina.core.StandardEngine start
INFO: Starting Servlet Engine: Apache Tomcat/6.0.14
23:20:53,156 INFO  ~ Starting /usr/local/shared/tomcat/mainindonesia/webapps/ROOT/WEB-INF/application
23:20:53,159 WARN  ~ Declaring modules in application.conf is deprecated. Use dependencies.yml instead (module.crud)
23:20:53,159 ERROR ~ Module crud will not be loaded because /usr/local/shared/tomcat/mainindonesia/webapps/ROOT/WEB-INF/modules/crud does not exist
23:20:53,159 WARN  ~ Declaring modules in application.conf is deprecated. Use dependencies.yml instead (module.secure)
23:20:53,159 ERROR ~ Module secure will not be loaded because /usr/local/shared/tomcat/mainindonesia/webapps/ROOT/WEB-INF/modules/secure does not exist
23:20:53,160 INFO  ~ Module secure is available (/usr/local/shared/tomcat/mainindonesia/webapps/ROOT/WEB-INF/application/modules/secure)
23:20:53,160 INFO  ~ Module crud is available (/usr/local/shared/tomcat/mainindonesia/webapps/ROOT/WEB-INF/application/modules/crud)
23:20:53,299 INFO  ~ Application is precompiled
23:20:56,203 INFO  ~ Connected to jdbc:mysql://localhost:3306/mainindonesia?autoReconnect=true
23:20:57,870 INFO  ~ Application 'Website permainan tradisional anak Indonesia' is now started !
23:20:58,297 INFO  ~ Forcing PROD mode because deploying as a war file.

The problem appears when I access the home page. This error appears in my server log:

Jul 23, 2011 11:20:58 PM org.apache.tomcat.util.modeler.Registry registerComponent
SEVERE: Null component Catalina:type=JspMonitor,name=jsp,WebModule=//localhost/,J2EEApplication=none,J2EEServer=none
Jul 23, 2011 11:20:58 PM org.apache.coyote.http11.Http11AprProtocol start
INFO: Starting Coyote HTTP/1.1 on http-6503
Jul 23, 2011 11:20:58 PM org.apache.coyote.ajp.AjpAprProtocol start
INFO: Starting Coyote AJP/1.3 on ajp-4503
Jul 23, 2011 11:20:58 PM org.apache.catalina.startup.Catalina start
INFO: Server startup in 6564 ms
23:24:01,285 WARN  ~ SQL Error: 1146, SQLState: 42S02
23:24:01,285 ERROR ~ **Table 'mainindonesia.Permainan' doesn't exist**
23:24:01,381 ERROR ~ 

@677bmo2el
Internal Server Error (500)

Execution exception (In /app/controllers/Application.java around line 26)
JPAQueryException occured : Error while executing query from models.Permainan ORDER BY postedAt DESC: Table 'mainindonesia.Permainan' doesn't exist

In my prod db the table was exist but the application cannot read my table.


Solution

  • After searching I found this page. The solution is: edit application.conf files and uncomment the 'jpa.ddl=update' line.