Skip to main content

Directory Listing - A Simple WebLogic Application

In this article I will show how to create a simple WebLogic application that lets you navigate directories and files on a server. This can be one of the handiest utilities. I use it all the time to give developers access to logs in test and pre-production environments.


But first, a warning... Be careful what files you make available to others. Some files, especially within a WebLogic domain directory, contain information that MUST be kept secret if the domain is to remain secure. NEVER provide read-access to all files in a WebLogic domain directory.

Like any WebLogic application, you must create a WAR file with the following components inside:
  • WEB-INF (directory)
  • WEB-INF\web.xml
  • WEB-INF\weblogic.xml
The first step is to create a new directory called 'WEB-INF'.

The web.xml descriptor

Inside the WEB-INF directory, create a new file called web.xml, and paste the following XML code:


<!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN" "http://java.sun.com/dtd/web-app_2_3.dtd">
<web-app>
</web-app>


I won't explain this XML code, but it is essentially an empty deployment descriptor.

The weblogic.xml descriptor

Create another file in the WEB-INF directory called weblogic.xml, and paste the following into it:


<!DOCTYPE weblogic-web-app PUBLIC "-//BEA Systems, Inc.//DTD Web Application 8.1//EN" "http://www.bea.com/servers/wls810/dtd/we
blogic810-web-jar.dtd">

<weblogic-web-app>

<container-descriptor>
<index-directory-enabled>true</index-directory-enabled>
</container-descriptor>

<virtual-directory-mapping>
<local-path>../../../logs/</local-path>
<url-pattern>*</url-pattern>
</virtual-directory-mapping>

<context-root>/getlogs</context-root>

</weblogic-web-app>


XML Elements Explained

<index-directory-enabled> If true, WebLogic will display a list of directories and files. Unfortunately, you cannot filter this list. WebLogic does not provide much in the way of directory/file listing functionality - either you list them or don't.

<local-path> The path component of a URL where you will find the application. For example, the XML code above will make the application accessible at http://localhost:7001/getlogs/

<url-pattern> Specifies the local directory that will be displayed when a user navigates to the context-root.

<context-root> A pattern that URLs must match in order for them to be mapped to the local directory.

Sample Applications (update)

The sample apps from this article can be downloaded here. These sample applications are NOT SAFE for a production environment as they could potentially expose sensitive information.

Deployment Notes:
  • For WebLogic 8.1 or older, when deploying you must select "Copy this Web Application module onto every target for me".
  • For WebLogic 9 or newer, deploy with default options.

Comments

  1. Thanks, do you have like a sample war file which you can send me at ravi_tiwari_786@yahoo.com, i really need this kind of features for the dvelopers and the testing team.

    ReplyDelete
    Replies
    1. Directory Listing - A Simple Weblogic Application >>>>> Download Now

      >>>>> Download Full

      Directory Listing - A Simple Weblogic Application >>>>> Download LINK

      >>>>> Download Now

      Directory Listing - A Simple Weblogic Application >>>>> Download Full

      >>>>> Download LINK GA

      Delete
  2. Hi Ravi, the sample war files are now available from the links above.

    ReplyDelete
  3. It worked. I made the WAR file with WinRAR as a Zip, and just changed the extension to WAR. I had to deploy the application (Prepared), then start the deployment (Active). Thank you.

    ReplyDelete
  4. hello, I was looking for your sample war file and the link was not working at all. Will you be kind enough to send the sample war file to me chua.mykel@gmail.com

    Thanks.

    ReplyDelete
  5. Hello, I would like to do the same; publish log files to developers. My issue is, that the directory listing shows the files, but if I want to download files, which are not small, they are getting truncated.
    Is there a configuration, which has to be changed. Interesting is also, that the size seems to be different between broswers.

    Thanks

    ReplyDelete
  6. after deployment...i got 403 requesting getlogs. why?

    ReplyDelete
  7. hello, I was looking for your sample war file and the link was not working at all. Will you be kind enough to send the sample war file to me yu.randy@gmail.com

    Thanks.

    ReplyDelete
  8. hello, I was looking for your sample war file and the link was not working at all. Will you be kind enough to send the sample war file to me fongtsz@gmail.com

    ReplyDelete
  9. hello, I was as well looking for your sample war file and the link was not working, will you be so kind enough to send me the sample war file @ gmail addess srinivas.bnglr@gmail.com

    ReplyDelete
  10. Nice post, I have used the same approach to retrieve logs from a remote WLS, a war file can be retrieved from:
    https://github.com/devwebcl/wls_contraption

    ReplyDelete
  11. Thanks for the article. Its pretty simple

    Sample download link doesn't works. Anyways easy to create the 2 xml files.

    ReplyDelete
  12. Is there any way to change the file date modified format? for my it is listing as DD-MM-YYYY, but wanted to change to YYYY-MM-DD?

    ReplyDelete
  13. Directory Listing - A Simple Weblogic Application >>>>> Download Now

    >>>>> Download Full

    Directory Listing - A Simple Weblogic Application >>>>> Download LINK

    >>>>> Download Now

    Directory Listing - A Simple Weblogic Application >>>>> Download Full

    >>>>> Download LINK C9

    ReplyDelete
  14. Dengan memahami secara mendalam cara kerja website directory listing, bisnis online dapat mengoptimalkan manfaat dari strategi ini. Submisi informasi yang akurat, kategorisasi yang tepat, verifikasi data, optimasi kata kunci, dan pemberian backlink menjadi tahapan kunci dalam proses ini.

    Keunggulan Website Directory Listing menjadi lebih penting daripada sebelumnya. Dengan meningkatkan relevansi, otoritas SEO, dan citra bisnis Anda, praktik ini membuka pintu untuk kesempatan dan pertumbuhan yang signifikan.

    Penting untuk memahami dan memanfaatkan dengan baik fungsi website directory listing online agar dapat membangun fondasi yang kuat dan berkelanjutan untuk pertumbuhan bisnis online Anda. Dengan strategi ini, bisnis Anda dapat bersaing secara efektif dalam pasar digital yang terus berkembang.

    ReplyDelete

