Re: deploying war file and "Document base ... does not exist"

2002-09-03 Thread Daniel Kehoe

On Tue, 03 Sep 2002 09:42:58 -0500, "Jacob Kjome" <[EMAIL PROTECTED]> said:
> BTW, you say that there is no "delploy" task?  Well, there certainly 
> is

Jake,

I meant there is no "deploy" option in the Tomcat Web Application
Manager, the web GUI interface at the link "Tomcat Manager" at
http://localhost:8080/index.jsp.

There is an "install" option, but as soon as Tomcat is restarted, the
app is gone. That's fine for development and testing but it seems
logical there should be a corresponding "deploy" action in the GUI
interface, so someone who is using the GUI interface for admin can
permanently deploy an app.

-- 
  Daniel
  [EMAIL PROTECTED]

--
To unsubscribe, e-mail:   
For additional commands, e-mail: 




Re: deploying war file and "Document base ... does not exist"

2002-09-03 Thread Jacob Kjome

The only thing not portable is your assumption that the "logs" directory 
exists at the same level as the tempdir.  You may have to create that 
directory instead of just assuming it is there and using it.  Otherwise, it 
is a decent solution, although there are still reasons why getRealPath("/") 
would be useful, but if you can live without it and don't need to write 
anything to the filesystem within that context, then running directly from 
a .war file is just fine.

Jake

At 05:49 AM 9/3/2002 +, Daniel Kehoe wrote:
>On Sun, 01 Sep 2002 16:35:16 -0500, "Jacob Kjome" <[EMAIL PROTECTED]> said:
> > Yes, but now you are constrained by the fact that the app is running
> > directly from myapp.war which means that you have no filesystem access to
> > your webapp.  For instance, the following will return null in your
> > setup...
> > String contextPath = getServletContext().getRealPath("/");
> > This is because there is no "real path" on your system for your webapp
> > since it is running out of an archive, not out of a directory on the
> > filesystem...
>
>Jake,
>
>Thanks, I've gotten around that issue by getting the path to the
>context attribute "javax.servlet.context.tempdir". Seems to work just
>fine for me, both with apps deployed as unarchived wars and those
>deployed through the manager interface as unexploded wars. Here's the
>method I use. It may be helpful to others...
>
>I wonder if this will work on servlet containers that are not Tomcat
>(Resin, etc)?
>
>/**
>  * Utility method returns a path to a log file WITHOUT USING
>  * context.getRealPath("/"). Suitable when an app is deployed
>  * from an unexploded war file.
>  *
>  * @param  context   the ServletContext object
>  * @return   logFilePath such as
>  /logs/myapp.log
>  * @exception  ServletException  thrown by any error
>  * @exception  IOException   thrown by attempts to access files
>  that don't exist
>  */
>protected static String getLogFilePath(ServletContext context)
> throws ServletException, IOException {
> String logFilePath = null;
> // find out if a configuration parameter defines the path to a 
> logfile:
> if (context.getInitParameter("com.mycom.myapp.logfilepath") != null
> && 
> !"DEFAULT".equals(context.getInitParameter("com.mycom.logfilepath").toUpperCase())) 
> {
> logFilePath = 
> context.getInitParameter("com.mycom.myapp.logfilepath");
> } else {
> String logFileName = "myapp.log";
> String slash = System.getProperty("file.separator");
> // try getting the tempdir value, it looks like
> // "C:\\work\Standalone\localhost\myapp",
> // it works better than context.getRealPath("/") because
> // context.getRealPath("/") doesn't work well when the
> // app is deployed from an unexploded war file
> String lengthyPath = ((File) 
> context.getAttribute("javax.servlet.context.tempdir")).getParent();
> if (lengthyPath == null) {
> String msg = "FATAL: cannot obtain file system 
> reference, cannot set log file";
> System.out.println(msg);
> context.log(msg);
> throw new ServletException(msg);
> }
> lengthyPath = lengthyPath.substring(0, 
> lengthyPath.lastIndexOf(slash));
> lengthyPath = lengthyPath.substring(0, 
> lengthyPath.lastIndexOf(slash));
> logFilePath = lengthyPath.substring(0, 
> lengthyPath.lastIndexOf(slash))
> + slash + "logs" + slash + logFileName;
> // when we're done, the log filepath should look like:
> // "C:\\logs\myapp.log"
> }
> return logFilePath;
>}
>
>--
>   Daniel
>   [EMAIL PROTECTED]



