Bruno Henrique Bruno Henrique - 1 year ago 120
Java Question

Java web service other than tomcat

Is there any web service that runs as a jar?

I've already tried using spark but besides from running a jar I need it to be able to render jsp files.

My current scenario is that I have a tomcat(.war) project that depends on another project(.jar) and I want to add some web functionalities to this second project.
However I cannot change it to a .war as one .war project cannot depend on another .war project.

Any help or guidance would be appreciated.

Answer Source

I'm facing a similar issue, and my workaround is less than elegant but I haven't found a better one yet.

To restate the issue:

  • ProjectA.war depends on X.class (or more) from Project B.jar
  • ProjectB.jar needs to be repackaged as Project B.war

The solution I'm going with:

  • Convert ProjectB.jar to ProjectB.war as needed
  • Manually extract the ProjectB.jar file from ProjectB.war and cite that extracted .jar as a dependency in ProjectA

(I followed How to extract .war files in java? ZIP vs JAR)

Depending on your build system you can also set ProjectB to build both a .war and a .jar for dependency at the same time; I'm using Maven and that's the path I'm eventually going so that I'm not manually digging out the .jar each time I update ProjectB, and then I'm just going to list that .jar as a dependency for ProjectA.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download