Aadhaar Mehrotra
Aadhaar Mehrotra

Reputation: 155

REST using Jersey 2 (on GAE java application using Guice) not working on server

We are integrating REST using Jersey 2 in a GAE Java application which uses Guice for DI. We are able to do so on the local Dev server. When we deploy it to app-engine, it is unable to find beans (Rest classes) in the provided package whereas it can find the beans (Rest classes) when it's running on local.

The code looks like this

**** Code to add all available bean classes in the package. ****
rest("/api/*").packages("com.l3.server.mart.rest");

**** Code being used to read all beans in the package provided. ****
String resourcePath = packge.replace(".", "/");
URL resource = getClass().getClassLoader().getResource(resourcePath);

It returns resource URL correctly on local dev server but returns null when its running App-Engine server.

Please suggest what is the issue here?

Thanks Aadhaar

Upvotes: 0

Views: 73

Answers (1)

Aadhaar Mehrotra
Aadhaar Mehrotra

Reputation: 155

After trying many ways to debug the issue, I found a configuration in appengine-web.xml was the culprit.

The configuration is

<staging>
  <enable-jar-classes>true</enable-jar-classes>
</staging>

Removing this config solved the issue.

Upvotes: 3

Related Questions