I'm making a Java application which uses Restlet to create a restful API.
It works pretty well when running it from Eclipse but whenever I generate a .exe file (with exe4j ) and I run it from there the restful API stops working showing a Not found
error (10.4.5 404 Not Found)
Why is this happening?
I'm including all the needed libraries when creating the .exe as far as I know. This is my .xml
file used in 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" />
In case this is relevant at all, here's the way I create the routes:
/* 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;
}
Hard to say, I don't know exe4j.
What I see is, that you use
exe4jc.exe
with jars from${lib}
but you don't reference to${dist}/${ant.project.name}.jar
. So it seems your code that is build won't get into the executable. That is the reason the server cannot find it (404).