NetBeans Forums

 FAQFAQ   SearchSearch   MemberlistMemberlist   RegisterRegister   ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 
  

context.xml

 
Post new topic   Reply to topic    NetBeans Forums -> Java EE Users
View previous topic :: View next topic  
Author Message
Mandy



Joined: 02 Apr 2012
Posts: 1

PostPosted: Mon Apr 02, 2012 8:19 am    Post subject: context.xml Reply with quote

Hi,

I'm a newbie to servlet-programming and created a little servlet.
It works fine on my developement machine.

The deployment seems to be correctly, but I cant access my config.xml

the context.xml (is in 'Configuration files' and 'Web pages -> META-INF' in netbeans):
Code:
<?xml version="1.0" encoding="UTF-8" ?>
<Context path="/guid">
    <Environment name="webappconfigdir" value="E:\config\Dokuserver" type="java.lang.String" override="false" />
</Context>


the code to access them:
Code:
  public void init() throws ServletException {
        try {
       
            Context context = (Context)new InitialContext().lookup("java:comp/env");
            webappConfigdir = (String)context.lookup("webappconfigdir");
           
            DOMConfigurator.configure(webappConfigdir + "\\log4j.xml");
         
            cfg = new Configuration(webappConfigdir + "\\config.xml");

        } catch (Throwable t) {
            Logger.getLogger(guid.class.getName()).error("Fehler beim Initialisieren", t );
        }


I also expected to find the context.xml in tomcats catalina/localhost directory, but its in the /meta-inf

1. How can I put the context.xml in the catalina/localhost at deployment, like on the development environment?

2. What I'm doing wrong at my query from the webappConfigdir?

Thanks,
Mandy
Back to top
Display posts from previous:   
Post new topic   Reply to topic    NetBeans Forums -> Java EE Users All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You can attach files in this forum
You can download files in this forum


Powered by phpBB
By use of this website, you agree to the NetBeans Policies and Terms of Use. © 2012, Oracle Corporation and/or its affiliates. Sponsored by Oracle logo