jump to navigation

Follow up: The Solution December 13, 2007

Posted by Phill in Application Servers, General J2EE.
Tags: , , , , ,
comments closed

Quick follow up to my previous post. The problem was that there were multiple applications running on one domain – or at least, subdomains.

So, on http://www.domain.com, there was one application (= one JSESSIONID cookie).

Our application was running on subdomain.domain.com, using its own JSESSIONID cookie.

The problem came because the cookie being issued by http://www.domain.com was actually sending the cookie domain as ‘domain.com’ — unfortunately this means that all subdomains share the same cookie.

In Internet Explorer, if you browse to a website: subdomain.domain.com, it will send its own JSESSIONID cookie.. unfortunately, Internet Explorer will then (next request) send two JSESSIONID cookies back: one for domain.com, and one for subdomain.domain.com. This basically means that WebLogic gets confused, and generates a new session cookie… and so on.

So, to summarise, Internet Explorer was the cause of all our problems :p

The solution was to use the weblogic.xml deployment descriptor to change the cookie name:

<session-descriptor>
<session-param>
<param-name>CookieName</param-name>
<param-value>MYJSESSIONID</param-value>
</session-param>
</session-descriptor>

WebLogic – losing sessions December 11, 2007

Posted by Phill in Application Servers.
Tags: ,
comments closed

Has anyone had problems before with WebLogic (8.1) losing sessions?

One of our apps, running in a production environment, seems to be having problems which we can’t replicate. Some users just don’t seem to be able to keep a session, i.e. in the logs pretty much every request has a different session ID. This only happens for a small subset of users.

Any ideas?

Caching using WebLogic tags July 19, 2007

Posted by Phill in Application Servers, Presentation Layer.
Tags: , ,
comments closed

We’ve been having a random issue with JSP fragments recently: on one of our applications, the page layout components are divided into JSP fragments. Each JSP fragment pulls in the actual content from a page on our client’s server (so they can easily update it). It works like this:

The main page includes a component, say, leftnav.jsp: <jsp:include page="leftnav.jsp" />

leftnav.jsp looks a bit like this:

<wl:cache timeout="15m" async="true">
<io:http url="http://url/page.html" action="GET" />
</wl:cache>

The problem we’ve been having is that sometimes, the body content appears in the left-hand navigation bar, and the left-hand navigation gets displayed twice! I think we’ve basically narrowed it down to the caching. According to WebLogic’s documentation, the cache JSP tag by default uses the page URI as the cache key. If you have multiple cache elements in a page (which the leftnav.jsp does have) I think this could cause a problem.

What we have done so far is give each cache tag element a distinct name, and the problem hasn’t occured again … yet! It’s difficult to track down because it’s quite erratic.

Hopefully that will solve the problem — if not, I will have to update again soon 😉

Changing the Context Root in WebLogic July 5, 2007

Posted by Phill in Application Servers.
Tags: ,
comments closed

File this under “spent 10 minutes trying to figure this one out”:

I’ve just been trying to change the context root of a web application (WAR File) deployed on WebLogic 8.1. At first I thought it was in the weblogic.xml file (or some other deployment descriptor) – but no, this is a simple application, it doesn’t have one apart from web.xml.

Then I thought, “hmmm, perhaps it’s to do with the application name”. Again, no luck there either.

It turns out that it was to do with the name of the WAR file itself. If the application doesn’t specify a contxt root, it will be taken from the name of the WAR file (whatever you name the application). Which is annoying, because it means if you want to deploy the application under a different context root, you have to rename the WAR file.

Anyway, just for future reference I thought it was worth mentioning…

Update: after feedback in the comments section, it is also possible to change the context-root using the weblogic.xml file.

You can find the relevant documentation here (for WebLogic 9, I believe other versions of WL are similar).