Re: deploying war file and "Document base ... does not exist"

2002-09-03 Thread Jacob Kjome


I hadn't known about the "config" attribute.  I haven't tried it yet, but I 
wonder if you can use the "config" attribute *instead* of the "war" and 
"path" attributes since the config attribute would point to a Context 
Configuration File (CCF) which would contain that information anyway?  In 
fact, if the attributes had different values than the CCF, what values 
would be used???

BTW, you say that there is no "delploy" task?  Well, there certainly 
is.  Here are all the tasks that I know of:

 
 
 
 
 
 
 
 
 
 


And "deploy" is a permanent install of your app.

I'll try the "config" attribute later today.  Thanks!

Jake

At 06:07 AM 9/3/2002 +, Daniel Kehoe wrote:
>On Sun, 01 Sep 2002 04:09:52 -0500, "Jacob Kjome" <[EMAIL PROTECTED]> said:
> > Don't put your app inside $TOMCAT_HOME/webapps and use the install
> > or deploy task to dynamically deploy your app.  This can be done through
> > the ant tasks using something like
> >  >  url="${manager.url}"
> >  username="${manager.username}"
> >  password="${manager.password}"
> >  path="${app.path}"
> >  war="file://${build.home}/WEB-INF/myapp.xml" />
> >
> > myapp.xml would have a  or something like
> > that pointing to the base of the webapp.  Note that I have *not* gotten 
> this
> > to work on Windows...
> > if you get it to work on Windows, please tell me which version of
> > Tomcat you succeeded on and describe what you did to make it work.
>
>Jake,
>
>Here's what works for me under Windows with TC4.1.9b (in my ant
>build.xml file). I have to point the war attribute to an exploded war
>directory (not a war file) or else I can't reload. I'm happy with this
>for development purposes. For permanent deployment, they've got to copy
>the myapp.war file and myapp.xml file into the webapps directory.
>There's no "deploy" action in the Tomcat Web App Manager.
>
>description="Install application to servlet container">
>
>
> username="${manager.username}"
> password="${manager.password}"
> path="${app.path}"
> config="file://${basedir}/myapp.xml"
> war="file://${build.home}"/>
>
>
>
>
>--
>   Daniel
>   [EMAIL PROTECTED]



Re: deploying war file and "Document base ... does not exist"

2002-09-02 Thread Daniel Kehoe

On Sun, 01 Sep 2002 04:09:52 -0500, "Jacob Kjome" <[EMAIL PROTECTED]> said:
> Don't put your app inside $TOMCAT_HOME/webapps and use the install
> or deploy task to dynamically deploy your app.  This can be done through
> the ant tasks using something like
>   url="${manager.url}"
>  username="${manager.username}"
>  password="${manager.password}"
>  path="${app.path}"
>  war="file://${build.home}/WEB-INF/myapp.xml" />
> 
> myapp.xml would have a  or something like
> that pointing to the base of the webapp.  Note that I have *not* gotten this
> to work on Windows...
> if you get it to work on Windows, please tell me which version of
> Tomcat you succeeded on and describe what you did to make it work.

Jake,

Here's what works for me under Windows with TC4.1.9b (in my ant
build.xml file). I have to point the war attribute to an exploded war
directory (not a war file) or else I can't reload. I'm happy with this
for development purposes. For permanent deployment, they've got to copy
the myapp.war file and myapp.xml file into the webapps directory.
There's no "deploy" action in the Tomcat Web App Manager.









-- 
  Daniel
  [EMAIL PROTECTED]

--
To unsubscribe, e-mail:   
For additional commands, e-mail: 




Re: deploying war file and "Document base ... does not exist"

2002-09-02 Thread Daniel Kehoe

