我已经花了两天的时间来解决这个问题。
我有这样的配置(用Java代码):
Map configuration = new HashMap();
configuration.put("wrapper.java.app.mainclass", "mypackage.MyService");
configuration.put("wrapper.java.command", "java");
configuration.put("wrapper.console.loglevel","DEBUG");
WrappedProcess w = (WrappedProcess) WrappedProcessFactory.createProcess(configuration, false);
w.init();
w.start();
w.waitFor(10000);
“ MyService”类仅包含“ main”方法。
运行应用程序时,我收到以下日志:
"C:\Program Files\Java\jdk1.8.0_172\bin\java" -agentlib:jdwp=transport=dt_socket,address=127.0.0.1:57453,suspend=y,server=n -Dfile.encoding=UTF-8 -classpath <lengthy classpath goes here>
Connected to the target VM, address: '127.0.0.1:57453', transport: 'socket'
Jul 07, 2018 7:54:38 PM org.apache.commons.vfs2.VfsLog info
INFO: Using "C:\Users\Wojtek\AppData\Local\Temp\vfs_cache" as temporary files store.
WARNING|wrapper|mypackage.MyService|18-07-07 19:54:39|YAJSW: yajsw-stable-12.12
WARNING|wrapper|mypackage.MyService|18-07-07 19:54:39|OS : Windows 10/10.0/amd64
WARNING|wrapper|mypackage.MyService|18-07-07 19:54:39|JVM : Oracle Corporation/1.8.0_172/C:\Program Files\Java\jdk1.8.0_172\jre/64
system.env 39
INFO|wrapper|mypackage.MyService|18-07-07 19:54:51|started process with pid 5808
INFO|wrapper|mypackage.MyService|18-07-07 19:54:52|Shutting down Wrapper
Disconnected from the target VM, address: '127.0.0.1:57453', transport: 'socket'
Process finished with exit code 0
但是,永远不会调用MyService类的“ main”方法。为什么?