Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[jetty-users] reading property file from servlet context file

hi all,

I am a new user in jetty and i moved my existing web application from tomcat to jetty.
this is the structure:
- myWebapp/
  - src/
    - main/
      - java/ (java source files)
      - webapp/
        - index.html
        - WEB-INF/
          - web.xml
          - etc/
            - config.xml   

in the pom file i specified everything in order to run the jetty plugin (which works). 
After deploying i get the following structure
- myWebapp/
  - src/
  - target/
    - <my>SNAPSHOT/ 
      - index.html
      - WEB-INF
        - web.xml
        - lib/
        - classes/ 
        - etc/
          - config.xml 


The html page is visible, but I have problem when reading 
the configuration file.
I access from my servlet class to the path via: 
getServletContext().getRealPath(".");
which returns as String: 
<absolutePath>/myWebapp/target/tmp/webinf
and this is not equal to my desired path
<absolutePath>/myWebapp/target/<my>SNAPSHOT/ 
But this is not the path, in which my configuration file is stored?

I just see in <absolutePath>/myWebapp/target/war/work/webapp-cache.xml
in which the property <string>WEB-INF/etc/config.xml</string> occurs.

Any idea what I am doing wrong or should i access to the config file in a different way?

may thanks

Markus


This is the relevant part of my pom:

<plugin>
 <groupId>org.mortbay.jetty</groupId>
 <artifactId>jetty-maven-plugin</artifactId>
 <version>7.1.5.v20100705</version>
 <configuration>
  <scanIntervalSeconds>10</scanIntervalSeconds>
  <webAppConfig>
   <contextPath>/myContext</contextPath>
  </webAppConfig>
 </configuration>
</plugin>




Now i have problems in reading my configuration file.




Back to the top