Hi Mark, I've finally started my embedded Tomcat project. I'm running into NPE for the JSP servlet. From the log:
https://pastebin.com/thiADVYE I think I have everything setup correctly because accessing http://localhost/css/sample.css works. I've even added the 5 listeners in the server.xml configuration while troubleshooting. My JSP is really basic: https://pastebin.com/X7R8weKv When I inspecting the code where the NPE is thrown: // Get the cached EL expression factory for this context expressionFactory = JspFactory.getDefaultFactory().getJspApplicationContext( compiler.getCompilationContext().getServletContext()). getExpressionFactory(); I couldn't figure out which part is the NPE. I have the following jars: *) all 4 tomcat-embed-* *) tomcat-annotations-api *) ecj-3.21 *) jstl 1.2 ( to troubleshoot this NPE ) On Thu, Jun 20, 2019 at 2:14 AM Tommy Pham <tommy...@gmail.com> wrote: > Hi Mark, > > Thanks for the feedback. > > On Mon, Jun 17, 2019 at 4:19 AM Mark Thomas <ma...@apache.org> wrote: > >> On 17/06/2019 01:04, Tommy Pham wrote: >> > Hello everyone, >> > >> > 1) Is there an official documentation for embedding TC process? My >> search >> > shows various how-to on other sites. >> > a) If not, I guess I could request to be added to the wiki to >> > contribute one. Since I don't quite know all the details of TC, is >> there a >> > review process to ensure clarity and complete coverage of embedding >> process? >> >> The Javadoc is probably the best place to start: >> http://tomcat.apache.org/tomcat-9.0-doc/api/index.html >> >> > I have started browsing through the API and have concluded shortly > thereafter that, to me, the best way to implement it is similar to my > current use of ServletContainerInitializer. Just need another class with > some adjustments and the app could run with Tomcat embedded. I was hoping > to read something more akin to the official guide: > > http://tomcat.apache.org/tomcat-9.0-doc/index.html > > >> There is a lot more information that could be presented there. Patches >> welcome. >> >> A Tomcat committer will review any patch before applying it. >> >> > 2) (probably better to ask the dev list?) I noticed there are some >> > differences in the official binary distribution vs development >> environment: >> > a) Official has annotations-api.jar while development has according >> to >> > gradle: >> > >> > default - Configuration for default artifacts. >> > +--- org.apache.tomcat.embed:tomcat-embed-core:9.0.+ -> 9.0.21 >> > | \--- org.apache.tomcat:tomcat-annotations-api:9.0.21 >> > >> > while the jar file names are different, the classes' name and the jar's >> > manifest within appear to the same. I think this is trivial. >> >> Whenever you wonder why a line of code is they way it is, running git >> blame on the file is usually informative.In this case it will lead you to: >> >> https://github.com/apache/tomcat/commit/1386eaac4d07b6bbae69b3981fe1f873a56b7cae >> >> >> > b) ecj version differences: the official binary uses ecj-4.10.jar >> > while the development, per gradle, uses ecj-3.16: >> >> It is the same version. The difference is due to where the JARs are >> obtained from. The Tomcat build script gets it from The Eclipse IDE 4.10 >> downloads - hence the version used. The pom.xml go directly to Maven >> Central which uses the internal version number 3.16. If you look in the >> manifests you'll see the internal version info is the same. >> >> Mark >> >> > Thank you for the clarification regarding the version differences. > > Thanks again, > Tommy >