On Sun, 01 Sep 2002 16:35:16 -0500, "Jacob Kjome" <[EMAIL PROTECTED]> said:
> Yes, but now you are constrained by the fact that the app is running 
> directly from myapp.war which means that you have no filesystem access to 
> your webapp.  For instance, the following will return null in your
> setup...
> String contextPath = getServletContext().getRealPath("/");
> This is because there is no "real path" on your system for your webapp 
> since it is running out of an archive, not out of a directory on the 
> filesystem...

Jake,

Thanks, I've gotten around that issue by getting the path to the
context attribute "javax.servlet.context.tempdir". Seems to work just
fine for me, both with apps deployed as unarchived wars and those
deployed through the manager interface as unexploded wars. Here's the
method I use. It may be helpful to others...

I wonder if this will work on servlet containers that are not Tomcat
(Resin, etc)?

/**
 * Utility method returns a path to a log file WITHOUT USING 
 * context.getRealPath("/"). Suitable when an app is deployed 
 * from an unexploded war file.
 *
 * @param  context   the ServletContext object
 * @return   logFilePath such as
 /logs/myapp.log
 * @exception  ServletException  thrown by any error
 * @exception  IOException   thrown by attempts to access files
 that don't exist
 */
protected static String getLogFilePath(ServletContext context)
throws ServletException, IOException {
String logFilePath = null;
// find out if a configuration parameter defines the path to a logfile:
if (context.getInitParameter("com.mycom.myapp.logfilepath") != null
 && 
!"DEFAULT".equals(context.getInitParameter("com.mycom.logfilepath").toUpperCase())) {
logFilePath = context.getInitParameter("com.mycom.myapp.logfilepath");
} else {
String logFileName = "myapp.log";
String slash = System.getProperty("file.separator");
// try getting the tempdir value, it looks like 
// "C:\\work\Standalone\localhost\myapp",
// it works better than context.getRealPath("/") because 
// context.getRealPath("/") doesn't work well when the 
// app is deployed from an unexploded war file
String lengthyPath = ((File) 
context.getAttribute("javax.servlet.context.tempdir")).getParent();
if (lengthyPath == null) {
String msg = "FATAL: cannot obtain file system reference, 
cannot set log file";
System.out.println(msg);
context.log(msg);
throw new ServletException(msg);
}
lengthyPath = lengthyPath.substring(0, lengthyPath.lastIndexOf(slash));
lengthyPath = lengthyPath.substring(0, lengthyPath.lastIndexOf(slash));
logFilePath = lengthyPath.substring(0, lengthyPath.lastIndexOf(slash)) 
+ slash + "logs" + slash + logFileName;
// when we're done, the log filepath should look like: 
// "C:\\logs\myapp.log"
}
return logFilePath;
}

-- 
  Daniel
  [EMAIL PROTECTED]

--
To unsubscribe, e-mail:   
For additional commands, e-mail: 




Re: deploying war file and "Document base ... does not exist"

2002-09-01 Thread Jacob Kjome


Yes, but now you are constrained by the fact that the app is running 
directly from myapp.war which means that you have no filesystem access to 
your webapp.  For instance, the following will return null in your setup...

String contextPath = getServletContext().getRealPath("/");

This is because there is no "real path" on your system for your webapp 
since it is running out of an archive, not out of a directory on the 
filesystem.  If you can live with that, then you are good as gold.  If not, 
you will need to read my other reply in this thread.

Jake

