播放2启动方法无法执行Java
我在Play2.5应用程序中有一些代码,在启动时执行。它在本地机器上运行良好,但在生产服务器上无法执行。 以下是相关代码: 这是启动类的构造函数:播放2启动方法无法执行Java,java,playframework-2.0,startup,Java,Playframework 2.0,Startup,我在Play2.5应用程序中有一些代码,在启动时执行。它在本地机器上运行良好,但在生产服务器上无法执行。 以下是相关代码: 这是启动类的构造函数: @Inject public StartupController(ActorSystem system, CreditCardChargeJob chargeJob, ProductService productService, RoleService roleService) { Logger.info("Applica
@Inject
public StartupController(ActorSystem system, CreditCardChargeJob chargeJob,
ProductService productService, RoleService roleService) {
Logger.info("Application startup...");
this.system = system;
this.chargeJob = chargeJob;
this.productService = productService;
this.roleService = roleService;
fillDatabase();
createCreditCardChargeJob();
}
以下是定义绑定的模块:
public class Module extends AbstractModule {
@Override
protected void configure() {
Logger.info("Binding on startup class...");
bind(StartupController.class).asEagerSingleton();
}
}
以及我定义模块的application.conf部分:
play.modules {
enabled += be.objectify.deadbolt.java.DeadboltModule
enabled += modules.CustomDeadboltHook
enabled += modules.Module
}
localhost上的日志输出为:
[info] application - Binding on startup class...
[info] application - Creating Pool for datasource 'default'
[info] p.a.d.DefaultDBApi - Database [default] connected at jdbc:mysql://localhost/creditperfection
[info] application - Application startup...
[info] application - ActorSystem: akka://application
[info] application - Credit card charging job is running...
在服务器上,只有以下内容:
[INFO] from play.api.db.DefaultDBApi in main - Database [default] connected at jdbc:mysql://localhost/creditperfection
[INFO] from play.api.Play in main - Application started (Prod)
因此,正如您从日志中看到的,启动时应该执行的控制器由于某种原因未能运行。问题似乎不在代码中,因为它在本地主机上工作,我真的很坚持。如果任何人至少有一点点的想法是什么会导致这种行为,请让我知道你的想法 谢谢你的帮助!
Vitalii产品上的db是否有不同的配置?产品上的db是否有不同的配置?