Running a REST endpoint on context-root (Payara and Thorntail)

66 views
Skip to first unread message

bruno....@gmail.com

unread,
Apr 26, 2019, 3:47:31 AM4/26/19
to Eclipse MicroProfile
Hi all,

While playing with latest version of MP (2.1) with Payara and Thorntail projects created from start.microprofile.io, I found that the code below works on Payara, but doesn't on Thorntail:

It is unclear whether this *should* (bug on Thorntail) or *shouldn't* work (Payara not following spec, if there is anything stating this behavior).

Would appreciate expert help on this one.

// MicroprofileRestApplication.java
@ApplicationPath("/")
@ApplicationScoped
public class MicroprofileRestApplication extends Application {

}

// HelloController.java
@Path("/")
@Singleton
public class HelloController {

@GET
public String sayHello() {
return "Hello App Service";
}

}

Ladislav Thon

unread,
Apr 26, 2019, 3:58:44 AM4/26/19
to MicroProfile
This totally should work on Thorntail and I've done this many times without an issue. Not sure if the Application class being @ApplicationScoped or the resource class being @Singleton makes a difference, but I'll check.

LT

pá 26. 4. 2019 v 9:47 odesílatel <bruno....@gmail.com> napsal:
--
You received this message because you are subscribed to the Google Groups "Eclipse MicroProfile" group.
To unsubscribe from this group and stop receiving emails from it, send an email to microprofile...@googlegroups.com.
To post to this group, send email to microp...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/microprofile/c560f928-0984-43e1-98d7-2c37df9467a8%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

bruno....@gmail.com

unread,
Apr 26, 2019, 4:44:24 AM4/26/19
to Eclipse MicroProfile
To get if working, I had to add @Produces(MediaType.TEXT_PLAIN)

No need to add this on Payara. 

If you find out what's wrong, please let us know.

Bruno


On Friday, April 26, 2019 at 12:58:44 AM UTC-7, Ladislav Thon wrote:
This totally should work on Thorntail and I've done this many times without an issue. Not sure if the Application class being @ApplicationScoped or the resource class being @Singleton makes a difference, but I'll check.

LT

pá 26. 4. 2019 v 9:47 odesílatel <bruno...@gmail.com> napsal:
Hi all,

While playing with latest version of MP (2.1) with Payara and Thorntail projects created from start.microprofile.io, I found that the code below works on Payara, but doesn't on Thorntail:

It is unclear whether this *should* (bug on Thorntail) or *shouldn't* work (Payara not following spec, if there is anything stating this behavior).

Would appreciate expert help on this one.

// MicroprofileRestApplication.java
@ApplicationPath("/")
@ApplicationScoped
public class MicroprofileRestApplication extends Application {

}

// HelloController.java
@Path("/")
@Singleton
public class HelloController {

@GET
public String sayHello() {
return "Hello App Service";
}

}

--
You received this message because you are subscribed to the Google Groups "Eclipse MicroProfile" group.
To unsubscribe from this group and stop receiving emails from it, send an email to microp...@googlegroups.com.

Ladislav Thon

unread,
Apr 26, 2019, 5:01:38 AM4/26/19
to MicroProfile
Here's a tiny application that should correspond to what you describe: https://github.com/Ladicek/thorntail-tinies/tree/test/javaee/jaxrs I ran `mvn clean package` to build a Thorntail uberjar, then `java -jar target/javaee-jaxrs-thorntail.jar` to run it, and `http localhost:8080` to check if it works. Can't see a problem.

Do you have your example app somewhere?

Thanks,

LT

pá 26. 4. 2019 v 10:44 odesílatel <bruno....@gmail.com> napsal:
To unsubscribe from this group and stop receiving emails from it, send an email to microprofile...@googlegroups.com.

To post to this group, send email to microp...@googlegroups.com.

Rhuan Henrique

unread,
Apr 26, 2019, 6:28:32 AM4/26/19
to MicroProfile
Hi, 

These code should work for both. What is the behavior? Did you have an exception?

Att,
Rhuan Rocha

To unsubscribe from this group and stop receiving emails from it, send an email to microprofile...@googlegroups.com.

To post to this group, send email to microp...@googlegroups.com.

bruno....@gmail.com

unread,
Apr 26, 2019, 6:45:35 PM4/26/19
to Eclipse MicroProfile
Hi LT,

I try to access the URL http://localhost:8080/ from Chrome, and what I get is a ERR_INVALID_SIGNED_EXCHANGE "This site can't be reached"

The endpoint works if I use cURL.

If I add the media type to the @GET endpoint, then it works.





On Friday, April 26, 2019 at 2:01:38 AM UTC-7, Ladislav Thon wrote:
Here's a tiny application that should correspond to what you describe: https://github.com/Ladicek/thorntail-tinies/tree/test/javaee/jaxrs I ran `mvn clean package` to build a Thorntail uberjar, then `java -jar target/javaee-jaxrs-thorntail.jar` to run it, and `http localhost:8080` to check if it works. Can't see a problem.

Do you have your example app somewhere?

Thanks,

LT

pá 26. 4. 2019 v 10:44 odesílatel <bruno...@gmail.com> napsal:

bruno....@gmail.com

unread,
Apr 26, 2019, 6:55:04 PM4/26/19
to Eclipse MicroProfile

Rhuan Henrique

unread,
Apr 26, 2019, 7:00:11 PM4/26/19
to MicroProfile
Thank you Bruno for shared it with us. 

To unsubscribe from this group and stop receiving emails from it, send an email to microprofile...@googlegroups.com.

To post to this group, send email to microp...@googlegroups.com.

Ladislav Thon

unread,
Apr 29, 2019, 4:02:10 AM4/29/19
to MicroProfile
so 27. 4. 2019 v 0:55 odesílatel <bruno....@gmail.com> napsal:
Very interesting, thanks!

LT
 
To unsubscribe from this group and stop receiving emails from it, send an email to microprofile...@googlegroups.com.

To post to this group, send email to microp...@googlegroups.com.

Ron Sigal

unread,
May 4, 2019, 8:14:22 PM5/4/19
to Eclipse MicroProfile
For the record, RESTEASY-2198 (and its clone https://issues.jboss.org/browse/RESTEASY-2236) are now fixed and closed. The fix will appear in releases 3.7.0.Final, in about a week, and 4.0.0.CR3, in a couple of days.

-Ron Sigal
 RESTEasy
Reply all
Reply to author
Forward
0 new messages