Re: context battle?
Patrick, Thanks *SO MUCH* for the response. I tried your recomendation using Tomcat 5.5 and it worked as you stated in your inline post. I was pulling my hair out trying to replicate my success with JBuilder 2005. I finally figured it out: I followed your directions below with 1 exception. In JBuilder, the IDE ignores the tomcat config, as near as I can tell, and generates it's own server.xml file in the project directory called "server8080.xml". Server8080.xml creates the context for the webapp. For whatever reason, it ignores the META-INF/context.xml. So, by putting the in the server8080.xml and following the rest of the information in your inline post, I *FINALLY* am able to use a datasource from my classes and JSP's within JBuilder. This has had me stumped for a few days..It feels good to solve the problem. I know this isn't the BEST solution, but I can continue to develop my app. If someone has a better workaround for JBuilder, PLEASE SHARE! Here's my file info. I hope it helps someone else out. Thanks again! -Aaron * ** server8080.xml found in /jbprojects/myproject/Tomcat/conf/server8080.xml ** this is autogenerated by jbuilder. you can modify this so jbuilder doesnt over write it * autoDeploy="false" debug="0" deployXML="false" name="localhost" unpackWARs="false"> docBase="/Users/aaronhackney/jbproject/untitled5/WebModule1" path="/WebModule1" reloadable="true" workDir="/Users/aaronhackney/jbproject/untitled5/Tomcat/work/WebModule1"> password="mypassword" /> * ** web.xml found in /jbproject/untitled5/WebModule1/WEB-INF/web.xml * http://java.sun.com/xml/ns/j2ee"; xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"; xsi:schemaLo cation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"; version="2.4"> WebModule1 Resource reference to a factory for java.sql.Connection instances that may be used for talking to a particular database that is configured in the server.xml file. jdbc/helloworld javax.sql.DataSource Container Added by JBuilder to compile JSPs with debug info debugjsp org.apache.jasper.servlet.JspServlet classdebuginfo true 3 debugjsp *.jsp Patrick Thomas wrote: Damn, he found it. We try to hide those HOW-TOs really well. ;) Aaron, Yeah, that's the right place to look; sorry I didn't include that in the first reply, but I didn't want to muddy the waters if that wasn't your real issue. I'm inlining an email that I sent to the list a few months ago. It's not on the exact same issue, but the example may help you get some clarity. Good Luck, Patrick Forwarded Message From: P T <[EMAIL PROTECTED]> Reply-To: P T <[EMAIL PROTECTED]> To: Tomcat Users List Date: Apr 8, 2005 1:31 PM Subject: Re: Add Context Path, Tomcat 5.5.7 Scott, I feel your pain -- I just finished sorting out that whole thing myself. One thing I'd definitely recommend doing is installing the admin tool for tomcat 5 and using it to change something trivial in your server.xml file. When it gets done making the change it strips out all the comments as a side effect and makes the file *much* cleaner and, in my opinion, more readable. As for your question: if the resource is to be used for multiple applications, you could put it in the server.xml... if not (and I'm going to presume that's the case for you -- let me know if not) then you're much better off using your application-specific WEB-INF\web.xml and META-INF\context.xml files like so: \META-INF\context.xml would look something like: WEB-INF/web.xml META-INF/context.xml and your WEB-INF\web.xml would then reference the resource defined in the context above (the res-ref-name should match the resource name) http://java.sun.com/dtd/web-app_2_3.dtd";> Your app's name Slices, dices and makes fresh canned spam! Description of Datasource jdbc/aNameForYourDBresource javax.sql.DataSource Container It's helpful to think of the individual application context.xml files being 'included' as entries in the server.xml file (almost like an @include, except implicit). Hope that helps! Let me know if I can clarify anything. Cheers, Patrick Thomas (PS - remember to install the jakarta commons and pooling jars mentioned in the dbcp documentation.) On 5/31/05, Aaron Hackney <[EMAIL PROTECTED]> wrote: I think I may have actually found the answer to my own questiondoes this look like the right path to go down? http://jakarta.apache.org/tomcat/tomcat-5.0-doc/jndi-resources-howto.html ? Thanks -Aaron A
Re: context battle?
Damn, he found it. We try to hide those HOW-TOs really well. ;) Aaron, Yeah, that's the right place to look; sorry I didn't include that in the first reply, but I didn't want to muddy the waters if that wasn't your real issue. I'm inlining an email that I sent to the list a few months ago. It's not on the exact same issue, but the example may help you get some clarity. Good Luck, Patrick Forwarded Message From: P T <[EMAIL PROTECTED]> Reply-To: P T <[EMAIL PROTECTED]> To: Tomcat Users List Date: Apr 8, 2005 1:31 PM Subject: Re: Add Context Path, Tomcat 5.5.7 Scott, I feel your pain -- I just finished sorting out that whole thing myself. One thing I'd definitely recommend doing is installing the admin tool for tomcat 5 and using it to change something trivial in your server.xml file. When it gets done making the change it strips out all the comments as a side effect and makes the file *much* cleaner and, in my opinion, more readable. As for your question: if the resource is to be used for multiple applications, you could put it in the server.xml... if not (and I'm going to presume that's the case for you -- let me know if not) then you're much better off using your application-specific WEB-INF\web.xml and META-INF\context.xml files like so: \META-INF\context.xml would look something like: WEB-INF/web.xml META-INF/context.xml and your WEB-INF\web.xml would then reference the resource defined in the context above (the res-ref-name should match the resource name) http://java.sun.com/dtd/web-app_2_3.dtd";> Your app's name Slices, dices and makes fresh canned spam! Description of Datasource jdbc/aNameForYourDBresource javax.sql.DataSource Container It's helpful to think of the individual application context.xml files being 'included' as entries in the server.xml file (almost like an @include, except implicit). Hope that helps! Let me know if I can clarify anything. Cheers, Patrick Thomas (PS - remember to install the jakarta commons and pooling jars mentioned in the dbcp documentation.) On 5/31/05, Aaron Hackney <[EMAIL PROTECTED]> wrote: > I think I may have actually found the answer to my own questiondoes > this look like the right path to go down? > > http://jakarta.apache.org/tomcat/tomcat-5.0-doc/jndi-resources-howto.html > > ? > > Thanks > -Aaron > > Aaron Hackney wrote: > > > Thanks for the response Patrick. I'm probably going about this all wrong. > > > > Simply put, I'm just trying to make a datasource available to my > > application. Sounds sinple enough. I have found a lot of conflicting > > information out there on the implementation. > > > > I develop with JBuilder (good, bad or indifferent!) But > > anyhowwhere does one properly make a datasource for a tomcat > > application available? I'm using Tomcat 5.0 (I could use 5.5 if I had > > to). > > > > Thanks in advance. I'm a bit blind and stubling around here and really > > tried to research it on my own this weekend but to no avail. > > > > -Aaron > > > > Patrick Thomas wrote: > > > >>> and if a context with the same name is defined in a webapp WEB-INF/xml > >>> file which would "win" such a fight? I have a feeling my context > >>> defined > >>> in /localhost is being overwritten by the app. (I'm fighting with > >>> JBuilder 2005 trying to get some JNDI naming stuff to work for my > >>> datasources) > >>> > >>> Ideas? Or am I way off? > >>> > >> > >> > >> I'm gonna go with "possibly way off" because you shouldn't be putting > >> the context name into web.xml (context.xml is okay, though not > >> required, but web.xml no... in fact, I don't think it'll even > >> acknowledge it there). Did you mean to say "META-INF/context.xml"? If > >> so, then we've got a meatier discussion; let us know. > >> > >> Cheers, > >> Patrick > >> > >> On 5/31/05, Aaron Hackney <[EMAIL PROTECTED]> wrote: > >> > >> > >>> Hello. I'm hoping someone can help me with a context question. > >>> > >>> If I define a context in an xml file in > >>> /tomcathome/conf/catalina/localhost > >>> > >>> and if a context with the same name is defined in a webapp WEB-INF/xml > >>> file which would "win" such a fight? I have a feeling my context > >>> defined > >>> in /localhost is being overwritten by the app. (I'm fighting with > >>> JBuilder 2005 trying to get some JNDI naming stuff to work for my > >>> datasources) > >>> > >>> Ideas? Or am I way off? > >>> > >>> Thanks in advance. > >>> -Aaron > >>> > >>> -- > >>> > >>> Aaron Hackney > >>> MCP, MCSA, MCSE 2003/NT4, MCT, > >>> Net+, A+, CCNA, CCDA, CCAI > >>> [EMAIL PROTECTED] > >>> http://www.aaronhackney.com > >>> 309-472-7033 > >>> > >>> > >>> > >>> - > >>> To unsubscribe, e-mail: [EMAIL PROTECTED] > >>> For additional commands, e-mail: [EMAIL PROTECTED] > >>> > >>> >
Re: context battle?
I think I may have actually found the answer to my own questiondoes this look like the right path to go down? http://jakarta.apache.org/tomcat/tomcat-5.0-doc/jndi-resources-howto.html ? Thanks -Aaron Aaron Hackney wrote: Thanks for the response Patrick. I'm probably going about this all wrong. Simply put, I'm just trying to make a datasource available to my application. Sounds sinple enough. I have found a lot of conflicting information out there on the implementation. I develop with JBuilder (good, bad or indifferent!) But anyhowwhere does one properly make a datasource for a tomcat application available? I'm using Tomcat 5.0 (I could use 5.5 if I had to). Thanks in advance. I'm a bit blind and stubling around here and really tried to research it on my own this weekend but to no avail. -Aaron Patrick Thomas wrote: and if a context with the same name is defined in a webapp WEB-INF/xml file which would "win" such a fight? I have a feeling my context defined in /localhost is being overwritten by the app. (I'm fighting with JBuilder 2005 trying to get some JNDI naming stuff to work for my datasources) Ideas? Or am I way off? I'm gonna go with "possibly way off" because you shouldn't be putting the context name into web.xml (context.xml is okay, though not required, but web.xml no... in fact, I don't think it'll even acknowledge it there). Did you mean to say "META-INF/context.xml"? If so, then we've got a meatier discussion; let us know. Cheers, Patrick On 5/31/05, Aaron Hackney <[EMAIL PROTECTED]> wrote: Hello. I'm hoping someone can help me with a context question. If I define a context in an xml file in /tomcathome/conf/catalina/localhost and if a context with the same name is defined in a webapp WEB-INF/xml file which would "win" such a fight? I have a feeling my context defined in /localhost is being overwritten by the app. (I'm fighting with JBuilder 2005 trying to get some JNDI naming stuff to work for my datasources) Ideas? Or am I way off? Thanks in advance. -Aaron -- Aaron Hackney MCP, MCSA, MCSE 2003/NT4, MCT, Net+, A+, CCNA, CCDA, CCAI [EMAIL PROTECTED] http://www.aaronhackney.com 309-472-7033 - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Aaron Hackney MCP, MCSA, MCSE 2003/NT4, MCT, Net+, A+, CCNA, CCDA, CCAI [EMAIL PROTECTED] http://www.aaronhackney.com 309-472-7033 - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: context battle?
From http://jakarta.apache.org/tomcat/tomcat-5.0-doc/config/context.html: In addition to nesting Context elements inside a Host element, you can also store them in individual files (with a ".xml" extension) in the $CATALINA_HOME/conf/[enginename]/[hostname]/ directory. See Automatic Application Deployment for more information. This method allows dynamic reconfiguration of the web application, since the main conf/server.xml file cannot be reloaded without restarting Tomcat. Please note that for tomcat 5.x, unlike tomcat 4.x, it is NOT recommended to place elements directly in the server.xml file. Instead, put them in the META-INF/context.xml directory of your WAR file or the conf directory as described above. I *think* if you use the META-INF/context.xml method it will overwrite the $CATALINA_HOME/conf/[enginename]/[hostname]/*.xml file on deployment. Someone please correct me if I'm wrong. - Lou --- Aaron Hackney <[EMAIL PROTECTED]> wrote: > Thanks for the response Patrick. I'm probably going > about this all wrong. > > Simply put, I'm just trying to make a datasource > available to my > application. Sounds sinple enough. I have found a > lot of conflicting > information out there on the implementation. > > I develop with JBuilder (good, bad or indifferent!) > But anyhowwhere > does one properly make a datasource for a tomcat > application available? > I'm using Tomcat 5.0 (I could use 5.5 if I had to). > > Thanks in advance. I'm a bit blind and stubling > around here and really > tried to research it on my own this weekend but to > no avail. > > -Aaron > > Patrick Thomas wrote: > > >>and if a context with the same name is defined in > a webapp WEB-INF/xml > >>file which would "win" such a fight? I have a > feeling my context defined > >>in /localhost is being overwritten by the app. > (I'm fighting with > >>JBuilder 2005 trying to get some JNDI naming stuff > to work for my > >>datasources) > >> > >>Ideas? Or am I way off? > >> > >> > > > >I'm gonna go with "possibly way off" because you > shouldn't be putting > >the context name into web.xml (context.xml is okay, > though not > >required, but web.xml no... in fact, I don't think > it'll even > >acknowledge it there). Did you mean to say > "META-INF/context.xml"? If > >so, then we've got a meatier discussion; let us > know. > > > >Cheers, > >Patrick > > > >On 5/31/05, Aaron Hackney <[EMAIL PROTECTED]> > wrote: > > > > > >>Hello. I'm hoping someone can help me with a > context question. > >> > >>If I define a context in an xml file in > /tomcathome/conf/catalina/localhost > >> > >>and if a context with the same name is defined in > a webapp WEB-INF/xml > >>file which would "win" such a fight? I have a > feeling my context defined > >>in /localhost is being overwritten by the app. > (I'm fighting with > >>JBuilder 2005 trying to get some JNDI naming stuff > to work for my > >>datasources) > >> > >>Ideas? Or am I way off? > >> > >>Thanks in advance. > >>-Aaron > >> > >>-- > >> > >>Aaron Hackney > >>MCP, MCSA, MCSE 2003/NT4, MCT, > >>Net+, A+, CCNA, CCDA, CCAI > >>[EMAIL PROTECTED] > >>http://www.aaronhackney.com > >>309-472-7033 > >> > >> > >> > >>- > >>To unsubscribe, e-mail: > [EMAIL PROTECTED] > >>For additional commands, e-mail: > [EMAIL PROTECTED] > >> > >> > >> > >> > > > >- > >To unsubscribe, e-mail: > [EMAIL PROTECTED] > >For additional commands, e-mail: > [EMAIL PROTECTED] > > > > > > > > -- > > Aaron Hackney > MCP, MCSA, MCSE 2003/NT4, MCT, > Net+, A+, CCNA, CCDA, CCAI > [EMAIL PROTECTED] > http://www.aaronhackney.com > 309-472-7033 > > > > - > To unsubscribe, e-mail: > [EMAIL PROTECTED] > For additional commands, e-mail: > [EMAIL PROTECTED] > > - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: context battle?
Thanks for the response Patrick. I'm probably going about this all wrong. Simply put, I'm just trying to make a datasource available to my application. Sounds sinple enough. I have found a lot of conflicting information out there on the implementation. I develop with JBuilder (good, bad or indifferent!) But anyhowwhere does one properly make a datasource for a tomcat application available? I'm using Tomcat 5.0 (I could use 5.5 if I had to). Thanks in advance. I'm a bit blind and stubling around here and really tried to research it on my own this weekend but to no avail. -Aaron Patrick Thomas wrote: and if a context with the same name is defined in a webapp WEB-INF/xml file which would "win" such a fight? I have a feeling my context defined in /localhost is being overwritten by the app. (I'm fighting with JBuilder 2005 trying to get some JNDI naming stuff to work for my datasources) Ideas? Or am I way off? I'm gonna go with "possibly way off" because you shouldn't be putting the context name into web.xml (context.xml is okay, though not required, but web.xml no... in fact, I don't think it'll even acknowledge it there). Did you mean to say "META-INF/context.xml"? If so, then we've got a meatier discussion; let us know. Cheers, Patrick On 5/31/05, Aaron Hackney <[EMAIL PROTECTED]> wrote: Hello. I'm hoping someone can help me with a context question. If I define a context in an xml file in /tomcathome/conf/catalina/localhost and if a context with the same name is defined in a webapp WEB-INF/xml file which would "win" such a fight? I have a feeling my context defined in /localhost is being overwritten by the app. (I'm fighting with JBuilder 2005 trying to get some JNDI naming stuff to work for my datasources) Ideas? Or am I way off? Thanks in advance. -Aaron -- Aaron Hackney MCP, MCSA, MCSE 2003/NT4, MCT, Net+, A+, CCNA, CCDA, CCAI [EMAIL PROTECTED] http://www.aaronhackney.com 309-472-7033 - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Aaron Hackney MCP, MCSA, MCSE 2003/NT4, MCT, Net+, A+, CCNA, CCDA, CCAI [EMAIL PROTECTED] http://www.aaronhackney.com 309-472-7033 - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: context battle?
> and if a context with the same name is defined in a webapp WEB-INF/xml > file which would "win" such a fight? I have a feeling my context defined > in /localhost is being overwritten by the app. (I'm fighting with > JBuilder 2005 trying to get some JNDI naming stuff to work for my > datasources) > > Ideas? Or am I way off? I'm gonna go with "possibly way off" because you shouldn't be putting the context name into web.xml (context.xml is okay, though not required, but web.xml no... in fact, I don't think it'll even acknowledge it there). Did you mean to say "META-INF/context.xml"? If so, then we've got a meatier discussion; let us know. Cheers, Patrick On 5/31/05, Aaron Hackney <[EMAIL PROTECTED]> wrote: > Hello. I'm hoping someone can help me with a context question. > > If I define a context in an xml file in /tomcathome/conf/catalina/localhost > > and if a context with the same name is defined in a webapp WEB-INF/xml > file which would "win" such a fight? I have a feeling my context defined > in /localhost is being overwritten by the app. (I'm fighting with > JBuilder 2005 trying to get some JNDI naming stuff to work for my > datasources) > > Ideas? Or am I way off? > > Thanks in advance. > -Aaron > > -- > > Aaron Hackney > MCP, MCSA, MCSE 2003/NT4, MCT, > Net+, A+, CCNA, CCDA, CCAI > [EMAIL PROTECTED] > http://www.aaronhackney.com > 309-472-7033 > > > > - > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
context battle?
Hello. I'm hoping someone can help me with a context question. If I define a context in an xml file in /tomcathome/conf/catalina/localhost and if a context with the same name is defined in a webapp WEB-INF/xml file which would "win" such a fight? I have a feeling my context defined in /localhost is being overwritten by the app. (I'm fighting with JBuilder 2005 trying to get some JNDI naming stuff to work for my datasources) Ideas? Or am I way off? Thanks in advance. -Aaron -- Aaron Hackney MCP, MCSA, MCSE 2003/NT4, MCT, Net+, A+, CCNA, CCDA, CCAI [EMAIL PROTECTED] http://www.aaronhackney.com 309-472-7033 - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]