krithika_v
I'm new here

How to bundle META-INF and context.xml inside Firstspirit application war file to deploy in Tomcat server?

Hello,

We are moving out Firstspirit Application from IBM Websphere 6.0 to Tomcat 6.0.32 App server.

We have a problem in deploying the war file in Tomcat because Tomcat expects context.xml file inside the META-INF folder.

However for websphere, we have the xmls under WEB-INF.

Is there any way to bundle the META-INF and all the web components xml files inside the war file itself, so that it can be deployed directly on Tomcat server?

Thank you in advance.

Regards,

Krithika

0 Kudos
12 Replies

Hello Krithika,

instead of using the save() method on the FileHandle, did you already try to write the configurationString to the outputstream from the FileHandle? I used to do that in my modules and that works like expected.

best regards

Joerg

0 Kudos

Hello Joerg,

No i have not tried it..

But i added the below line now and tried ..still not working.. AM i doing something wrong?

configurationFile.getOutputStream().write(configurationString.getBytes("UTF-8"));

Could you please send me your code snippet to write the configurationstring to the outputstream with FileHandle?

It would be very helpful.

Thank You,

Rgds,

Krithika

0 Kudos

Hello Krithika,

I use the code below:

public void store() {

      OutputStream os = null;

      InputStream is = null;

       _config.setProperty(VARNAME, _valueTextField.getText());

      try {

          _configFile = _env.getConfDir().obtain(CONFIG_FILE);

          os = _configFile.getOutputStream();

          is = org.apache.commons.io.IOUtils.toInputStream(_config.getProperty(VARNAME));

          org.apache.commons.io.IOUtils.copy(is, os);

          } catch (IOException e) {

                    Logging.logError("Couldn't open config file: " + _configFile.getPath(), e, LOGGER);

          } finally {

                    try {

                              if (os != null) {

                                        os.close();

                              }

                              if (is != null) {

                                        is.close();

                              }

                    } catch (IOException e) {

                              Logging.logError("Closing of config file output stream failed.", e, LOGGER);

                    }

          }

}

Best regards

Joerg

0 Kudos