Hello to All,
I am using JBoss Seam 2.2.2 with JBoss AS 5.1.0. I have deployed by WAR file under jboss default deploy folder.
I have created a listener which implements ServeletContextListener
package mypack; import javax.servlet.ServletContextEvent; import javax.servlet.ServletContextListener; public class ApplicationHandler implements ServletContextListener { public void contextDestroyed(ServletContextEvent arg0) { // TODO Auto-generated method stub } public void contextInitialized(ServletContextEvent sce) { String rootPath = sce.getServletContext().getRealPath("/"); System.out.println("##################" + rootPath); try { String contextPath = sce.getServletContext().getResource("/").getPath(); System.out.println("##################" + contextPath); } catch(Exception e ) { } } }
It gives me output as
12:19:33,597 INFO [STDOUT] ##################D:\jboss-5.1.0.GA\server\default\tmp\a001f-kuyy5t-gp523jzj-1-gp52etk8-9s\Sample.war\ 12:19:33,597 INFO [STDOUT] ##################/localhost/Sample/
Instead of what I want
D:\jboss-5.1.0.GA\server\default\deploy\Sample.war\
When I have created a simple web application (named : SampleTest) and deploy it to JBoss Server it gives me correct path what I want i.e.
D:\jboss-5.1.0.GA\server\default\deploy\SampleTest.war\
So, how can I get the path to my application???
Thanks in advance.