some concepts needed

View: New views
11 Messages — Rating Filter:   Alert me  

some concepts needed

by Deepak Mishra-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

hi, i am pretty new to tomcat. currently i have tomcat6 on ubuntu-linux.
i have pursued some books on tomcat , but they cant help me getting some  
concepts, they simply point to "using tomcat"
here is one of my doubts i got during database connection..

does tomcat have its own java compiler ?

PROOF THAT TC HAS A SEPERATE JAVA COMPILER
when i normally connect my simple jdbc program (not a web application), i  
have to set the CLASSPATH variable for locating the connector/J jar file.
but when i am running a jsp in my web-app, which uses jdbc, CLASSPATH  
doesnt help..i have to explicitly place the library in the web-app's lib  
or the common/lib.

PROOF THAT TC DOES NOT HAVE A SEPERATE JAVA COMPILER -
while installing tomcat, java was demanded as a prerequisite ...meaning to  
say that tomcat depends on an external java compiler

i hope i am not asking a "dummys" question,as i am new to java too !!
but i will be happy if you people can answer me and/or point me to a nice  
tutorial to know "how tomcat works" rather than "how to work on tomcat".

thanks all !!
Deepak Mishra


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


Re: some concepts needed

by David Smith-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Tomcat does have a java compiler (jasper) to compile jsp pages to
servlets, but it also needs a JVM (java).  Setting CLASSPATH is a big
no-no.  Put any required jars your webapp might need in the proper
place.  If you use tomcat's internal pooling for db connections, that
means putting driver jar files in tomcat's lib directory.

--David

Deepak Mishra wrote:

> hi, i am pretty new to tomcat. currently i have tomcat6 on ubuntu-linux.
> i have pursued some books on tomcat , but they cant help me getting
> some concepts, they simply point to "using tomcat"
> here is one of my doubts i got during database connection..
>
> does tomcat have its own java compiler ?
>
> PROOF THAT TC HAS A SEPERATE JAVA COMPILER
> when i normally connect my simple jdbc program (not a web
> application), i have to set the CLASSPATH variable for locating the
> connector/J jar file.
> but when i am running a jsp in my web-app, which uses jdbc, CLASSPATH
> doesnt help..i have to explicitly place the library in the web-app's
> lib  or the common/lib.
>
> PROOF THAT TC DOES NOT HAVE A SEPERATE JAVA COMPILER -
> while installing tomcat, java was demanded as a prerequisite
> ...meaning to say that tomcat depends on an external java compiler
>
> i hope i am not asking a "dummys" question,as i am new to java too !!
> but i will be happy if you people can answer me and/or point me to a
> nice tutorial to know "how tomcat works" rather than "how to work on
> tomcat".
>
> thanks all !!
> Deepak Mishra
>

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


Re: some concepts needed

by David Smith-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

BTW:   java is the JVM, javac is the compiler.

David Smith wrote:

> Tomcat does have a java compiler (jasper) to compile jsp pages to
> servlets, but it also needs a JVM (java).  Setting CLASSPATH is a big
> no-no.  Put any required jars your webapp might need in the proper
> place.  If you use tomcat's internal pooling for db connections, that
> means putting driver jar files in tomcat's lib directory.
>
> --David
>
> Deepak Mishra wrote:
>> hi, i am pretty new to tomcat. currently i have tomcat6 on ubuntu-linux.
>> i have pursued some books on tomcat , but they cant help me getting
>> some concepts, they simply point to "using tomcat"
>> here is one of my doubts i got during database connection..
>>
>> does tomcat have its own java compiler ?
>>
>> PROOF THAT TC HAS A SEPERATE JAVA COMPILER
>> when i normally connect my simple jdbc program (not a web
>> application), i have to set the CLASSPATH variable for locating the
>> connector/J jar file.
>> but when i am running a jsp in my web-app, which uses jdbc, CLASSPATH
>> doesnt help..i have to explicitly place the library in the web-app's
>> lib  or the common/lib.
>>
>> PROOF THAT TC DOES NOT HAVE A SEPERATE JAVA COMPILER -
>> while installing tomcat, java was demanded as a prerequisite
>> ...meaning to say that tomcat depends on an external java compiler
>>
>> i hope i am not asking a "dummys" question,as i am new to java too !!
>> but i will be happy if you people can answer me and/or point me to a
>> nice tutorial to know "how tomcat works" rather than "how to work on
>> tomcat".
>>
>> thanks all !!
>> Deepak Mishra
>>
>


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


