Open urbandroid opened 7 months ago
@urbandroid , We have not tested your application yet but looking at the name of repo and your server.xml are you expecting the jakartaee-10.0
feature to enable GraphQL
? If you're project requires GraphQL see: https://openliberty.io/docs/latest/reference/feature/mpGraphQL-2.0.html
@pnicolucci Graphql works no problem there, i'm trying to create a app server agnostic jakarta ee starter. so no I'm not expecting jakarta ee feature to enable GraphQL. Basic Jakarta ee feature which is JSF not working as expected for Openliberty.
Hi @urbandroid
Sorry for following up a week late...
I'm unable to you your app locally on my machine. If you could provide logs (or the built app), that would be great.
Add the following to the server.xml:
<logging traceSpecification="com.ibm.ws.jsf*=all:org.apache.myfaces*=all:com.ibm.ws.webcontainer*=all:com.ibm.ws.jsp=all"
traceFileName="trace.log"
maxFileSize="20"
maxFiles="10"
traceFormat="BASIC" />
You'll find the trace under the <server>
/logs folder. Thanks!
@volosied On debug branch
Hmm. I get a Context Root Not Found
when I go to http://localhost:9080/deneme2-web/
If I use curl from within the container, the page is accessed (but this error):
<h2>Members</h2>Error 500: jakarta.servlet.ServletException: WELD-000049: Unable to invoke public void deneme2.deneme2.data.MemberListProducer.retrieveAllMembersOrderedByName() on deneme2.deneme2.data.MemberListProducer@bd18ae1a
Once thing I noticed -- you appears to be missing the faces servlet mapping in the web.xml.
https://github.com/urbandroid/graphql-jakarta/blob/debug/deneme2-web/src/main/webapp/WEB-INF/web.xml
You'll need this:
<servlet>
<servlet-name>Faces Servlet</servlet-name>
<servlet-class>jakarta.faces.webapp.FacesServlet</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>Faces Servlet</servlet-name>
<url-pattern>*.jsf</url-pattern>
</servlet-mapping>
This mapping might be the problem, actually. You list index.jsf here: https://github.com/urbandroid/graphql-jakarta/blob/debug/deneme2-web/src/main/webapp/index.html#L21
But that mapping doesn't exist.
Give it a try and let me know if it works. I tested with the ear locally (without docker) and it seemed to have worked ( but I still encountered the CDI exception)
adding servlet mapping solved the issue but i'm not sure that should be needed Wildfly and Payara works fine without it, what does the jakarta spec says about it. Is it needed according to standarts?
Liberty uses MyFaces. However those two servers use Mojarra, so the mapping may likely be added automatically based on various conditions.
https://jakarta.ee/specifications/faces/4.0/jakarta-faces-4.0#a6076
Jakarta Faces implementations must support web application that define a <servlet-mapping> that maps any valid url-pattern to the FacesServlet.
In addition to FacesServlet, Jakarta Faces implementations may support other ways to invoke the Jakarta Faces request processing lifecycle, but applications that rely on these mechanisms will not be portable.
I would recommend to contain faces servlet mappings so that the applications are portable.
Quick follow up.
@pnicolucci noticed that Mojarra looks for the FacesConfig
annotation (which you have here), but MyFaces does not. This likely explains why Faces Servlet is not added automatically.
I saw comments in Mojarra regarding FacesConfig and CDI, so let me start a new discussion what the proper handing is here. We may be able to update MyFaces.
This setup works for both payara and wildfly but it fails for openliberty
https://github.com/urbandroid/graphql-jakarta/tree/debug
it throws error below when i try to open http://localhost:9080/deneme2-web/:
Error 404: jakarta.servlet.ServletException: java.io.FileNotFoundException: SRVE0190E: File not found: /index.jsf
I'm using openliberty/open-liberty:full-java11-openj9-ubi docker image here is my server.xml
`<?xml version="1.0" encoding="UTF-8"?>