Re: Which maven provided dependencies to target Tomcat ?

2018-05-09 Thread Xavier Dupont
Hi Luis,

I'm sorry to say that if you use javaee-web-api on Tomcat, you will pull,
among others, javax.transaction:javax.transaction-api:1.2 which contains,
for example, javax.transaction.HeuristicCommitException and if you try to
put resp.getWriter.println(HeuristicCommitException.class.getName()); your
IDE won't complain but the servlet will throw a ClassNotFound exception at
runtime.

This assuming javax.transaction.HeuristicCommitException is not brought by
some other dependency.

You will get the same result with many other dependencies of javaee-web-api.

I actually performed the same experience with all 17 dependencies of
javaee-web-api, selecting one arbitrary class and checking if it was found
when deployed on tomcat, and I found that only the following should be
included in a project which targets tomcat 8.5 / Java EE 7


javax.el
javax.el-api
3.0.0
provided


javax.servlet
javax.servlet-api
3.1.0
provided


javax.servlet.jsp
javax.servlet.jsp-api
2.3.1
provided


javax.websocket
javax.websocket-api
1.0
provided


javax.annotation
javax.annotation-api
1.2
provided


Xavier

2018-05-09 18:17 GMT+02:00 Luis Rodríguez Fernández <uo67...@gmail.com>:

> Hello Xavier,
>
> Perhaps you can have a look here:
> https://wiki.apache.org/tomcat/Specifications.
>
> Me, I have:
>
> 
> javax
> javaee-web-api
> 7.0
> provided
> 
>
> Hope it helps,
>
> Luis
>
>
>
>
>
> 2018-05-09 16:35 GMT+02:00 Xavier Dupont <xavier...@gmail.com>:
>
> > Hi guys.
> >
> > If I want to target the Java EE full profile, I use go here
> > https://mvnrepository.com/artifact/javax/javaee-api/8.0 and get the
> > following XML snippet.
> >
> > 
> > javax
> > javaee-api
> > 8.0
> > provided
> > 
> >
> > If I want to target the Java EE web profile, I use  this url instead
> > https://mvnrepository.com/artifact/javax/javaee-web-api/8.0
> >
> > And if I only need a subset of JSRs included in the javaee web profile,
> > they are all nicely included in the list of compile dependencies, this is
> > all very nice.
> >
> > Since tomcat only supports a subset of the web profile, which
> dependencies
> > should be added in maven ?
> >
> > Here's the full list for the Java EE 7 Web profile.
> >
> > javax.annotation:javax.annotation-api:1.2
> > javax.ejb:javax.ejb-api:3.2
> > javax.el:javax.el-api:3.0.0
> > javax.enterprise:cdi-api:1.1
> > javax.faces:javax.faces-api:2.2
> > javax.inject:javax.inject:1
> > javax.interceptor:javax.interceptor-api:1.2
> > javax.json:javax.json-api:1.0
> > javax.servlet:javax.servlet-api:3.1.0
> > javax.servlet.jsp:javax.servlet.jsp-api:2.3.1
> > javax.servlet.jsp.jstl:javax.servlet.jsp.jstl-api:1.2.1
> > javax.transaction:javax.transaction-api:1.2
> > javax.validation:validation-api:1.1.0.Final
> > javax.websocket:javax.websocket-api:1.0
> > javax.ws.rs:javax.ws.rs-api:2.0
> > org.eclipse.persistence:javax.persistence:2.1.0
> > org.glassfish:javax.faces:2.2.0
> >
> > I ask because I couldn't find the answer on the web, and it seems to me
> > that many sources are actually quite wrong and how it should be done.
> > I believe this should appear in a section of the tomcat documentation, at
> > least for versions 6, 7, and 8 of Java EE, which Tomcat seems to track.
> >
> > Xavier.
> >
>
>
>
> --
>
> "Ever tried. Ever failed. No matter. Try Again. Fail again. Fail better."
>
> - Samuel Beckett
>


Which maven provided dependencies to target Tomcat ?

2018-05-09 Thread Xavier Dupont
Hi guys.

If I want to target the Java EE full profile, I use go here
https://mvnrepository.com/artifact/javax/javaee-api/8.0 and get the
following XML snippet.


javax
javaee-api
8.0
provided


If I want to target the Java EE web profile, I use  this url instead
https://mvnrepository.com/artifact/javax/javaee-web-api/8.0

And if I only need a subset of JSRs included in the javaee web profile,
they are all nicely included in the list of compile dependencies, this is
all very nice.

Since tomcat only supports a subset of the web profile, which dependencies
should be added in maven ?

Here's the full list for the Java EE 7 Web profile.

javax.annotation:javax.annotation-api:1.2
javax.ejb:javax.ejb-api:3.2
javax.el:javax.el-api:3.0.0
javax.enterprise:cdi-api:1.1
javax.faces:javax.faces-api:2.2
javax.inject:javax.inject:1
javax.interceptor:javax.interceptor-api:1.2
javax.json:javax.json-api:1.0
javax.servlet:javax.servlet-api:3.1.0
javax.servlet.jsp:javax.servlet.jsp-api:2.3.1
javax.servlet.jsp.jstl:javax.servlet.jsp.jstl-api:1.2.1
javax.transaction:javax.transaction-api:1.2
javax.validation:validation-api:1.1.0.Final
javax.websocket:javax.websocket-api:1.0
javax.ws.rs:javax.ws.rs-api:2.0
org.eclipse.persistence:javax.persistence:2.1.0
org.glassfish:javax.faces:2.2.0

I ask because I couldn't find the answer on the web, and it seems to me
that many sources are actually quite wrong and how it should be done.
I believe this should appear in a section of the tomcat documentation, at
least for versions 6, 7, and 8 of Java EE, which Tomcat seems to track.

Xavier.