tomcat

tomcat connection pooling

Hi, I have a simple servlet running in Tomcat. Because the servlet connects to a database, I need to use connection pooling. However, all the examples on the internet assume that (the developer) will never change which database the servlet is connecting to. For example, here is a sample context.xml file. <?xml version="1.0" encoding="U...

ICEFaces Session Auto-Extension

I have an application in which users frequently leave the page running in their browser all day. The page has an intervalrendered that updates data every 30 seconds. However, if the user doesn't interact with the page for a while, it still expires. I'd like it to auto-extend for as long as the browser is open and making the scheduled r...

How to hide datasource passwords in in Tomcat JMX Beans

Hi, Tomcat exposes a good wealth of information about its internals via JMX. You can see data source, connector usage, thread pools, you name it. However, it also exposes the password of the JDBC datasource (Catalina->DataSource->javax.sql.DataSource->...). Is there any way to hide this information from being published ? We've found ...

Cannot connect to Tomcat's MBeanServer via jconsole in J2SE6

I'm on a vista machine. I've started tomcat 5.5.27 with these options: CATALINA_OPTS="-Dcom.sun.management.jmxremote.port=9003 \ -Dcom.sun.management.jmxremote.ssl=false \ -Dcom.sun.management.jmxremote.authenticate=false" When I connect via jconsole and added the following service url service:jmx:rmi:///jndi/rmi://localhost:...

Tomcat: what is the init context params to use for making an external client connection to Tomcat 5.5 JNDI tree?

Currently I am using this for JBoss, but I need something also for an external Tomcat: Properties props = new Properties(); props.put(Context.PROVIDER_URL, "jnp://localhost:1099"); props.put(Context.INITIAL_CONTEXT_FACTORY, "org.jnp.interfaces.NamingContextFactory"); props.put(Context.URL_PKG_PREFIXES, "org.jboss.naming.client"); props....

What is the benefit (if any) of using APR with Tomcat?

Tomcat has an option to use APR for handling connections. What are the benefits of using that? Does anyone have firsthand experience with it? ...

Switching from Tomcat to Glassfish

In response to this error where pages are delivered incorrectly, we're considering a switch from Apache + Tomcat to Glassfish. This is inspired not by features, but by frustration with a fault that just won't go away. The questions are: Should we use Glassfish in cooperation with Apache, or replace Apache entirely? The interface betwe...

Silent authentication with Tomcat and Active Directory

Hi! I need to do that with tomcat and a J2EE Web App. I don't want a pop up window asking the user for credentials. I must use the user logged on Windows to authenticate him on my web app. How can I do it? Thanks! ...

Where is the "work" directory located for a Tomcat instance running in Eclipse?

In Eclipse you can configure numerous servers to run inside the IDE, including Tomcat. Depending on your Tomcat configuration, at some point in the life cycle of a webapp your JSP files will get compiled into servlets. These new servlet .class files are stored in the %TOMCAT_HOME%/work directory along with the .java intermediate file cre...

What is the best Java-way to create JSON/XML REST Web services that is similar to WCF?

I'm looking for a best way that is available for Java developers to implement REST services that will be communicating via JSON or XML. I'm looking for production-ready products. I know that Spring 3.0 is coming, but it's not done yet - no luck. Is Jersey the one? My application is hosted by Tomcat, uses Spring, Jettison and XStream....

Simplest way to back Tomcat with an Apache HTTP instance

I have a single Tomcat 6 instance that frequently needs to be rebooted because of PermGen issues after multiple WAR deployments. In a Production environment it's clearly bad practice to take down the site, leaving any visitors with nothing but a connection failure. The big picture is to set up a fail-over Tomcat cluster of one or two mo...

Jersey in Tomcat+Spring environment can't find ComponentProvider. Why?

I've deployed Jersey on Tomcat and everything works perfectly (when I use the com.sun.jersey.spi.container.servlet.ServletContainer), but as soon as I change it to the com.sun.jersey.spi.spring.container.servlet.SpringServlet (according to all the tutorials I can find), I get a nasty exception: Apr 19, 2009 5:07:35 PM org.apache.catalin...

How to programmatically adjust the disable directive in the mod_jk load balancer configuration?

We have a setup where we have one httpd (apache) with mod_jk talking in a load balance setup to three tomcat servers. We have to recycle each tomcat instance envery three hours. So tomcat1 will restart at 1, and tomcat2 at 2 and ... until tomcat1 recycles again at 4. We want to configure a script or a type of program to disable the ...

Embeddable Java HTTP Servers

There seems to be multiple extremes when supporting embeddable Java HTTP servers. I have seen minimalist approaches such as NanoHTTPD and leveraging the com.sun.net.httpserver package to attempting to embed Jetty and Tomcat. The ideal embeddable HTTP server would be implemented such that it could be launched via Executor and come with Se...

Random Session Invalidation

I am running a J2EE web application in Tomcat, and recently I have been tasked with adding metrics to the application. I am using a SessionListener to detect when the session is destroyed, and then uploading the metrics to a database. My Session timeout is set in my web.xml to 30 minutes, and I am not invalidating the session anywhere ...

Why is Tomcat manager redirecting to localhost:8080/company/www.company.org/index.html

I have loaded a static (no servlets, jsp etc) website into the webapps folder of Tomcat. I have an index.html file under webapps/ourcompany so when I click the ourcompany link in the tomcat manager I am expecting to be taken to the ourcompany/index.html page. However Tomcat keeps redirecting me to localhost:8080/ourcompany/www.ourcompan...

Using Spring + Hibernate Transactional cache in Tomcat?

It seems that Hibernate transactional cache mode requires the use of a JTA transaction manager. In an app server such as Glassfish, Weblogic, etc, Spring can use the JTA transaction manager. Tomcat does not have a JTA transaction manager. Is there one that people use in this scenario? Or do people just not use transactional cache mod...

How do I create a new HttpSession in a RESTful webapp ?

I have a need to create a HttpSession (via cookie) whenever a client invokes a particular UI. Assumptions: Let's assuming that I'm not going to worry about any deep oAuth-like authentication dance. JESSIONSID cookie impersonation is not an issue for now. The server is tomcat, thus a JSESSIONID cookie is sent down to the client if a n...

Tomcat consuming high CPU

Tomcat.exe is consuming 75% of CPU. Is anyone having any idea why it happens and how can that be decreased? I am using Tomcat5.5 & J2SDK v 1.4.2_12 ...

Eliminating Javac warnings for JSPs in Jasper generated Java source files?

When pre-compiling JSPs with the Jasper compiler (using Tomcat), and then the Java compiler I see javac warnings like this (I have javac's -Xlint flag enabled): warning: [unchecked] unchecked call to add(E) as a member of the raw type java.util.List _jspx_dependants.add("/some-jsp.jspf"); Now, it's "just a warning," but I like clean b...