tomcat

What is the easiest way to start tomcat in embedded mode from the cargo-maven2-plugin?

I have defined tomcat:catalina:5.5.23 as a dependency to the cargo plugin, however I still get the following exception: java.lang.ClassNotFoundException: org.apache.catalina.Connector at java.net.URLClassLoader$1.run(URLClassLoader.java:200) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findCla...

How do I prepend <%= request.getContextPath() %> to all relative URLs inside a jsp page?

The subject says it all, almost. How do I automatically fix jsp pages so that relative URLs are mapped to the context path instead of the server root? That is, given for example <link rel="stylesheet" type="text/css" href="/css/style.css" /> how do I set-up things in a way that maps the css to my-server/my-context/css/style.css instea...

Is there a way to run a method/class only on tomcat startup?

I have a need to remove temp files on tomcat startup, the pass to a folder which contains temp files is in applicationContext.xml Is there a way to run a method/class only on tomcat startup? ...

Tomcat 6: how to delete temporary files after a web method call has ended?

I have a temporary file with data that's returned as part of a SOAP response via a MTOM binary attachment. I would like to trash it as soon as the method call "ends" (i.e., finishes transferring). What's the best way for me to do this? The best way I can figure out how to do this is to delete them when the session is destroyed, but I'...

How do I force a tomcat web application reload the trust store after I update it

I have the following problem. My tomcat 5.5 based web application is using a trust store to verify SSL connections. The application allows the user to add or remove CA certificates to be used in the verification process. However, adding or removing certificates from the trust store doesn't change a thing. The application 'recognizes' onl...

How to merge jsp pre-compiled web.xml fragment with main web.xml using Ant

We have the usual web.xml for our web application which includes some jsp and jsp tag files. I want to switch to using pre-compiled jsp's. I have the pre-compilation happening in the build ok, and it generates the web.xml fragment and now I want to merge the fragment into the main web.xml. Is there an include type directive for web.xm...

web.xml and relative paths

in web.xml i set my welcome file to a jsp within web.xml <welcome-file>WEB-INF/index.jsp</welcome-file> inside index.jsp i then forward on to a servlet <% response.sendRedirect(response.encodeRedirectURL("myServlet/")); %> however the application tries to find the servlet at the following path applicationName/WEB-INF/myServlet ...

Can CLIENT-CERT auth-method be used with a JDBC realm within tomcat?

The JDBC realm specifies a table structure for authentication which contains the columns defined by the attributes userNameCol and userCredCol. These correspond to user and password which makes sense for FORM or BASIC auth-methods. They are interactive and require these two pieces from the client's user. What comes back from the cert...

Can I connect to SQL Server using Windows Authentication from Java EE webapp?

I am currently investigating how to make a connection to a SQL Server database from my Java EE web application using Windows Authentication instead of SQL Server authentication. I am running this app off of Tomcat 6.0, and am utilizing the Microsoft JDBC driver. My connection properties file looks as follows: dbDriver = com...

Extending Java Web Applications with plugins

I have this web application that has grown to an unmanageable mess. I want to split it into a common "framework" part (that still includes web stuff like pages and images) and several modules that add extra functionality and screens. I want this refactoring to also be useful as a plugin system for third-party extensions. All modules n...

Bad Gateway 502 error with Apache mod_proxy and Tomcat

We're running a web app on Tomcat 6 and Apache mod_proxy 2.2.3. Seeing a lot of 502 errors like this: Bad Gateway! The proxy server received an invalid response from an upstream server. The proxy server could not handle the request GET /the/page.do. Reason: Error reading from remote server If you think this is a ser...

Does tomcat 5.5 treat .jsp and .jspx files in the same way?

I'm working on a java web-application, trying to be xml-friendly and writing my jsp files using the jspx/xml syntax. It took me hours of dissecting examples and configuration files to find out that with tomcat 5.5 files using the new syntax should end in .jspx, or tomcat won't translate tag libraries and stuff. Both file extensions map ...

Configuring tomcat security manager in Eclipse

Working in Eclipse on a Dynamic Web Project (using Tomcat (v5.5) as the app server), is there some way I can configure things so Tomcat will start with security turned on (i.e. as if I ran catalina.sh start -security)? ...

Configuring Tomcat 6 to support Russian cp1251 encoding

I am migrating a struts application from Websphere to Tomcat 6 and my application has support for Russian language. In Websphere we use to pass the JVM param -Dclinet.encoding.override=cp1251 but when I tried this with tomcat by passing the JVM argument -DFile.encoding=cp1251, the system doesnt accept input (I an any text box like in sea...

Absolute path & Relative Path

What's the difference between absolute path & relative path when using any web server or tomcat? ...

How to add jars dynamically with jython embedded in Tomcat app?

I want to let the users of my app, which is in turn an app container (app contains subapps), add java jars to their jython path. I let the subapp managers write thir own extensions in jython, but some of the functionality they want to add needs additional jars. For example, if they want to check a svn repo, they need the svn access jars...

ClassDefNotFound first time I start Tomct from within Eclipse

I have a tomcat application which, the first time I start Tomcat after starting eclipse, I get a n odd NoClassDefFoundError. If I then stop and restart tomcat through eclipse, it works fine. I have single, double, and triple checked the classpath and everything seems fine. Anyone ever seen anythign like this before? relevant versions...

Catching exceptions with tomcat and a servlet

I have set-up tomcat to catch all my exceptions and pass them to a servlet with the following in web.xml. <servlet-mapping> <servlet-name>exception</servlet-name> <url-pattern>/exception</url-pattern> </servlet-mapping> <error-page> <exception-type>java.lang.Exception</exception-type> <location>/exception</location> </er...

Alternative Reverse Proxy Architecture Directions

Currently, I've got an expensive license for a reverse proxy server in an environment that is mostly Tomcat. I'm thinking of one or both of the following upgrades. Using Squid instead of the expensive licensed product. Using some Apache2 settings for caching. Right now, I'm vague on the details, but perhaps mod_proxy will work here? ...

Transferring files between web applications running in the same Tomcat Instance

I have two web applications running in the same Tomcat Instance. In one of these applications the user will have the ability to upload files such as images and pdf files. I would like the uploaded files to be available to the second application. Is there a best practice for such a scenario? Or just a pointer to a technology would be fi...