At 06:53 AM 9/1/2002 +, you wrote:
>I found the answer by carefully reading
>http://jakarta.apache.org/tomcat/tomcat-4.1-doc/config/host.html
>in the section "Automatic Application Deployment".
>
>Tomcat 4.1+ will automatically deploy myapp.war if the myapp.xml file
>contains
>debug="5" reloadable="true" crossContext="true">
>It failed when I had docBase="myapp" and I needed docBase="myapp.war".
>
>The great thing about this scheme is no one has to edit the server.xml
>file. You can deploy the app by just droppping the myapp.war and
>myapp.xml files into the webapps directory. In older schemes, I had to
>give instructions for editing the server.xml file. Now it's all in the
>myapp.xml file.
>
>Daniel
>[EMAIL PROTECTED]
>
>
>On Sat, 31 Aug 2002 18:29:41 -0700 (PDT), "garrett smith"
><[EMAIL PROTECTED]> said:
> > Tomcat will unjar (unwar?) the archived file by default. The 
> > entry should be in $CATALINA_HOME/lib/server.xml
> >
> > Garrett
> >
> >
> > --- Daniel Kehoe <[EMAIL PROTECTED]> wrote:
> > > Using TC4.1.9beta, I've got a myapp.war file (and matching myapp.xml
> > > configuration file) I install successfully using the Tomcat Web
> > > Application Manager. When I put the myapp.war and myapp.xml files in
> > > /webapps and restart Tomcat (for permanent deployment) I get
> > > the message:
> > >
> > > Error initializing resources: Document base
> > > C:\java\tomcat4\webapps\myapp does not exist or is not a readable
> > > directory
> > >
> > > The myapp.xml file contains:
> > >  > > debug="5" reloadable="true" crossContext="true">
> > > (plus it specifies a dataSource as a resource)
> > >
> > > I know the docbase doesn't yet exist when Tomcat starts because the war
> > > file hasn't been unarchived. How is this supposed to work? Is there an
> > > alternative to specifying the docbase? Do I have to manually unarchive
> > > the war file? It was easy with other apps in TC3.2, I just dropped war
> > > files into webapps and they deployed without any complaints. Maybe I've
> > > overlooked a configuration parameter?
> > > --
> > >   Daniel
> > >   [EMAIL PROTECTED]
>--
>   Daniel
>   [EMAIL PROTECTED]
>
>--
>To unsubscribe, e-mail:   
>For additional commands, e-mail: 



Re: deploying war file and "Document base ... does not exist"

2002-09-01 Thread Jacob Kjome


Hmm.. .That's not even close to accurate.

Daniel is using a Context Configuration File which may contain a  element and make it so you don't have to modify the server.xml.  As 
far as the unwarring, Tomcat actualy will "not* automatically expand 
webapps which have a defined context element.  This is by design although 
some might consider it a bug.

There are 3 solutions:

1. in the  element, point directly to the .war file as the docBase

2. expand the .war file yourself before starting Tomcat and point to the 
expanded directory in the docBase

3. Don't put your app inside $TOMCAT_HOME/webapps and use the install or 
deploy task to dynamically deploy your app.  This can be done through the 
ant tasks using something like



myapp.xml would have a  or something like that 
pointing to the base of the webapp.  Note that I have *not* gotten this to 
work on Windows.  Craig R. McClanahan says it works for him on Linux.  This 
is the ideal solution, so if it works for you, I would use this oneand 
if you get it to work on Windows, please tell me which version of Tomcat 
you succeeded on and describe what you did to make it work.

later,

Jake


At 06:29 PM 8/31/2002 -0700, you wrote:
>Daniel,
>
>Tomcat will unjar (unwar?) the archived file by default. The  entry
>should be in $CATALINA_HOME/lib/server.xml
>
>Garrett
>
>
>--- Daniel Kehoe <[EMAIL PROTECTED]> wrote:
> > Using TC4.1.9beta, I've got a myapp.war file (and matching myapp.xml
> > configuration file) I install successfully using the Tomcat Web
> > Application Manager. When I put the myapp.war and myapp.xml files in
> > /webapps and restart Tomcat (for permanent deployment) I get
> > the message:
> >
> > Error initializing resources: Document base
> > C:\java\tomcat4\webapps\myapp does not exist or is not a readable
> > directory
> >
> > The myapp.xml file contains:
> >  > debug="5" reloadable="true" crossContext="true">
> > (plus it specifies a dataSource as a resource)
> >
> > I know the docbase doesn't yet exist when Tomcat starts because the war
> > file hasn't been unarchived. How is this supposed to work? Is there an
> > alternative to specifying the docbase? Do I have to manually unarchive
> > the war file? It was easy with other apps in TC3.2, I just dropped war
> > files into webapps and they deployed without any complaints. Maybe I've
> > overlooked a configuration parameter?
> > --
> >   Daniel
> >   [EMAIL PROTECTED]
> >
> > --
> > To unsubscribe, 
> e-mail:   
> > For additional commands, e-mail: 
> 
> >
>
>
>=
>http://dhtmlkitchen.com/
>
>__
>Do You Yahoo!?
>Yahoo! Finance - Get real-time stock quotes
>http://finance.yahoo.com
>
>--
>To unsubscribe, e-mail:   
>For additional commands, e-mail: 



