7 Replies Latest reply on Jun 24, 2008 7:07 PM by 666705

    Custom context.xml using Workshop Studio 10.2

      After upgrading from Workshop studio 3.3 to 10.1 (and also 10.2) we've found problems with our web apps that used a context.xml in the WebContent/META-INF directory.

      In 3.3, the contents of context.xml was merged into the server.xml when running within Workshop. This stopped working in 10.1, and we successfully used the workaround we found in the dev2dev forums where you copy the contents of context.xml into devloader_context.xml and write-protect that file.

      I was hoping this issue would be resolved in 10.2, but that doesn't seem to be the case. In fact, devloader_context.xml didn't wasn't automatically created by Workshop. We now have to manually create devloader_context.xml with the same contents as context.xml, then write-protect it. Will this issue be fixed soon? Or is there something we're doing wrong to still be experiencing this issue?


        • 1. Re: Custom context.xml using Workshop Studio 10.2
          Hi Kevin,

          The devloader_context.xml is in fact created within WebContent/META-INF folder, even in Workshop 10.2 release, provided the project has external dependency.

          Please check if the project configuration contains external dependency.

          - Project > Properties - Java build path

          On the "Source Tab", does the "Default output folder:" point to a directory other than "Project/WebContent/WEB-INF/classes"?

          On the "Libraries Tab", is there a reference to any external jars (apart from the ones in WEB-INF/lib folder)?

          What version of Tomcat server are you working with?
          • 2. Re: Custom context.xml using Workshop Studio 10.2
            Thanks for the reply.

            The Default output folder does point to the "Project/WebContent/WEB-INF/classes" folder.

            On the libraries tab, in addition to the Web App Libraries (from WEB-INF/lib), it also references the J2EE library (j2ee-1.4.jar) and JRE Library (jdk150_11).

            We are running this with Tomcat 5.0.19.
            • 3. Re: Custom context.xml using Workshop Studio 10.2
              The J2EE & JRE Library are not required at the runtime, meaning the server runtime will resolve with it's local copy.

              There are no external references in your project for the devloader_context.xml to be created.

              What exactly are you trying to resolve by using devloader_context.xml?
              • 4. Re: Custom context.xml using Workshop Studio 10.2
                We create our DB DataSources in server.xml. Those are then linked to the context via <ResourceLink> entries in context.xml. However without using devloader_context.xml, Workshop ignores our context.xml and doesn't merge it into server.xml. Therefore when the server runs, we get a JNDI exception saying that "jdbc is not bound in this context." Creating those entries in devloader_context.xml is the only way we've been able to get our DataSources to be used in our web app.
                • 5. Re: Custom context.xml using Workshop Studio 10.2
                  The best option would be to continue using the workaround (as earlier), manually create devloader_context.xml and mark it readonly.

                  FYI: Workshop tomcat server adapter is built on top WTP , and it is the WTP framework that merges the context.xml into server.xml. Since you don't have any dependency (library) Workshop removes the devloader_context.xml file within META-INF.
                  • 6. Re: Custom context.xml using Workshop Studio 10.2
                    Good to know. The workaround works for us, but I wanted to see if there was a better way. Thanks for the help.
                    • 7. Re: Custom context.xml using Workshop Studio 10.2
                      I wrote a comment on http://forums.bea.com/thread.jspa?threadID=400000992&#msg5700005125

                      I bring the same comment here, I hope it saves some time for you.

                      use BEA WorkSpace Studio version 1.1 with tomcat.
                      My project use to work fine and datasource used to being copied properly to .metadata\.plugins\org.eclipse.wst.server.core\tmp0

                      but one of my colleague had some issue so he checked in devLoader_context.xml to cvs which made my local version stop working. In this case Servers\Tomcat v5.5 @ localhost-config\Server.xml become different from the one in tmp directory.
                      Servers\Tomcat v5.5 @ localhost-config\Server.xml has my database resource but the one in tmp file always get overwritten with empty context.
                      Finally I deleted devLoader_context.xml and it started to work fine.
                      I didn't spend more time to find out technical reason since I already spent a lot of time on this, but I think devLoader_context.xml
                      context.xml have the same behavior with devLoader_context.xml higher priority to get overwritten.
                      marking file as read only does not work as well.

                      So I prefered to declare my resource just inside the server.xml