[Geoserver-devel] Deploying on weblogic

Chris,

Has anyone ever deployed geoserver on weblogic 8.1? When i compile and deploy the jar i receive a null pointer exception. I looked at the code and found that the Request class has the following method:

File rootDir = new File(sc.getRealPath("/"));

where sc is the servlet context.

The specification for J2EE1.2 states that the following for the getRealPath() method:

The real path returned will be in a form appropriate to the computer and operating system on which the servlet container is running, including the proper path separators. This method returns null if the servlet container cannot translate the virtual path to a real path for any reason (such as when the content is being made available from a .war archive).
Since the .war file does not get exploded when deployed in weblogic (and i should not have to) i receive a null pointer exception. Later in the code the rootDir is checked by the ReaderUtils.checkFile method for existence throwing the null pointer. I think the appropriate method to use is getResource() or getResourceAsStream() but i am not sure

Ed

Has anyone ever deployed geoserver on weblogic 8.1?

Not to my knowledge. But it would be great if we could get it working on
it.

When i compile and
deploy the jar i receive a null pointer exception. I looked at the code
and found that the Request class has the following method:

File rootDir = new File(sc.getRealPath("/"));

where sc is the servlet context.

In the Request class? I see something similar:
public String getRootDir(){
    return httpServletRequest.getSession().getServletContext().getRealPath("/");
}

But looking at it a bit more closely, I don't think that method is ever
actually called - like if I comment it out and recompile I get no errors.

Oh wait, I think I found what you're talking about, in the GeoServerPlugIn
class, which is used to load everything.

The specification for J2EE1.2 states that the following for the
getRealPath() method:

The real path returned will be in a form appropriate to the computer
and operating system on which the servlet container is running,
including the proper path separators. This method returns null if the
servlet container cannot translate the virtual path to a real path for
any reason (such as when the content is being made available from a .war
archive).
Since the .war file does not get exploded when deployed in weblogic
(and i should not have to) i receive a null pointer exception. Later in
the code the rootDir is checked by the ReaderUtils.checkFile method for
existence throwing the null pointer. I think the appropriate method to
use is getResource() or getResourceAsStream() but i am not sure

Yeah, I think you may be right, about GeoServer making assumptions that
the war is expanded. I think you may be on the right path with the
getResource stuff. I don't have time to dig into this right now, and
indeed don't have a weblogic to test. Could you submit a bug report to
JIRA with the details? And if you come up with a fix, we can put it in -
just attach the patch to the issue. Though even if we get it reading I
think we may run into problems with saving updated geoserver configuration
stuff, since we also write to those files. This might need to wait for:
http://jira.codehaus.org/browse/GEOS-142

Though we may be able to work around it, since I imagine weblogic must be
able to write out war specific stuff somewhere, like a work directory, no?

best regards,

Chris