RE: Classloading issue

2004-12-09 Thread Yu, John
Wade,

Thanks for sharing. When you say using package, you mean
for resource files?

One specific thing you didn't mention is where the calling
class is located. In my case, it's a class from within a 
jar in "lib". That really made the difference. My 
conclusion so far is similar: when using "/", CL could
make a big difference. Better stay away from it?

Regards,
John

> -Original Message-
> From: Wade Chandler [mailto:[EMAIL PROTECTED]
> Sent: Thursday, December 09, 2004 4:31 PM
> To: Tomcat Users List
> Subject: Re: Classloading issue
> 
> 
> Yu, John wrote:
> > Hi,
> > 
> > I'm using Struts plugin, however, I think the issue mostly 
> related to Tomcat
> > 
> > ClassLoading.
> > 
> > I have a class (in a jar) under WEB-INF/lib, which loads 
> properties from 
> > a file located under WEB-INF/classes. 
> > 
> >  ClassLoader cl = getClass().getClassLoader();
> >  InputStream stream = 
> cl.getResourceAsStream("plugin.properties");
> > 
> > I have tried different versions of path, with the results I 
> couldn't totally
> > explain:
> > 1. "plugin.properties": not work
> > 2. "WEB-INF/classes/plugin.properties": work
> > 3. "/WEB-INF/classes/plugin.properties": not work
> > 4. "/plugin.properties": not work
> > 
> > Also, I'm using Tomcat 4.0.6 (NB3.5.1). Does anyone have an answer
> > for this? Is "/" bad? It may apply to Tomcat 5 as well, isn't it?
> > 
> > Regards,
> > John
> > 
> > 
> > 
> > 
> > The contents of this e-mail are intended for the named 
> addressee only. It
> > contains information that may be confidential. Unless you 
> are the named
> > addressee or an authorized designee, you may not copy or 
> use it, or disclose
> > it to anyone else. If you received it in error please 
> notify us immediately
> > and then destroy it. 
> > 
> > 
> > 
> -
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
> > 
> > 
> > 
> 
> Me and another gentleman had this conversation just a little while 
> ago...well one similar to it.  I always have a package which I put my 
> files in.  I never have a problem doing that.  I always use 
> Class.class.getResourceAsStream and getResource (should be 
> roughly the 
> same...usage is a little different).  I have a web app that 
> has multiple 
> installations on the same server and they always find their 
> files.  But, 
> I always use a package so I can access the files that way.  I 
> quit using 
> an empty package for everything when I started having goofy problems 
> with different app servers.  I run into the same thing on 
> Oracle 9iAS once.
> 
> "/plugin.properties"
> and
> "plugin.properties"
> 
> Are very different when you are using 
> ClassLoader.getResource(AsStream), 
> and the same thing applies to Class.getResource(AsString)...see java 
> docs.  Again, I never have a problem, and I load property files from 
> under the classes directory all the time.
> 
> Wade
> 
> 
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 



The contents of this e-mail are intended for the named addressee only. It
contains information that may be confidential. Unless you are the named
addressee or an authorized designee, you may not copy or use it, or disclose
it to anyone else. If you received it in error please notify us immediately
and then destroy it. 


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Classloading issue

2004-12-09 Thread Yu, John
Hi,

I'm using Struts plugin, however, I think the issue mostly related to Tomcat

ClassLoading.

I have a class (in a jar) under WEB-INF/lib, which loads properties from 
a file located under WEB-INF/classes. 

 ClassLoader cl = getClass().getClassLoader();
 InputStream stream = cl.getResourceAsStream("plugin.properties");

I have tried different versions of path, with the results I couldn't totally
explain:
1. "plugin.properties": not work
2. "WEB-INF/classes/plugin.properties": work
3. "/WEB-INF/classes/plugin.properties": not work
4. "/plugin.properties": not work

Also, I'm using Tomcat 4.0.6 (NB3.5.1). Does anyone have an answer
for this? Is "/" bad? It may apply to Tomcat 5 as well, isn't it?

Regards,
John




The contents of this e-mail are intended for the named addressee only. It
contains information that may be confidential. Unless you are the named
addressee or an authorized designee, you may not copy or use it, or disclose
it to anyone else. If you received it in error please notify us immediately
and then destroy it. 


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



directory for compiled JSPs

2004-12-08 Thread Yu, John
Sorry if this has been asked before. I searched archive but couldn't find
exactly
what I'm looking for.

The issue happened is that when using Tomcat5 and deploying web applications

with same context root (path), the second web app deployed (and Tomcat 
restarted) will still have browser pointing to the main JSP of the first
application 
(assuming they have the same starting JSP page).

What I noticed then is from Tomcat 4 to Tomcat 5, it seems the working
directory 
structure has changed when JSPs are compiled which may have contributed to
this.
- in Tomcat 4, I used to get under host something like
"D_3A_5Ctemp_5Ctest_5Cwebcontext"
  (docBase), and below it the web context if any.
- in Tomcat 5, it directly puts web context directory under host.

I'm wondering if I could/should bring this old feature of Tomcat 4 back.
What are
the reason(s) that this is changed (e.g. consistency, JspC, etc.)?

Thanks in advance,
John




The contents of this e-mail are intended for the named addressee only. It
contains information that may be confidential. Unless you are the named
addressee or an authorized designee, you may not copy or use it, or disclose
it to anyone else. If you received it in error please notify us immediately
and then destroy it. 


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



RE: CRUD Operations using Tomcat

2004-07-22 Thread Yu, John
Don't think this is directly related to Tomcat, but MDA covers what 
you requested. Tools like OptimalJ and others could help you out.

- John

> -Original Message-
> From: Valter G. Nogueira Jr. [mailto:[EMAIL PROTECTED]
> Sent: Wednesday, July 21, 2004 9:57 AM
> To: Tomcat Users List
> Subject: Re: CRUD Operations using Tomcat
> 
> 
> I have read a lot about Struts, Hibernate and DAO.
> 
> But these aproachs are too verbose, I mean manually define 
> XML configs, jsp
> pages, actions...
> 
> I was looking for some tool which I point to my database schema and it
> produces the bunch of code.
> 
> It would be good if it was tied to a data dictionary that 
> could dynamically
> change checks and labels.
> 
> Valter
> 
> - Original Message - 
> From: "Wendy Smoak" <[EMAIL PROTECTED]>
> To: "Tomcat Users List" <[EMAIL PROTECTED]>
> Sent: Tuesday, July 20, 2004 8:25 PM
> Subject: Re: CRUD Operations using Tomcat
> 
> 
> > From: "Valter G. Nogueira Jr." <[EMAIL PROTECTED]>
> > > I am looking for good ways to implements CRUD ops using Tomcat
> > > Having handcrafted jsp/servlets almost identicals seems 
> to be not only
> > > boring, but an error prone aproach.
> >
> > How are you doing it now?  Do you have JDBC code inside 
> your Servlets?  I
> > use Struts, and on that users list we often get the same 
> sort of question,
> > "How do I read and write records using Struts?"
> >
> > The answer is the same-- you don't.  You do your data 
> access in a separate
> > layer of code so that nothing in the Action [or Servlet] 
> even knows that a
> > database exists.
> >
> > There are several options available if you're using JDBC-- I think
> Hibernate
> > is one?  I wrote my own and followed the J2EE Data Access 
> Objects pattern.
> > So in my Actions I have code along the lines of:
> >   Person person = personDAO.read( "12345" );
> >
> > HTH,
> > -- 
> > Wendy Smoak
> >
> >
> >
> >
> >
> > 
> -
> > 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]
> 



The contents of this e-mail are intended for the named addressee only. It
contains information that may be confidential. Unless you are the named
addressee or an authorized designee, you may not copy or use it, or disclose
it to anyone else. If you received it in error please notify us immediately
and then destroy it. 


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Tomcat 5 integration question

2004-07-07 Thread Yu, John
Hi,

I'm planning on doing some integration work with Tomcat 5, in which
I would like to perform actions like "start" (both server and application), 
"stop", "deploy", "remove" programmatically.

What is the best approach to achieve this? I know I can send a request to
manager application to deploy an application, but how to parse the result
coming back? It doesn't seem very straightforward (parsing a page), let
alone reliability. Any thoughts?

Thanks,
John




The contents of this e-mail are intended for the named addressee only. It
contains information that may be confidential. Unless you are the named
addressee or an authorized designee, you may not copy or use it, or disclose
it to anyone else. If you received it in error please notify us immediately
and then destroy it. 


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]