4

I setup a mapping to my images directory in Weblogic.xml by using the virtual-directory-mapping tag. How can I read the value of the real path so that my application can access that virtual directory for write access?

JMX seems to be of no help here since the WebServerMBean (or any other MBean) doesn't seem to provide access to the virtual-directory-mapping property.

Java Servlet API also has not yielded result since calling getRealPath() is only appending the url-pattern to the deployment directory of the application and not giving the correct path.

<virtual-directory-mapping>
    <local-path>/home/wlsadm/images</local-path>
    <url-pattern>help/specimens/*</url-pattern>
    <url-pattern>*.xml</url-pattern>
</virtual-directory-mapping>
Seeta Somagani
  • 776
  • 1
  • 11
  • 31
  • Maybe this page could be some kind of help http://cdivilly.wordpress.com/2012/06/21/serving-static-content-on-weblogic-and-glassfish/ – SubOptimal Oct 27 '14 at 11:29
  • can you show the virtual-directory-mapping fragment from your weblogic.xml? – Steve Siebert Nov 05 '14 at 00:32
  • For starters, using Weblogic for stuff like this essentially ties you to an application server vendor; is this really what you want? Imho you'd better get rid of this particular dependency and rely on a well-known path on your filesystem – fge Nov 05 '14 at 09:09
  • @fge - Unfortunately, I'm limited by the client's setup and they are fine with this solution (that includes reading and writing images to Database as well) as opposed to using a separate hosting for images. I am not able to come to accept the conjecture that this could be an oversight in Weblogic. – Seeta Somagani Nov 05 '14 at 16:04
  • I believe [virtual directories just replace the docroot](https://community.oracle.com/thread/793995?start=0&tstart=0). – Elliott Frisch Nov 06 '14 at 20:43

1 Answers1

0

I've done a fair amount of research on this, reading vendor documentation, reading blogs, forums, etc. As the OP indicated, JMX use to be an approach to get this information, but this is no longer an option in current Weblogic versions.

The only solution I think you're left with is to create a utility that reads the information from the weblogic.xml file on the classpath. Something like an application listener that reads it on application startup and makes it available as a servlet attribute, etc.

Would love to hear how you solved it, though.

Steve Siebert
  • 1,874
  • 12
  • 18