Hi Mark,
I'm sorry to bother you, do you need more information about that? (see
email below, my mistake about reply recipient)
Many Thanks,
Agharta
Il 18/02/21 13:09, aghart...@gmail.com ha scritto:
Hi,
FYI, tomcat 9.0.43 have this problem too.
Best Regards,
Agharta
Il 18/02/21 12:51, aghart...@gmail.com ha scritto:
Hi Mark,
Good questions, my mistake, sorry.
So:
jar file name is testannotation.jar
package is "aaa." (very simple)
Standard vanilla tomcat (.zip) downloaded from ASF site, no package
manager. Unzipped to my home directory.
org.apache.tomcat.util.scan.StandardJarScanner.level = FINE (enabled
inside tomcat/conf/logging.properties)
Result:
catalina.2021-02-18.log:18-Feb-2021 12:45:03.703 BUONO [main]
org.apache.tomcat.util.scan.StandardJarScanner.processURLs Scanning
JAR [file:/home/agharta/apache-tomcat-9.0.41/lib/testannotation.jar]
from classpath
catalina.2021-02-18.log:18-Feb-2021 12:45:06.178 BUONO
[http-nio-8082-exec-1]
org.apache.tomcat.util.scan.StandardJarScanner.processURLs Scanning
JAR [file:/home/agharta/apache-tomcat-9.0.41/lib/testannotation.jar]
from classpath
...no other messages involving testannotation.jar or TestServlet.....
Many thanks,
Agharta
Il 18/02/21 12:24, Mark Thomas ha scritto:
On 18/02/2021 10:46, aghart...@gmail.com wrote:
Hi all,
A question, I can't solve that....
Tested with Tomcat 9.0.41, java 8 x64, linux (Fedora 32).
I have a standard tomcat web.xml (3.0 or 3.1, no matter).
I have created an external simple servlet with @WebServlet annotation,
and packaged it to a jar file:
Name of the JAR file?
Package the Servlet has been placed in?
Standard Tomcat downloaded from the ASF or one provided by your package
manager?
Have you tried enabling debug logging for
org.apache.tomcat.util.scan.StandardJarScanner ?
Mark
@WebServlet(name = "TestServlet", urlPatterns = {"/TestServlet"},
loadOnStartup = 1)
public class TestServlet extends HttpServlet {
private static final Logger log =
Logger.getLogger(TestServlet.class.getName());
private static final long serialVersionUID = 1L;
@Override
public void init() throws ServletException {
log.setLevel(Level.ALL);
log.log(Level.WARNING, "TESTSERVLET INIT");
super.init();
}
@Override
public void destroy() {
}
@Override
protected void doGet(HttpServletRequest req, HttpServletResponse
resp) throws ServletException, IOException {
processRequest(req, resp);
}
protected void processRequest(HttpServletRequest request,
HttpServletResponse response)
throws ServletException, IOException {
response.setContentType("text/html;charset=UTF-8");
PrintWriter out = response.getWriter();
try {
out.println("<!DOCTYPE html>");
out.println("<html>");
out.println("<head>");
out.println("<title>Servlet TestServlet</title>");
out.println("</head>");
out.println("<body>");
out.println("<h1>Servlet TestServlet at " +
request.getContextPath() + "</h1>");
out.println("</body>");
out.println("</html>");
} finally {
out.close();
}
}
}
So, if I copy the .jar file inside WEB-INF/lib folder of
destination war
project the log message will appears and the servlet is reachable.
But, if I copy the .jar file inside tomcat/lib folder the annotation
won't be processed.
FYI, in tomcat 7 both cases (inside WEB-INF/lib and tomcat/lib)
works well.
I searched on breaking changes between tomcat 7 and 8/8.5/9 but nope.
Seems related to jarscanner.....but no luck!
Because my servlet is in common to all projects I want to put it
inside
tomcat/lib folder and share it to all my projects
Somebody can help me?
Many thanks,
Agharta
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org