File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes IDEs, Version Control and other tools and the fly likes getRemoteUser returns null Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » IDEs, Version Control and other tools
Bookmark "getRemoteUser returns null" Watch "getRemoteUser returns null" New topic

getRemoteUser returns null

Jan Piper

Joined: Jan 10, 2008
Posts: 13
I have 4 servlets sitting on a vm and all is well with them. I started rewriting an old servlet in Eclipse that I had started about 5 years ago using a different compiler and request.getRemoteUser() is returning null. I basically just started a new project and cut and pasted the old code into my Eclipse workspace, worked out the compile errors and tried to run it.

I don't think it is a server/tomcat security issue because the other servlets work fine.

Is there some setting in Eclipse that maybe I need to reset or something cryptic that would cause this?
Bear Bibeault
Author and ninkuma

Joined: Jan 10, 2002
Posts: 63862

As this is an Eclipse-only issue, it's been moved to the IDEs forum.

[Asking smart questions] [About Bear] [Books by Bear]
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 17417

getRemoteUser returns the user ID that the user logged in under. BUT only if that user was authenticated using the J2EE standard container security system.

If the webapp was not deployed in a J2EE security Realm, or if the webapp is using a non-standard security system, the webapp server will not process logins and will not capture and forward the user ID as part of the HttpServletRequest. In which case both getRemoteUser and getUserPrincipal will return null.

Most likely, if the other apps are working, there's an issue with this webapp's deployment context and specifically with its security realm configuration.

An IDE is no substitute for an Intelligent Developer.
Ulf Dittmer

Joined: Mar 22, 2005
Posts: 42965
Yes, I think it's unlikely that Eclipse has anything to do with this.
Jan Piper

Joined: Jan 10, 2008
Posts: 13
I'm confused. If I open another webapp on this server and log in, I can get in. If I open another, without closing the first one, I'm still logged in. When I open this one, I don't have to log in to get to the application, which is on a secure server, so it has to know who I am to open the page, yet it returns null for remote user.

Any ideas on where I can start looking?
I agree. Here's the link:
subject: getRemoteUser returns null
It's not a secret anymore!