Post a Comment

Popular posts from this blog

NullPointerException

java.lang.NullPointerException NullPointerException is described in the javadoc comments as: Thrown when an application attempts to use null in a case where an object is required. These include: Calling the instance method of a null object. Accessing or modifying the field of a null object. Taking the length of null as if it were an array. Accessing or modifying the slots of null as if it were an array. Throwing null as if it were a Throwable value. Applications should throw instances of this class to indicate other illegal uses of the null object. author: unascribed version: 1.19, 12/19/03 since: JDK1.0 Where is this exception thrown? Following, is a list of exception messages cross-referenced to the source code responsible for throwing them. Click on the method link to view the code and see how the exception is thrown. The message ' java.lang.NullPointerException: ' is thrown within the method: com.sun.corba.se.impl.interceptors.ClientRequestInfoImpl.get_r

Connection refused: No available router to destination

This is a simple symptom-cause-solution blog entry only. I hope these blogs will help fellow administrators. Symptom The following exception occurs in WebLogic server logs. Most likely to occur during WebLogic server start-up, but similar exceptions may occur at other times. java.net.ConnectException: t3://myserver:8000: Destination unreachable; nested exception is: java.net.ConnectException: Connection refused: connect; No available router to destination] at weblogic.jndi.internal.ExceptionTranslator.toNamingException(ExceptionTranslator.java:49) at weblogic.jndi.WLInitialContextFactoryDelegate.toNamingException(WLInitialContextFactoryDelegate.java:773) at weblogic.jndi.WLInitialContextFactoryDelegate.getInitialContext(WLInitialContextFactoryDelegate.java:363) at weblogic.jndi.Environment.getContext(Environment.java:307) at weblogic.jndi.Environment.getContext(Environment.java:277) Cause This message (Connection refused: connect; No available

SocketException

java.net.SocketException SocketException is described in the javadoc comments as: Thrown to indicate that there is an error in the underlying protocol, such as a TCP error. author: Jonathan Payne version: 1.17, 12/19/03 since: JDK1.0 Where is this exception thrown? Following, is a list of exception messages cross-referenced to the source code responsible for throwing them. Click on the method link to view the code and see how the exception is thrown. The message ' java.net.SocketException: ... ' is thrown within the method: java.net.ServerSocket.createImpl() The message ' java.net.SocketException: ... ' is thrown within the method: java.net.Socket.createImpl(boolean) The message ' java.net.SocketException: ... ' is thrown within the method: java.net.SocksSocketImpl.connect(SocketAddress, int) The message ' java.net.SocketException: ... ' is thrown within the method: java.net.SocksSocketImpl.socksBind(InetSocketAddress) The message