> The docBase for my app is /usr/local/jsp/ > I've placed my spring test JSP in /usr/local/jsp/testSpring/testSpring.jsp
You probably want your's app docBase to be something like /usr/local/myapp, and then have your jsp's in a directory /usr/local/myapp/WEB-INF/jsp/ - eg. /usr/local/myapp/WEB-INF/jsp/testSpring/testSpring.jsp On Sat, Mar 12, 2011 at 5:42 AM, Aureliusz R. <aremp...@gmail.com> wrote: > Borut, > > thanks again. You were correct, it was lazy initialization. Pretty > much at this point I got the spring part working. > > I've encountered yet another issue with mapping requests from apache2 > web server to tomcat. It seems to have something to do with SSL, as I > don't have this issue for http. > > The situation looks as follows: > > apache2/httpd.conf has the following mod_jk mappings: > JkMount /servlet/* worker1 > JkMount /*.jsp worker1 > JkMount /jsp/* worker1 > > When I invoke this JSP directly through tomcat, or through apache > httpd server but over http, it works fine: > http://server.domain.com:8080/jsp/testSpring/testSpring.htm > http://server.domain.com/jsp/testSpring/testSpring.htm > > When I invoke this JSP through apache httpd over https, it's actually > looking for the static htm file. It doesn't go through tomcat at all. > https://server.domain.com/jsp/testSpring/testSpring.htm > > Not Found > The requested URL /jsp/testSpring/testSpring.htm was not found on this server. > > Would you be able to point me in the right direction? I searched > through some of the ssl config files, but I didn't find anything that > would prevent /jsp/**/*.htm requests from being sent to tomcat. > > Thanks, > aurir_ > > On Fri, Mar 11, 2011 at 9:30 AM, Borut Hadžialić > <borut.hadzia...@gmail.com> wrote: >> Do not put anything in $TOMCAT_HOME/conf/web.xml - leave that file as >> it is when you unpack a fresh Tomcat distribution. >> >> Why the servlet is not being loaded? - not 100% about this, but I >> would first check if it is maybe being lazy loaded/initialized. After >> your tomcat starts up, try to browse http://localhost:8080/test.htm - >> that http request will be mapped to your spring servlet, and it will >> trigger the initialization of your spring servlet (if that was the >> problem in the first place, but i think it is). >> >> The exception you were getting meant that your DispatcherServlet >> couldn't find and load its configuration file at startup. >> A DispatcherServlet's configuration file is by default >> /WEB-INF/<servlet-name>-servlet.xml'. <servlet-name> is 'spring' in >> your case - that is how you named it inside web.xml: >> >> <servlet> >> <servlet-name>spring</servlet-name> >> .... >> </servlet> >> >> So your DispatcherServlet instance that you named 'spring' tried to >> load the file /WEB-INF/spring-servlet.xml, which wasn't there and you >> got the exception: >> java.io.FileNotFoundException: Could not open ServletContext resource >> [/WEB-INF/spring-servlet.xml] >> >> Make sure you have 'spring' DispatcherServlet's configuration in a >> file /WEB-INF/spring-servlet.xml, or use some other file with >> configuration like this: >> >> <servlet> >> <servlet-name>spring</servlet-name> >> <servlet-class> >> org.springframework.web.servlet.DispatcherServlet >> </servlet-class> >> <init-param> >> <param-name>contextConfigLocation</param-name> >> <param-value>/WEB-INF/foo/bar-servlet.xml</param-value> >> </init-param> >> <load-on-startup>1</load-on-startup> >> </servlet> >> >> On Fri, Mar 11, 2011 at 4:08 PM, Aureliusz R. <aremp...@gmail.com> wrote: >>> Borut, >>> >>> your instructions were spot on. I was able to track down my docBase >>> folder (it was specified in $TOMCAT_HOME/conf/servlet.xml <context>, >>> and I verified that it's the correct location by adding some context >>> parameters to the web.xml in my docBase, and then retrieving them from >>> a JSP. >>> >>> Now I have another problem though. For some reason, my >>> DispatcherSetvlet (for the spring framework) is not being loaded at >>> all. I tried placing the piece of XML below in the >>> $TOMCAT_HOME/conf/web.xml and my docBase/WEB-INF/web.xml. I also >>> specified invalid fully qualified name for my DispatcherServlet to get >>> some kind of exception, but I don't get anything. Is there anything >>> that would prevent this servlet from being loaded? >>> >>> >>> <servlet-mapping> >>> <servlet-name>spring</servlet-name> >>> <url-pattern>*.htm</url-pattern> >>> </servlet-mapping> >>> >>> It's ridiculous because some time ago when I placed it in >>> $TOMCAT_HOME/conf/web.xml I was getting the exception below, and >>> that's the reason why I wanted to know where my docBase is in the >>> first place. Now that I know where it is, the DispatcherServlet >>> doesn't seem to be loaded at all. Is there anything that would prevent >>> this servlet from being loaded? >>> >>> org.springframework.beans.factory.BeanDefinitionSt oreException: >>> IOException parsing XML document from ServletContext resource >>> [/WEB-INF/spring-servlet.xml]; nested exception is >>> java.io.FileNotFoundException: Could not open ServletContext resource >>> [/WEB-INF/spring-servlet.xml] >>> >>> Thanks, >>> Aurir_ >>> >>> On Tue, Mar 8, 2011 at 2:47 AM, Borut Hadžialić >>> <borut.hadzia...@gmail.com> wrote: >>>> The piece of xml you posted looks like something from >>>> $TOMCAT_HOME/conf/web.xml file. This file contains some default >>>> configuration that is applied to all web applications and you usually >>>> don't change it. >>>> >>>> What you need to find is the /WEB-INF directory of your web >>>> application. /WEB-INF directory resides in the root directory of your >>>> web application. This directory is also called Context Root / Document >>>> Base - its the directory that contains all files of your app. You >>>> usually put spring config files in the /WEB-INF directory of your web >>>> application. >>>> >>>> >>>> It doesn't matter where individual applications are on the disk (where >>>> their Context Root / Document Base directories are). Applications can >>>> be in $TOMCAT_HOME/webapps, or in some other directories anywhere on >>>> the filesystem. >>>> >>>> To figure out where your application's Context Root / Document Base is >>>> you can do this: >>>> 1. use find to search for WEB-INF directories on your filesystem >>>> 2. find your Tomcat's instance conf directory ($TOMCAT_HOME/conf) and >>>> go trough the config files there: first look at server.xml - look for >>>> <Host> elements and see if it has a appBase attribute defined. Then >>>> check if the <Host> element has any <Context> child elements. If it >>>> does, their docBase attribute points to document base of an >>>> application. >>>> If you don't find it there, look for subdirectories in conf directory >>>> - for example there might be subdirectories Catalina/localhost that >>>> contain individual application xml config files. Those files also >>>> contain <Context> elements - look for their docBase attribute. >>>> >>>> On Tue, Mar 8, 2011 at 4:47 AM, Aureliusz R. <aremp...@gmail.com> wrote: >>>>> I know this is not a typical tomcat question but please bear with me. >>>>> All Spring integrations call for placing configuration xmls in >>>>> /WEB-INF/ of an application. The tomcat that I'm forced to work with >>>>> has a weird configuration where there are no applications under >>>>> $TOMCAT_HOME/webapps folder. There is one folder where all of the >>>>> servlets go, and the invoker servlet is mapped to it: >>>>> >>>>> <servlet-mapping> >>>>> <servlet-name>invoker</servlet-name> >>>>> <url-pattern>/servlets/*</url-pattern> >>>>> </servlet-mapping> >>>>> >>>>> My question is, how do I know where the context (default context?) in >>>>> such a situation is, so that I could place my spring configuration >>>>> files in there? Is spring usage even possible with such configuration? >>>>> >>>>> Thanks >>>>> Aurir_ >>>>> >>>>> --------------------------------------------------------------------- >>>>> To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org >>>>> For additional commands, e-mail: users-h...@tomcat.apache.org >>>>> >>>>> >>>> >>>> >>>> >>>> -- >>>> Why? >>>> Because YES! >>>> >>>> --------------------------------------------------------------------- >>>> To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org >>>> For additional commands, e-mail: users-h...@tomcat.apache.org >>>> >>>> >>> >>> --------------------------------------------------------------------- >>> To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org >>> For additional commands, e-mail: users-h...@tomcat.apache.org >>> >>> >> >> >> >> -- >> Why? >> Because YES! >> >> --------------------------------------------------------------------- >> To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org >> For additional commands, e-mail: users-h...@tomcat.apache.org >> >> > > --------------------------------------------------------------------- > To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org > For additional commands, e-mail: users-h...@tomcat.apache.org > > -- Why? Because YES! --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org