web.xml

Ignoring web.xml when loading a WAR file with Jetty

。_饼干妹妹 提交于 2019-12-24 08:30:37
问题 I'm trying a self-executable WAR package with Jetty. It configures with web.xml by default. If a run-time option is given, I wanted to override web.xml by Java code-level configuration with ServletContextHandler#addServlet, #addEventListener, and ... Can I ignore web.xml while loading a WAR package? % java -jar foobar.jar # Use web.xml % java -jar foobar.jar --customize=something # Use Java code to configure // Example WebAppContext webapp = new WebAppContext(); webapp.setWar(warLocation

Exclusive url-patterns in Tomcat web.xml descriptor

旧巷老猫 提交于 2019-12-24 07:26:14
问题 I am trying to redirect erroneous page requests - 404 errors - to a custom error page. In order for my servlet, instead of the root servlet, to handle these requests, I entered the following url-pattern: <url-pattern>/</url-pattern> Unfortunately, this also catches embedded requests for files like *.js, *.css, *.png, *.jpg, and other such files. Is there a way in the deployment descriptor to specify an exclusive pattern? Say, "everything EXCEPT requests with x extension"? Or is there another

Load log4j2.xml file outside project with enviroment variable

邮差的信 提交于 2019-12-24 05:48:43
问题 I am developing a java web-app (v3.0) for a TomCat 7.0 server and I am having troubles loading the log4j2.xm l file. I have defined the log4j2.xml file outside my project and defined the path for the file in my web.xml file. If i hardcode the path my log4j2.xml file loads as it should. <context-param> <param-name>log4jConfiguration</param-name> <param-value>file:///C:/my/path/log4j2.xml</param-value> </context-param> On the other hand I want to use an enviroment variable to define the path.

Why web.xml does not work when I do not use a global namespace?

浪尽此生 提交于 2019-12-24 05:15:46
问题 I have this very simple web.xml file: <?xml version="1.0" encoding="UTF-8" ?> <web-app xmlns="http://xmlns.jcp.org/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd" version="3.1"> <welcome-file-list> <welcome-file>testx.jsp</welcome-file> </welcome-file-list> </web-app> When I deploy the application and visit the context root, I will be taken to testx.jsp which is fine

implementing HttpSessionListener

老子叫甜甜 提交于 2019-12-24 03:27:56
问题 I am facing a similar problem and have learnt that my listener class will be instantiated when the web.xml is read. I have few functions in the listener class that are used by the main servlet's doPost(which interacts with the database(mysql) to read/write data regarding the users.)along with the methods of HttpSessionListener. So what prevents the container from loading the listener class. I am getting the 404 error. snippet: public class EntryServlet extends HttpServlet{ public void doPost

How to avoid redirecting to SSL port

蹲街弑〆低调 提交于 2019-12-24 01:52:35
问题 My Web.xml config in my SSL confugured web app(deployed on tomcat(8080 port)) is as follows <security-constraint> <web-resource-collection> <web-resource-name>HTTPSOnly</web-resource-name> <url-pattern>/*</url-pattern> </web-resource-collection> <user-data-constraint> <transport-guarantee>CONFIDENTIAL</transport-guarantee> </user-data-constraint> </security-constraint> When I tried https://google.com, I am getting the page When I tried http://google.com , it automatically redirects to https:/

How to avoid redirecting to SSL port

爱⌒轻易说出口 提交于 2019-12-24 01:52:03
问题 My Web.xml config in my SSL confugured web app(deployed on tomcat(8080 port)) is as follows <security-constraint> <web-resource-collection> <web-resource-name>HTTPSOnly</web-resource-name> <url-pattern>/*</url-pattern> </web-resource-collection> <user-data-constraint> <transport-guarantee>CONFIDENTIAL</transport-guarantee> </user-data-constraint> </security-constraint> When I tried https://google.com, I am getting the page When I tried http://google.com , it automatically redirects to https:/

I'm getting “org.apache.catalina.core.StandardContext startInternal SEVERE: Error listenerStart”. Some clues?

£可爱£侵袭症+ 提交于 2019-12-24 00:08:02
问题 I'm developing a kind of complex hello world-spring webapp (since it has just the minimum functionality: one controller and one view (made with thymeleaf), simple database connection (oracle) and simple email sending capabilities). Now I'm trying to deploy this webapp into tomcat-7 using my IDE (IntelliJ Idea 12.1.3 Ultimate) with not success at all while I'm obtaining from console: Artifact infoSynth:war exploded: Artifact is being deployed, please wait... org.apache.catalina.core

Error when migrating web.xml from Java EE 5 to Java EE 6

♀尐吖头ヾ 提交于 2019-12-23 20:52:58
问题 I am experiencing problems with my app since I migrated web.xml from Java-EE-5 to Java-EE-6. Here is the stacktrace I get when I deploy my app: 24 août 2011 14:10:45 org.apache.catalina.startup.HostConfig deployDescriptor GRAVE: Erreur lors du déploiement du descripteur de configuration ROOT.xml java.lang.IllegalAccessError: class javax.xml.parsers.SecuritySupport12 cannot access its superclass javax.xml.parsers.SecuritySupport at java.lang.ClassLoader.defineClass1(Native Method) at java.lang

Struts2 custom 404 error page never shows

泪湿孤枕 提交于 2019-12-23 20:26:23
问题 I'm using the struts2 framework for a webapp. While trying to create a custom 404 error page I discovered Struts2 is doing more work for me then intended. I only use a struts.xml and a web.xml file. In the web-xml file I added the following code: <error-page> <error-code>404</error-code> <location>/error/Error404.jsp</location> </error-page> Now, when I start my webapp it goes to the homepage as usual. When I try urls of this type (all urls that don't exist): http://localhost:8080/MyWebApp