Re: deploying war file and "Document base ... does not exist"

2002-08-31 Thread Daniel Kehoe

I found the answer by carefully reading
http://jakarta.apache.org/tomcat/tomcat-4.1-doc/config/host.html
in the section "Automatic Application Deployment".

Tomcat 4.1+ will automatically deploy myapp.war if the myapp.xml file
contains

It failed when I had docBase="myapp" and I needed docBase="myapp.war".

The great thing about this scheme is no one has to edit the server.xml
file. You can deploy the app by just droppping the myapp.war and
myapp.xml files into the webapps directory. In older schemes, I had to
give instructions for editing the server.xml file. Now it's all in the
myapp.xml file.

Daniel
[EMAIL PROTECTED]


On Sat, 31 Aug 2002 18:29:41 -0700 (PDT), "garrett smith"
<[EMAIL PROTECTED]> said:
> Tomcat will unjar (unwar?) the archived file by default. The 
> entry should be in $CATALINA_HOME/lib/server.xml
> 
> Garrett
> 
> 
> --- Daniel Kehoe <[EMAIL PROTECTED]> wrote:
> > Using TC4.1.9beta, I've got a myapp.war file (and matching myapp.xml
> > configuration file) I install successfully using the Tomcat Web
> > Application Manager. When I put the myapp.war and myapp.xml files in
> > /webapps and restart Tomcat (for permanent deployment) I get
> > the message:
> > 
> > Error initializing resources: Document base
> > C:\java\tomcat4\webapps\myapp does not exist or is not a readable
> > directory
> > 
> > The myapp.xml file contains:
> >  > debug="5" reloadable="true" crossContext="true">
> > (plus it specifies a dataSource as a resource)
> > 
> > I know the docbase doesn't yet exist when Tomcat starts because the war
> > file hasn't been unarchived. How is this supposed to work? Is there an
> > alternative to specifying the docbase? Do I have to manually unarchive
> > the war file? It was easy with other apps in TC3.2, I just dropped war
> > files into webapps and they deployed without any complaints. Maybe I've
> > overlooked a configuration parameter?
> > -- 
> >   Daniel
> >   [EMAIL PROTECTED]
-- 
  Daniel
  [EMAIL PROTECTED]

--
To unsubscribe, e-mail:   
For additional commands, e-mail: 




Re: deploying war file and "Document base ... does not exist"

2002-08-31 Thread garrett smith

Daniel,

Tomcat will unjar (unwar?) the archived file by default. The  entry
should be in $CATALINA_HOME/lib/server.xml

Garrett


--- Daniel Kehoe <[EMAIL PROTECTED]> wrote:
> Using TC4.1.9beta, I've got a myapp.war file (and matching myapp.xml
> configuration file) I install successfully using the Tomcat Web
> Application Manager. When I put the myapp.war and myapp.xml files in
> /webapps and restart Tomcat (for permanent deployment) I get
> the message:
> 
> Error initializing resources: Document base
> C:\java\tomcat4\webapps\myapp does not exist or is not a readable
> directory
> 
> The myapp.xml file contains:
>  debug="5" reloadable="true" crossContext="true">
> (plus it specifies a dataSource as a resource)
> 
> I know the docbase doesn't yet exist when Tomcat starts because the war
> file hasn't been unarchived. How is this supposed to work? Is there an
> alternative to specifying the docbase? Do I have to manually unarchive
> the war file? It was easy with other apps in TC3.2, I just dropped war
> files into webapps and they deployed without any complaints. Maybe I've
> overlooked a configuration parameter?
> -- 
>   Daniel
>   [EMAIL PROTECTED]
> 
> --
> To unsubscribe, e-mail:   
> For additional commands, e-mail: 
> 


=
http://dhtmlkitchen.com/

