You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by wille <wi...@ling.su.se> on 2007/02/27 16:15:10 UTC

URL-pointing problem

Hello,

having a bit of a problem here.


We have deployed a web application on our server by putting it in the
webapps directory, this makes it appear at a URL like
http://mjau.com/pub_db. Now we want to change the URL for this webapp to
something else, (in this case http://mjau.com/publications). 

Currently we've tried messing around with URL-mapping
in /tomcat5/conf/web.xml and /tomcat5/webapps/WEB-INF/web.xml.


We've tried to use the servlet-mapping directive in our web data
xml-files, but it seems that the servlet is implicitly defined when
putting the webapp in the webapps directory, because we have no servlet
section in our web data xml-files. But things work anyway.

But when we try to define our own servlet section, it won't work.

We are running Tomcat 5.0.30, Java 5.0, on a Debian Etch server.




This is what we've tried to do in the /tomcat5/conf/web.xml:

	<servlet>
            <servlet-name>pubdb</servlet-name>
                    <servlet-class>
                        pubdb
                      </servlet-class>
              </servlet>-->

  <!--<servlet-mapping>
  <servlet-name>invoker</servlet-name>
  <url-pattern>/publications/*</url-pattern>
</servlet-mapping>-->

</web-app>





Anyone have a clue what we're doing wrong?


---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: URL-pointing problem

Posted by Richard Gemmell <ri...@moglit.demon.co.uk>.
Hi Wille,

wille wrote:

> We have deployed a web application on our server by putting it in the
> webapps directory, this makes it appear at a URL like
> http://mjau.com/pub_db. Now we want to change the URL for this webapp to
> something else, (in this case http://mjau.com/publications). 

The simplest thing to do is to stop Tomcat, rename the pub_db 
subdirectory in webapps to publications and then restart Tomcat.

If you have a pub_db.xml file in Tomcat5/conf/ then you'll have to 
rename that to publications.xml.

Let me know if you can't rename the directory for some reason and I'll 
give you a more complex solution.

regards,
Richard

---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


RE: URL-pointing problem

Posted by Peter Crowther <Pe...@melandra.com>.
> From: wille [mailto:wilhelm@ling.su.se] 
> Our webapp had hardcoded paths in it, now we "just" have to grep them
> all and replace them.

Oops :-).

You might like to look at the servlet context's methods for fetching
resources (getResource and getResourceAsStream, I think).  They make the
file locations relative to the servlet, wherever it's deployed.

		- Peter

---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


RE: URL-pointing problem

Posted by wille <wi...@ling.su.se>.
^__^

Our webapp had hardcoded paths in it, now we "just" have to grep them
all and replace them.

Thanks y'all!



On Wed, 2007-02-28 at 10:58 +0000, Peter Crowther wrote:
> > From: wille [mailto:wilhelm@ling.su.se] 
> > root cause 
> > 
> > java.lang.NullPointerException
> > 	pubdb.Entry.getDocuments(Entry.java:399)
> > 	pubdb.Entry.getEntryById(Entry.java:217)
> 
> So what's causing the NPE then? :-)
> 
> 		- Peter
> 
> ---------------------------------------------------------------------
> To start a new topic, e-mail: users@tomcat.apache.org
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
> 


---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


RE: URL-pointing problem

Posted by Peter Crowther <Pe...@melandra.com>.
> From: wille [mailto:wilhelm@ling.su.se] 
> root cause 
> 
> java.lang.NullPointerException
> 	pubdb.Entry.getDocuments(Entry.java:399)
> 	pubdb.Entry.getEntryById(Entry.java:217)

So what's causing the NPE then? :-)

		- Peter

---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: URL-pointing problem

Posted by wille <wi...@ling.su.se>.
We tried changing the folder name, however that makes our servlet crash.
Couldn't find content.xml though; only admin.xml and manager.xml resides
under /conf/
.
The following error message is returned when trying to run the app:

org.apache.jasper.JasperException
	org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:372)
	org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:292)
	org.apache.jasper.servlet.JspServlet.service(JspServlet.java:236)
	javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
	sun.reflect.GeneratedMethodAccessor47.invoke(Unknown Source)
	sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
	java.lang.reflect.Method.invoke(Method.java:585)
	org.apache.catalina.security.SecurityUtil$1.run(SecurityUtil.java:243)
	java.security.AccessController.doPrivileged(Native Method)
	javax.security.auth.Subject.doAsPrivileged(Subject.java:517)
	org.apache.catalina.security.SecurityUtil.execute(SecurityUtil.java:272)
	org.apache.catalina.security.SecurityUtil.doAsPrivilege(SecurityUtil.java:161)

root cause 

java.lang.NullPointerException
	pubdb.Entry.getDocuments(Entry.java:399)
	pubdb.Entry.getEntryById(Entry.java:217)
	org.apache.jsp.search.search_005fresult_jsp._jspService(search_005fresult_jsp.java:677)
	org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:94)
	javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
	org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:324)
	org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:292)
	org.apache.jasper.servlet.JspServlet.service(JspServlet.java:236)
	javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
	sun.reflect.GeneratedMethodAccessor47.invoke(Unknown Source)
	sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
	java.lang.reflect.Method.invoke(Method.java:585)
	org.apache.catalina.security.SecurityUtil$1.run(SecurityUtil.java:243)
	java.security.AccessController.doPrivileged(Native Method)
	javax.security.auth.Subject.doAsPrivileged(Subject.java:517)
	org.apache.catalina.security.SecurityUtil.execute(SecurityUtil.java:272)
	org.apache.catalina.security.SecurityUtil.doAsPrivilege(SecurityUtil.java:161)

note 



(We might get a response that says "well it's a badly coded app then" :)
however, since our java skills really aren't up to par, it would be
great if there was an easier solution rather than rewriting the app.)



On Tue, 2007-02-27 at 10:24 -0500, David Smith wrote:
> There's a difference between webapp names and servlet names.  You want
> to change the webapp's name.  To do that, just change the name of the
> webapp in the webapps folder ie pub_db -> publications or pub_db.war ->
> publications.war.  You may have to make a similar name change to the
> context.xml file in conf/Catalina/localhost and then restart tomcat.
> 
> --David
> 
> wille wrote:
> 
> >Hello,
> >
> >having a bit of a problem here.
> >
> >
> >We have deployed a web application on our server by putting it in the
> >webapps directory, this makes it appear at a URL like
> >http://mjau.com/pub_db. Now we want to change the URL for this webapp to
> >something else, (in this case http://mjau.com/publications). 
> >
> >Currently we've tried messing around with URL-mapping
> >in /tomcat5/conf/web.xml and /tomcat5/webapps/WEB-INF/web.xml.
> >
> >
> >We've tried to use the servlet-mapping directive in our web data
> >xml-files, but it seems that the servlet is implicitly defined when
> >putting the webapp in the webapps directory, because we have no servlet
> >section in our web data xml-files. But things work anyway.
> >
> >But when we try to define our own servlet section, it won't work.
> >
> >We are running Tomcat 5.0.30, Java 5.0, on a Debian Etch server.
> >
> >
> >
> >
> >This is what we've tried to do in the /tomcat5/conf/web.xml:
> >
> >	<servlet>
> >            <servlet-name>pubdb</servlet-name>
> >                    <servlet-class>
> >                        pubdb
> >                      </servlet-class>
> >              </servlet>-->
> >
> >  <!--<servlet-mapping>
> >  <servlet-name>invoker</servlet-name>
> >  <url-pattern>/publications/*</url-pattern>
> ></servlet-mapping>-->
> >
> ></web-app>
> >
> >
> >
> >
> >
> >Anyone have a clue what we're doing wrong?
> >
> >
> >---------------------------------------------------------------------
> >To start a new topic, e-mail: users@tomcat.apache.org
> >To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> >For additional commands, e-mail: users-help@tomcat.apache.org
> >
> >  
> >
> 
> 
> ---------------------------------------------------------------------
> To start a new topic, e-mail: users@tomcat.apache.org
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
> 


---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: URL-pointing problem

Posted by David Smith <dn...@cornell.edu>.
There's a difference between webapp names and servlet names.  You want
to change the webapp's name.  To do that, just change the name of the
webapp in the webapps folder ie pub_db -> publications or pub_db.war ->
publications.war.  You may have to make a similar name change to the
context.xml file in conf/Catalina/localhost and then restart tomcat.

--David

wille wrote:

>Hello,
>
>having a bit of a problem here.
>
>
>We have deployed a web application on our server by putting it in the
>webapps directory, this makes it appear at a URL like
>http://mjau.com/pub_db. Now we want to change the URL for this webapp to
>something else, (in this case http://mjau.com/publications). 
>
>Currently we've tried messing around with URL-mapping
>in /tomcat5/conf/web.xml and /tomcat5/webapps/WEB-INF/web.xml.
>
>
>We've tried to use the servlet-mapping directive in our web data
>xml-files, but it seems that the servlet is implicitly defined when
>putting the webapp in the webapps directory, because we have no servlet
>section in our web data xml-files. But things work anyway.
>
>But when we try to define our own servlet section, it won't work.
>
>We are running Tomcat 5.0.30, Java 5.0, on a Debian Etch server.
>
>
>
>
>This is what we've tried to do in the /tomcat5/conf/web.xml:
>
>	<servlet>
>            <servlet-name>pubdb</servlet-name>
>                    <servlet-class>
>                        pubdb
>                      </servlet-class>
>              </servlet>-->
>
>  <!--<servlet-mapping>
>  <servlet-name>invoker</servlet-name>
>  <url-pattern>/publications/*</url-pattern>
></servlet-mapping>-->
>
></web-app>
>
>
>
>
>
>Anyone have a clue what we're doing wrong?
>
>
>---------------------------------------------------------------------
>To start a new topic, e-mail: users@tomcat.apache.org
>To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
>For additional commands, e-mail: users-help@tomcat.apache.org
>
>  
>


---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org