Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/376.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/eclipse/8.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Heroku java服务器崩溃_Java_Eclipse_Maven_Heroku - Fatal编程技术网

Heroku java服务器崩溃

Heroku java服务器崩溃,java,eclipse,maven,heroku,Java,Eclipse,Maven,Heroku,我已经开发了一个java项目,它在eclipse中运行良好,我想将它存储在heroku上。按照指示去做。我更新了pom依赖项,推送了项目并得到了构建成功的指示,但是在尝试使用heroku ps命令时,我得到了一个服务器崩溃错误,它说找不到我的主类。以下是日志错误: 2015-10-22T17:32:32.303445+00:00 heroku[web.1]: Starting process with command `j ava -XX:+UseCompressedOops -cp bin:t

我已经开发了一个java项目,它在eclipse中运行良好,我想将它存储在heroku上。按照指示去做。我更新了pom依赖项,推送了项目并得到了构建成功的指示,但是在尝试使用heroku ps命令时,我得到了一个服务器崩溃错误,它说找不到我的主类。以下是日志错误:

2015-10-22T17:32:32.303445+00:00 heroku[web.1]: Starting process with command `j
ava -XX:+UseCompressedOops -cp bin:target/dependency/* ServerMain`
2015-10-22T17:32:34.107670+00:00 app[web.1]: Setting JAVA_TOOL_OPTIONS defaults
based on dyno size. Custom settings will override them.
2015-10-22T17:32:34.118434+00:00 app[web.1]: Picked up JAVA_TOOL_OPTIONS: -Xmx38
4m -Xss512k -Dfile.encoding=UTF-8
2015-10-22T17:32:34.482566+00:00 app[web.1]: Error: Could not find or load main
class ServerMain
2015-10-22T17:32:35.596974+00:00 heroku[web.1]: State changed from starting to c
rashed
2015-10-22T17:32:35.582629+00:00 heroku[web.1]: Process exited with status 1
我的Procfile如下所示:
web:java$java\u OPTS-cp-bin:target/dependency/*ServerMain
我所有的java类都在bin文件夹中,ServerMain文件包含一个main函数。知道我做错了什么吗?

(重复评论中的内容,以便将其标记为已回答)

确保使用Maven编译类,然后将
bin
更改为
target/classes
,以便
Procfile
包含以下内容:

web: java $JAVA_OPTS -cp target/classes:target/dependency/* ServerMain

bin目录中的类可能是由Eclipse生成的。

您的
ServerMain
是否存在于根包中,还是应该是
com.myapp.ServerMain
(或其他什么)?是的,它在我的根包中。当您从本地命令行运行
heroku运行ls bin/ServerMain.class
时会发生什么?它说没有这样的文件或目录,这就是问题所在。你希望这些类文件如何到达那里?如果maven正在构建你的应用程序,它会希望类文件位于
target/classes
。如果运行heroku运行ls target/classes/ServerMain.class,会怎么样?