It is not a bug, ServletContext.getRealPath() never return a real path on
OSGI container.
For Equinox framework, use the following code fragment:
import org.eclipse.core.runtime. FileLocator;
...
ServletContext context = request.getSession().getServletContext();
URL url =
Thx for quick response. What is the equivalent to FileLocator in karaf?
--
View this message in context:
http://karaf.922171.n3.nabble.com/unable-to-getRealPath-for-servlet-context-tp4032109p4032114.html
Sent from the Karaf - User mailing list archive at Nabble.com.
try to find the corresponding
org.eclipse.equinox.common file from Maven repo.
-Original Message-
From: asookazian2 [mailto:asookaz...@gmail.com]
Sent: Thursday, March 06, 2014 12:58 PM
To: user@karaf.apache.org
Subject: RE: unable to getRealPath for servlet context
Thx for quick
So I tried the recommended approach in this thread and getting the following
now:
karaf@root() start 265
karaf@root() java.lang.NullPointerException
at
org.eclipse.core.internal.runtime.Activator.getURLConverter(Activator.java:313)
at
Sorry i replied before reading your reply a few mins ago.
I didn't change the karaf.framework to equinox but i basically added the
following dependency to my pom:
dependency
groupIdorg.mod4j.org.eclipse.equinox/groupId
artifactIdcommon/artifactId
OK so I made the change in config.properties to point as follows:
karaf.framework=equinox
saved, stopped, started karaf in debug mode
i've attached a debugger session in Eclipse and see now:
url = bundleentry://243.fwk42630947/
so that's not null any more.
now i get the following warning in
-Original Message-
From: asookazian2 [mailto:asookaz...@gmail.com]
Sent: Thursday, March 06, 2014 2:13 PM
To: user@karaf.apache.org
Subject: RE: unable to getRealPath for servlet context
OK so I made the change in config.properties to point as follows:
karaf.framework=equinox
saved, stopped
Hi,
as already stated this won't work for an OSGi Servlet Container.
All of the deployment together with those information are handled by Pax
Web.
Jetty is just the mere container to run the stuff.
To retrieve the actual ServletPath you will need to call request.
getServletPath()
But, this