我正在制作一个 Java 应用程序,它使用Restlet创建一个宁静的 API。从 Eclipse 运行它时它工作得很好,但是每当我生成一个 .exe 文件(使用exe4j)并从那里运行它时,restful API 停止工作并显示Not found
错误(10.4.5 404 Not Found)
为什么会这样?
据我所知,我在创建 .exe 时包含了所有需要的库。这是我.xml
在 exe4j 中使用的文件:
<pathelement location="${lib}/com.mysql.jdbc_5.1.5.jar" />
<pathelement location="${lib}/jacob.jar" />
<pathelement location="${lib}/joda-time-2.3.jar" />
<pathelement location="${lib}/json-simple-1.1.1.jar" />
<pathelement location="${lib}/junit-4.11.jar" />
<pathelement location="${lib}/log4j-api-2.0.1.jar" />
<pathelement location="${lib}/log4j-core-2.0.1.jar" />
<pathelement location="${lib}/mail.jar" />
<pathelement location="${lib}/ojdbc6.jar" />
<pathelement location="${lib}/org.restlet.jar" />
<pathelement location="${lib}/pdfbox-app-1.8.0.jar" />
<pathelement location="${lib}/sigar.jar" />
<pathelement location="${lib}/sqlite-jdbc-3.7.2.jar" />
<pathelement location="${lib}/guava-17.0.jar" />
<pathelement location="${lib}/zeromq.jar" />
如果这完全相关,这是我创建路线的方式:
/* Creates a root Restlet that will receive all incoming calls.*/
@Override
public Restlet createInboundRoot() {
// Create a router Restlet that routes each call to the relevant instance
Router router = new Router(getContext());
// Defines routes
router.attach("/users", UsersController.class);
router.attach("/departments", DepartmentsController.class);
router.attach("/absences", AbsencesController.class);
router.attachDefault(RestDefault.class);
return router;
}