Re: some concepts needed

by Deepak Mishra-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

as you said, tomcat has a java compiler for compiling jsp -> servlets  
"called" jasper.
this is what i read in the wikipedia :
"Jasper parses JSP files to compile them into Java code as servlets"
by that definition, is it right to call jasper a java compiler ?? it is  
just a jsp parser, and it cannot work for normal java programs !!

you further say : "BTW:   java is the JVM, javac is the compiler."
if i understand you, you are saying that we need a JVM (and not a java  
compiler) as a dependency (or a prerequisite for installing tomcat).
this means that tomcat HAS its own compiler, and it only needs a jvm  
provided "externally" ,right??

On Sun, 20 Jul 2008 23:24:45 +0530, David Smith <dns4@...> wrote:

> Tomcat does have a java compiler (jasper) to compile jsp pages to  
> servlets, but it also needs a JVM (java).  Setting CLASSPATH is a big  
> no-no.  Put any required jars your webapp might need in the proper  
> place.  If you use tomcat's internal pooling for db connections, that  
> means putting driver jar files in tomcat's lib directory.
>
> --David
>
> Deepak Mishra wrote:
>> hi, i am pretty new to tomcat. currently i have tomcat6 on ubuntu-linux.
>> i have pursued some books on tomcat , but they cant help me getting  
>> some concepts, they simply point to "using tomcat"
>> here is one of my doubts i got during database connection..
>>
>> does tomcat have its own java compiler ?
>>
>> PROOF THAT TC HAS A SEPERATE JAVA COMPILER
>> when i normally connect my simple jdbc program (not a web application),  
>> i have to set the CLASSPATH variable for locating the connector/J jar  
>> file.
>> but when i am running a jsp in my web-app, which uses jdbc, CLASSPATH  
>> doesnt help..i have to explicitly place the library in the web-app's  
>> lib  or the common/lib.
>>
>> PROOF THAT TC DOES NOT HAVE A SEPERATE JAVA COMPILER -
>> while installing tomcat, java was demanded as a prerequisite ...meaning  
>> to say that tomcat depends on an external java compiler
>>
>> i hope i am not asking a "dummys" question,as i am new to java too !!
>> but i will be happy if you people can answer me and/or point me to a  
>> nice tutorial to know "how tomcat works" rather than "how to work on  
>> tomcat".
>>
>> thanks all !!
>> Deepak Mishra
>>
>
> ---------------------------------------------------------------------
> To start a new topic, e-mail: users@...
> To unsubscribe, e-mail: users-unsubscribe@...
> For additional commands, e-mail: users-help@...
>



--
Using Opera's revolutionary e-mail client: http://www.opera.com/mail/

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


Re: some concepts needed

by David Smith-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

> as you said, tomcat has a java compiler for compiling jsp -> servlets
> "called" jasper.
> this is what i read in the wikipedia :
> "Jasper parses JSP files to compile them into Java code as servlets"
> by that definition, is it right to call jasper a java compiler ?? it
> is just a jsp parser, and it cannot work for normal java programs !!
I'm not a great expert in how tomcat's compilation of jsps works, but I
do know jsp files are compiled first to .java source code and then
further compiled to .class files (servlets to be specific).  You can see
evidence of this in tomcat's work directory.

> if i understand you, you are saying that we need a JVM (and not a java
> compiler) as a dependency (or a prerequisite for installing tomcat).
> this means that tomcat HAS its own compiler, and it only needs a jvm
> provided "externally" ,right??