__
Do You Yahoo!?
Yahoo! Finance - Get real-time stock quotes
http://finance.yahoo.com

--
To unsubscribe, e-mail:   
For additional commands, e-mail: 




RE: deploying war file

2002-04-10 Thread John W. Warner

I have found definite but subtle differences in the war file and web.xml
structure when using iPlanet, websphere, silverstream servers. iPlanet
seems to be the most forgiving and doesn't require an web.xml file at
all which I really find strange since it's supposed to be J2EE
compliant. It disgusts me  because I thought J2EE compliant meant you're
following the J2EE specification which, includes the web.xml file and
it's associated DTD as well as identifying war file structure, etc... I
will say this, Tomcat seems to be more specifically compliant than all
of them (at least in talking about the web.xml file and war file
structure.) If you are having trouble with websphere, I'd go to the
websphere documentation and address it that way. 
Good luck.
- John


-Original Message-
From: Brown Bay [mailto:[EMAIL PROTECTED]] 
Sent: Wednesday, April 10, 2002 02:41 PM
To: Tomcat Users List
Subject: deploying war file

I have a .war file that has been generated using the java create a war
utility. this war file contains html, xsl, images and the associated jar
and
class files. this war file has worked fine with tomcat and websphere
application studio developer, in short, it works by just dropping the
file
in tomcat/webapps folder or importing the war file using application
developer.

can a war file generated this way be used with websphere application
server
by just dropping it into an equivalent webapps folder(if one exists) OR
can
i use some import war utility. have any of you had any experience with
this
scenario.

please let me know.

Thanks.


--
To unsubscribe:   
For additional commands: 
Troubles with the list: 



--
To unsubscribe:   
For additional commands: 
Troubles with the list: 




RE: Deploying .war file

2001-08-08 Thread Klaas van der Ploeg

Check the tomcat docs on howto create a .war file using Ant
($TOMCAT_HOME/docs/appdev/index.html). Put the .war in the webapps
directory. You don't have to (but you can if you want to override the
default settings) add a specific context for your webapp, as it will be
added automatically when tomcat starts.

Hope this helps a bit.

Rgrds,
Klaas

> -Original Message-
> From: Alan Zaitchik [mailto:[EMAIL PROTECTED]]
> Sent: maandag 6 augustus 2001 22:48
> To: Tomcat-User@Jakarta. Apache. Org
> Subject: Deploying .war file
> 
> 
> I know this should be trivial but it is just not working for 
> me... I have a
> (Tomcat 3.2.3) application consisting of various html and jsp 
> and tld files
> currently under \webapps\alan\app1. The tags refer to 
> handlers and tei files
> in \webapps\WEB-INF\classes\alan\app1. The web.xml file in 
> \webapps\WEB-INF
> does not refer to any of these elements at the moment. 
> Everything works just
> fine.
> 
> I want to create an app1.war file for all the above which can 
> be deployed
> somewhere else entirely, say c:\bob. According to what I read 
> in various
> places, all I need to do is create a web.xml file that adds a 
>  tag
> for the jsp files (using  rather than 
> ), create an
> app1.war file using the jar utility, and add a  
> block to server.xml
> to define a virtual path to c:\bob\app1.war. I did all these 
> but Tomcat
> (after restart) cannot find my jsp files.
> 
> I believe I must be specifying something incorrectly. Would 
> the context
> block be something like:
>  crossContext="false"
> debug="0" reloadable="true" trusted="false">
> Also, in the original location I pointed my browser at 
> alan1/app1/fu.jsp and
> Tomcat found the files easily (since they were under 
> webapps). Is it enough
> to just add to the web.xml file blocks like
> fufu.jsp
> or must I add something else to web.xml?
> Perhaps the problem is in the URL I type into the browser 
> address?? Should
> it be http://host/whatever/fu or http://host/whatever/fu.jsp or
> http://host/whatever/alan/app1/fu.jsp
> where "/whatever" is the virtual path to c:\bob\app1.war defined in
> server.xml? Actually I tried all these (and other 
> combinations) but without
> luck...
> Please excuse the simplicity of this question but I just 
> cannot seem to get
> the war file working.
> 
> Alan
>