afaik META-INF is not for storing parts of your application, the only thing I keep there is persistence.xml, and MANIFEST.MF is generated by the war packer I think...
you can get the path for a file
config.xmlin WEB-INF like this:
ServletContext ctx = ServletLifecycle.getServletContext(); String path = ctx.getRealPath("WEB-INF/config.xml");
let me know if
/in the path works on windows though, maybe you have to use java.io.File.pathSeparator
Is there no other way of doing so?
As when I did as suggested I got the following compile time error.
package javax.servlet does not exist
I searched this on net. Tried all the solutions but I am not able to get away with this error.
I am using Netbeans 6.5, jboss 4.2.0 GA, seam etc. I could not find servlet.jar in anywhere on my machine. So,I put the servlet-api.jar in classpath but could not proceed.
I found servlet-api.jar in jboss-4.2.0.GA\server\default\lib directory. I even put servlet-api.jar in WEB-INF\lib and included it in classpath but still could not get this error removed.
Please let me know is there any other way or I have to try on this only?
if package javax.servlet does not exist your applications should not even run, javax.servlet is a core requirement for any web based java application (with or without Seam)
Are you sure you correctly created a web project in netbeans?
I imported an existing project and the project which I imported is 'Web Free-Form Application'
And since the project already contains the build folder so I am not able to create a 'Web Application with existing resources'.
When I access the application using 'http:////localhost:8080//' I am able to access its pages.
So please let me know where is the mistake. Does for 'Web Free-Form Application' it is not supposed to work?
What IDE was used to create that
existing project? Or is it compiled using a custom ant file?
Netbeans was used to create that existing project. It has an custom ant file which is used to build that project.
Does that matter?
If you are using jbosstools, try creating a blank seam project and run it to test your environment. You should then import the classes and views from the other project.
When I have config files I need to retrieve from code, I usually put them under
WEB-INF/classesand load them as classpath resources:
DocumentBuilderFactory docBuilderFactory = DocumentBuilderFactory.newInstance(); DocumentBuilder docBuilder = docBuilderFactory.newDocumentBuilder(); Document doc = docBuilder.parse(new File(this.getClass().getClassLoader(). getResourceAsStream("/Try.xml"));
This also works if you put the file in a subdir of
WEB-INF/classes(just specify its path relative to