This is correct.

--David

Deepak Mishra wrote:

> as you said, tomcat has a java compiler for compiling jsp -> servlets
> "called" jasper.
> this is what i read in the wikipedia :
> "Jasper parses JSP files to compile them into Java code as servlets"
> by that definition, is it right to call jasper a java compiler ?? it
> is just a jsp parser, and it cannot work for normal java programs !!
>
> you further say : "BTW:   java is the JVM, javac is the compiler."
> if i understand you, you are saying that we need a JVM (and not a java
> compiler) as a dependency (or a prerequisite for installing tomcat).
> this means that tomcat HAS its own compiler, and it only needs a jvm
> provided "externally" ,right??
>
> On Sun, 20 Jul 2008 23:24:45 +0530, David Smith <dns4@...> wrote:
>
>> Tomcat does have a java compiler (jasper) to compile jsp pages to
>> servlets, but it also needs a JVM (java).  Setting CLASSPATH is a big
>> no-no.  Put any required jars your webapp might need in the proper
>> place.  If you use tomcat's internal pooling for db connections, that
>> means putting driver jar files in tomcat's lib directory.
>>
>> --David
>>
>> Deepak Mishra wrote:
>>> hi, i am pretty new to tomcat. currently i have tomcat6 on
>>> ubuntu-linux.
>>> i have pursued some books on tomcat , but they cant help me getting
>>> some concepts, they simply point to "using tomcat"
>>> here is one of my doubts i got during database connection..
>>>
>>> does tomcat have its own java compiler ?
>>>
>>> PROOF THAT TC HAS A SEPERATE JAVA COMPILER
>>> when i normally connect my simple jdbc program (not a web
>>> application), i have to set the CLASSPATH variable for locating the
>>> connector/J jar file.
>>> but when i am running a jsp in my web-app, which uses jdbc,
>>> CLASSPATH doesnt help..i have to explicitly place the library in the
>>> web-app's lib  or the common/lib.
>>>
>>> PROOF THAT TC DOES NOT HAVE A SEPERATE JAVA COMPILER -
>>> while installing tomcat, java was demanded as a prerequisite
>>> ...meaning to say that tomcat depends on an external java compiler
>>>
>>> i hope i am not asking a "dummys" question,as i am new to java too !!
>>> but i will be happy if you people can answer me and/or point me to a
>>> nice tutorial to know "how tomcat works" rather than "how to work on
>>> tomcat".
>>>
>>> thanks all !!
>>> Deepak Mishra
>>>

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


Re: some concepts needed

by Deepak Mishra-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

thanks a lot david, just one last query (if i a mnot irritating you),
when you say that tomcat has its "own" compiler, then you mean a compiler  
other than jasper ..right ??

On Sun, 20 Jul 2008 23:55:35 +0530, David Smith <dns4@...> wrote:

>> as you said, tomcat has a java compiler for compiling jsp -> servlets  
>> "called" jasper.
>> this is what i read in the wikipedia :
>> "Jasper parses JSP files to compile them into Java code as servlets"
>> by that definition, is it right to call jasper a java compiler ?? it is  
>> just a jsp parser, and it cannot work for normal java programs !!
> I'm not a great expert in how tomcat's compilation of jsps works, but I  
> do know jsp files are compiled first to .java source code and then  
> further compiled to .class files (servlets to be specific).  You can see  
> evidence of this in tomcat's work directory.
>
>> if i understand you, you are saying that we need a JVM (and not a java  
>> compiler) as a dependency (or a prerequisite for installing tomcat).
>> this means that tomcat HAS its own compiler, and it only needs a jvm  
>> provided "externally" ,right??
>
> This is correct.
>
> --David
>
> Deepak Mishra wrote:
>> as you said, tomcat has a java compiler for compiling jsp -> servlets  
>> "called" jasper.
>> this is what i read in the wikipedia :
>> "Jasper parses JSP files to compile them into Java code as servlets"
>> by that definition, is it right to call jasper a java compiler ?? it is  
>> just a jsp parser, and it cannot work for normal java programs !!
>>
>> you further say : "BTW:   java is the JVM, javac is the compiler."
>> if i understand you, you are saying that we need a JVM (and not a java  
>> compiler) as a dependency (or a prerequisite for installing tomcat).
>> this means that tomcat HAS its own compiler, and it only needs a jvm  
>> provided "externally" ,right??
>>
>> On Sun, 20 Jul 2008 23:24:45 +0530, David Smith <dns4@...>  
>> wrote:
>>
>>> Tomcat does have a java compiler (jasper) to compile jsp pages to  
>>> servlets, but it also needs a JVM (java).  Setting CLASSPATH is a big  
>>> no-no.  Put any required jars your webapp might need in the proper  
>>> place.  If you use tomcat's internal pooling for db connections, that  
>>> means putting driver jar files in tomcat's lib directory.
>>>
>>> --David
>>>
>>> Deepak Mishra wrote:
>>>> hi, i am pretty new to tomcat. currently i have tomcat6 on  
>>>> ubuntu-linux.
>>>> i have pursued some books on tomcat , but they cant help me getting  
>>>> some concepts, they simply point to "using tomcat"
>>>> here is one of my doubts i got during database connection..
>>>>
>>>> does tomcat have its own java compiler ?
>>>>
>>>> PROOF THAT TC HAS A SEPERATE JAVA COMPILER
>>>> when i normally connect my simple jdbc program (not a web  
>>>> application), i have to set the CLASSPATH variable for locating the  
>>>> connector/J jar file.
>>>> but when i am running a jsp in my web-app, which uses jdbc, CLASSPATH  
>>>> doesnt help..i have to explicitly place the library in the web-app's  
>>>> lib  or the common/lib.
>>>>
>>>> PROOF THAT TC DOES NOT HAVE A SEPERATE JAVA COMPILER -
>>>> while installing tomcat, java was demanded as a prerequisite  
>>>> ...meaning to say that tomcat depends on an external java compiler
>>>>
>>>> i hope i am not asking a "dummys" question,as i am new to java too !!
>>>> but i will be happy if you people can answer me and/or point me to a  
>>>> nice tutorial to know "how tomcat works" rather than "how to work on  
>>>> tomcat".
>>>>
>>>> thanks all !!
>>>> Deepak Mishra
>>>>
>
> ---------------------------------------------------------------------
> To start a new topic, e-mail: users@...
> To unsubscribe, e-mail: users-unsubscribe@...
> For additional commands, e-mail: users-help@...
>



--
Using Opera's revolutionary e-mail client: http://www.opera.com/mail/

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


RE: some concepts needed

by Caldarale, Charles R :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

> From: David Smith [mailto:dns4@...]
> Subject: Re: some concepts needed
>
> jsp files are compiled first to .java source code and then
> further compiled to .class files (servlets to be specific).

Jasper does the translation from .jsp to .java; it can be configured in conf/web.xml to use any .java to .class compiler you wish.  The default is the JDT compiler from Eclipse, packaged in the jasper-jdt.jar in Tomcat's lib directory.

 - Chuck


THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY MATERIAL and is thus for use only by the intended recipient. If you received this in error, please contact the sender and delete the e-mail and its attachments from all computers.

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


Re: some concepts needed

by Deepak Mishra-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Sun, 20 Jul 2008 23:24:45 +0530, David Smith <dns4@...> wrote:

> Tomcat does have a java compiler (jasper) to compile jsp pages to  
> servlets, but it also needs a JVM (java).  Setting CLASSPATH is a big  
> no-no.  Put any required jars your webapp might need in the proper  
> place.  If you use tomcat's internal pooling for db connections, that  
> means putting driver jar files in tomcat's lib directory.
>
> --David

sorry, if i am looking into this matter too much , but i really want to  
know more !!
i just read class loading in java. the jar files (all the ones needed by  
the program) are loaded by the JVM (through bootstrap , extension and  
system classloaders) just before running the program.
now, since tomcat uses the operating system installed JVM for running the  
programs (as you said it has got only a java compiler of its own and not a  
"personal" JVM), why isnt it(the operating system JVM)  able to locate the  
CLASSPATH for jsps as it would do for an ordinary program??

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


Re: some concepts needed

by David Smith-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Back in the days before tomcat 3.3, we used to have to put all the jars
on the classpath and it was HORRIBLE.  Nasty version conflicts and lot's
of headaches.  Somewhere after the introduction of tomcat 3.3, tomcat
started purposely ignoring the CLASSPATH in favor of it's own
classloader architecture in order to save people a fair number of
headaches.  In short, you shouldn't worry about CLASSPATH.   Just put
the jar files where they belong -- typically in your webapp's
WEB-INF/lib folder and watch tomcat do it's wonderful magic.

--David

Deepak Mishra wrote:

> On Sun, 20 Jul 2008 23:24:45 +0530, David Smith <dns4@...> wrote:
>
>> Tomcat does have a java compiler (jasper) to compile jsp pages to
>> servlets, but it also needs a JVM (java).  Setting CLASSPATH is a big
>> no-no.  Put any required jars your webapp might need in the proper
>> place.  If you use tomcat's internal pooling for db connections, that
>> means putting driver jar files in tomcat's lib directory.
>>
>> --David
>
> sorry, if i am looking into this matter too much , but i really want
> to know more !!
> i just read class loading in java. the jar files (all the ones needed
> by the program) are loaded by the JVM (through bootstrap , extension
> and system classloaders) just before running the program.
> now, since tomcat uses the operating system installed JVM for running
> the programs (as you said it has got only a java compiler of its own
> and not a "personal" JVM), why isnt it(the operating system JVM)  able
> to locate the CLASSPATH for jsps as it would do for an ordinary program??
>
> ---------------------------------------------------------------------
> To start a new topic, e-mail: users@...
> To unsubscribe, e-mail: users-unsubscribe@...
> For additional commands, e-mail: users-help@...
>


--
David Smith
Programmer/Analyst
College of Agriculture and Life Sciences
Cornell University
B32 Morrison Hall
Ithaca, NY 14853
Phone: (607) 255-4521


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


RE: some concepts needed

by Caldarale, Charles R :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

> From: David Smith [mailto:dns4@...]
> Subject: Re: some concepts needed
>
> In short, you shouldn't worry about CLASSPATH.

Don't just not worry about it - don't even think about using it.

> Just put the jar files where they belong -- typically in
> your webapp's WEB-INF/lib folder and watch tomcat do it's
> wonderful magic.

The OP needs to read the Servlet spec to get an understanding of webapp structure and construction:
http://jcp.org/aboutJava/communityprocess/mrel/jsr154/index2.html

And also the Tomcat classloading doc:
http://tomcat.apache.org/tomcat-6.0-doc/class-loader-howto.html

The CLASSPATH variable, like the invoker servlet, is an abomination; neither should ever be used.

 - Chuck


THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY MATERIAL and is thus for use only by the intended recipient. If you received this in error, please contact the sender and delete the e-mail and its attachments from all computers.

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


Re: some concepts needed

by Deepak Mishra-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Mon, 21 Jul 2008 17:29:58 +0530, David Smith <dns4@...> wrote:

> Back in the days before tomcat 3.3, we used to have to put all the jars  
> on the classpath and it was HORRIBLE.  Nasty version conflicts and lot's  
> of headaches.  Somewhere after the introduction of tomcat 3.3, tomcat  
> started purposely ignoring the CLASSPATH in favor of it's own  
> classloader architecture in order to save people a fair number of  
> headaches.  In short, you shouldn't worry about CLASSPATH.   Just put  
> the jar files where they belong -- typically in your webapp's  
> WEB-INF/lib folder and watch tomcat do it's wonderful magic.
>
> --David
  thanks a lot david..especially for the patience you showed...its all  
clear now.

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