Running schduled jobs

2009-07-10 Thread Ravi Sharma
Hi All,
I need to run some threads at particular time during the day, does Tomcat
provide any such facility? If not then whats the other best way to go for
it.

Basically i recalculate my site's visitor data every 30 minute and keep in
cahce and then display to users, 30 minute delay for my data is fine but
atleast i dont need to run queries to find those data for each request. Now
every 30 minute i want to run those query and update the cache. How can i
achive it.?

Thanks,
Ravi.


Filtering URL via tomcat

2009-04-27 Thread Ravi Sharma
Hi All,
Please help me for this problem, i am not able to get to the root of the
problem.

My site have few open/free pages which can be accessed by anyone/guests and
few only for registered users. So you can access those pages only by login
to the site

http://www.mysiste.com/audio/abc.html (anyone/guests can see this page)
http://www.mysiste.com/audio/app/download/abc.html (only logged in user can
see this page)

I am using tomcat 5.5 and appache httpd server 2.2.

the root of my site reside in appache httpd server
so i have folder structure like
mysite/public_html/audio
mysite/public_html/app/audio/download

in my httpd conf i have something like this
JkMount /app/audio/download/* ajp13w
..
..
..
and mysite.com is poiniting to mysite/public_html


*app* is my tomcat application context

and in tomcat web.xml one Filter is listning to url
filter
filter-nameDownLoadSecurityFilter/filter-name
filter-classcom.app.security.SecurityFilter/filter-class
/filter
filter-mapping
filter-nameDownLoadSecurityFilter/filter-name
url-pattern/audio/download/*/url-pattern
/filter-mapping

So all the pages will be served by apache httpd except the pages which are
like app/audio/download.

So now when somone try to access app/audio/download/some.html the request
passed to tomcat, in turns filter check this url and if user is not logged
in then login screen comes up.
User login and proceed and login screen automcatically forward the request
to the page which was requested app/audio/download/some.html, but here i get
this tomcat error

*Type* Status report

*message* */app/audio/download/some.html*

*description* *The requested resource (/app/audio/download/some.html) is not
available.*

these html pages are static pages and exists in apache http home dir of
websites
public_html/app/audio/download/some.html

but then i thought may be it need to exists in tomcat web apps too., so
under web-apps/app dir i created audio link to audio directory under
public_html

so now webapps dir has following link
webapps/app/audio - /home/mysite/public_html/audio

so basically if i try to access any thing with
http://www.mysite.com/app/audio, it should be served from audio  dir in
webapps which in turn audio dir from appache httpd.

But its not working. :(

I dont know whats wrong.

following is my java filter class

public void doFilter(ServletRequest request, ServletResponse response,
 FilterChain chain)
throws IOException, ServletException {
try
{
checkSecurity(request);
}
catch(UserNotLoggedIn ex)
{
httpResponse.sendRedirect(httpRequest.getContextPath() +
LOGINURL +?URL= + targetUrl);
return;
}
catch(OperationNotAllowedForUser ex)
{
httpResponse.sendRedirect(httpRequest.getContextPath() +
DENIENDURL );
return;
}
chain.doFilter(request, response);

doAfterProcessing(request, response);

}


private void doAfterProcessing(ServletRequest request, ServletResponse
response)
throws IOException, ServletException {
}

Thanks in advance
Ravi


Re: Filtering URL via tomcat

2009-04-27 Thread Ravi Sharma
adding to previoius mail.

http://www.mysite.com/audio/abc.html is a html being served by httpd
correctly
then when i try to access
http://www.mysite.com/app/audio/download/abc.htmli get following error
on browser

*Type* Status report
*message* */app/audio/download/abc.html
**description* *The requested resource (/app/audio/download/abc.html) is not
available.**

the access log(mysite.com_access_log) of apache httpd says*
[27/Apr/2009:11:09:16 -0700] GET /app/audio/download/abc.html HTTP/1.1 404
1135 - Mozilla/5.0 (Windows; U; Windows NT 6.0; en-GB; rv:1.9.0.9)
Gecko/2009040821 Firefox/3.0.9 (.NET CLR 3.5.30729)

*the error log(mysite.com_error_log) of appache httpd says nothing, no issue
there*

when i tried this url
http://www.mysite.com:9080/app/audio/download/abc.html (tomcat is running on
9080)
i got the same error on browser*
Type* Status report
*message* */app/audio/download/abc.html*
*description* *The requested resource (/app/audio/download/abc.html) is not
available.* *
*

There are no errors in catalina.out(and this is the only file in logs dir of
Tomcat)




On Mon, Apr 27, 2009 at 6:57 PM, André Warnier a...@ice-sa.com wrote:


 Ravi,

 First :
  so basically if i try to access any thing with
  http://www.mysite.com/app/audio, it should be served from audio  dir in
  webapps which in turn audio dir from appache httpd.
 
  But its not working. :(
 
 its not working is not something that allows anyone to help you.
 HOW is it not working ? What do you do, what do you expect, and what are
 you getting as an error ?
 That means :
 - tell us what URL you are using in the browser
 - what error do you see in the browser ?
 - what error do you see in the Apache logfile ?
 - and what error do you see in the Tomcat logfile ?

 Then (old African proverb) : if you want to eat an elephant, you should do
 it a little bit at a time.

 In other words, simplify the problem if you can.

 Assuming that your Tomcat listens on port 8080 for example (you can see
 that in the conf/server.xml, Connector tags), try the following :
 - turn off Apache httpd
 - in the browser, enter the URL
 http://www.mysiste.com:8080/app/audio/download/abc.html
 (that goes to Tomcat directly, without going through Apache).
 What happens then ?
 Don't be afraid to add some details.




 Ravi Sharma wrote:

 Hi All,
 Please help me for this problem, i am not able to get to the root of the
 problem.

 My site have few open/free pages which can be accessed by anyone/guests
 and
 few only for registered users. So you can access those pages only by login
 to the site

 http://www.mysiste.com/audio/abc.html (anyone/guests can see this page)
 http://www.mysiste.com/audio/app/download/abc.html (only logged in user
 can
 see this page)

 I am using tomcat 5.5 and appache httpd server 2.2.

 the root of my site reside in appache httpd server
 so i have folder structure like
 mysite/public_html/audio
 mysite/public_html/app/audio/download

 in my httpd conf i have something like this
 JkMount /app/audio/download/* ajp13w
 ..
 ..
 ..
 and mysite.com is poiniting to mysite/public_html


 *app* is my tomcat application context

 and in tomcat web.xml one Filter is listning to url
 filter
filter-nameDownLoadSecurityFilter/filter-name
filter-classcom.app.security.SecurityFilter/filter-class
/filter
filter-mapping
filter-nameDownLoadSecurityFilter/filter-name
url-pattern/audio/download/*/url-pattern
/filter-mapping

 So all the pages will be served by apache httpd except the pages which are
 like app/audio/download.

 So now when somone try to access app/audio/download/some.html the request
 passed to tomcat, in turns filter check this url and if user is not logged
 in then login screen comes up.
 User login and proceed and login screen automcatically forward the request
 to the page which was requested app/audio/download/some.html, but here i
 get
 this tomcat error

 *Type* Status report

 *message* */app/audio/download/some.html*

 *description* *The requested resource (/app/audio/download/some.html) is
 not
 available.*

 these html pages are static pages and exists in apache http home dir of
 websites
 public_html/app/audio/download/some.html

 but then i thought may be it need to exists in tomcat web apps too., so
 under web-apps/app dir i created audio link to audio directory under
 public_html

 so now webapps dir has following link
 webapps/app/audio - /home/mysite/public_html/audio

 so basically if i try to access any thing with
 http://www.mysite.com/app/audio, it should be served from audio  dir in
 webapps which in turn audio dir from appache httpd.

 But its not working. :(

 I dont know whats wrong.

 following is my java filter class

public void doFilter(ServletRequest request, ServletResponse response,
 FilterChain chain)
throws IOException, ServletException {
try
{
checkSecurity(request);
}
catch(UserNotLoggedIn ex

Re: Restarting Tomcat from Ant

2009-04-02 Thread Ravi Sharma
try sshexec task
http://ant.apache.org/manual/OptionalTasks/sshexec.html


On Thu, Apr 2, 2009 at 6:23 PM, Mighty Tornado mighty.torn...@gmail.comwrote:

 Hi,
 I currently copy the Application files to CATALINA_HOME/webapps from Ant,
 and then run shutdown and startup. Is there a way to also restart the
 server
 from Ant?

 Thanks,



Re: Servlet Memory Leak

2008-08-29 Thread Ravi Sharma
try this
http://java.sun.com/j2se/1.5.0/docs/tooldocs/index.html


On Fri, Aug 29, 2008 at 6:56 PM, Pierre Goupil [EMAIL PROTECTED]wrote:

 Hello,

 Interesting thread, indeed. But I've googled around and can't find JMap
 homepage, I'm afraid.  It seems like some other programs has the same name.
 Even with the profiler keyword, it doesn't give the page I'm looking for.

 A clue, anyone, please ?

 Cheers,

 Pierre


 On Fri, Aug 29, 2008 at 7:38 PM, Martin Gainty [EMAIL PROTECTED]
 wrote:

 
  FYI
  you'll need to run JDK 6 for jmap
 
  Martin
  __
  Disclaimer and confidentiality note
  Everything in this e-mail and any attachments relates to the official
  business of Sender. This transmission is of a confidential nature and
 Sender
  does not endorse distribution to any party other than intended recipient.
  Sender does not necessarily endorse content contained within this
  transmission.
 
 
   Date: Fri, 29 Aug 2008 09:44:41 -0700
   From: [EMAIL PROTECTED]
   To: users@tomcat.apache.org
   Subject: Re: Servlet Memory Leak
  
   
I have a fairly small memory leak in a servlet (Tomcat 6.0) running
 on
  a
Windows 2003 server. I have been looking into memory profiling to
 help
  me
find the leak but nothing seems to be or do what I need. Simply put I
  want a
list of all of the objects/primitives (and if possible their values)
  that
are in memory. It would be really nice if I didn't have to bring
 Tomcat
  down
at all to do this analysis as the servlet is running in a production
environment. Does anyone know of a decent free tool that does such a
  thing?
If not, what would be a good route to take to find this leak?
   
Thanks a ton.
   
   I just finished debugging a major memory leak in my servlet
 application.
   Try running the tool jmap that comes with java. It works great with
   Tomcat - just find the PID of the Tomcat (java) instance and run it on
  that.
  
   For example, fire up Windows Task Manager, go to Applications and find
   Tomcat. Right-click and choose go to process. This will move you to
   the Process pane highlighting the Tomcat (java) process ID.
  
   Now open a command (console) window and (assuming you have Java paths
   set correctly), type:
  
   jmap -histo PID output.txt
  
   (or  output.txt - although I used sequentially numbered output files)
  
   This will capture the stack info into a file for analysis. The PID is
   the process ID you noted from the Task Manager. If you run this just
   after you start Tomcat, then a few times after doing the things that
 you
   suspect trigger the memory leak, you should see objects in the map that
   you can identify as not getting released and thus zero in on the leak.
  
   Cheers,
  
   -Richard
  
   -
   To start a new topic, e-mail: users@tomcat.apache.org
   To unsubscribe, e-mail: [EMAIL PROTECTED]
   For additional commands, e-mail: [EMAIL PROTECTED]
  
 
  _
  Be the filmmaker you always wanted to be—learn how to burn a DVD with
  Windows(R).
  http://clk.atdmt.com/MRT/go/108588797/direct/01/



Redirection

2008-08-15 Thread Ravi Sharma
Hi,
I have the following scenerio.
I have a site which provide music online. Now for hosting the actual song i
have purchased another site with better band widthm but no tomcat.
So my webserver(tomcat) is running on one server(say domain1) and files are
hosted on another (with different domain name say domain2, which anyone can
access using http).

Now i have to put http://domain2/abc.music on my site to access these files.
Now i can do something like that write a normal Servlet which receive song
id and i forward it to appropriate link(http link to another site domain2).
but when someone start downloading they see that data is coming from
domain2, i dont want user to see domain2, and also i can not do somethin
like when user request any file first get it on to domain1 server and then
provide it to user as it will be too much bandwidth wastage.

So is there any way to do this using anything in apache,tomcat to hide
domain2 from everyone.,

Thanks,
Ravi.


Re: configure tomcat

2008-08-03 Thread Ravi Sharma
i guess u need to write localhost*:*8080 and not localhost*/*8080(See
the   :   and /  , and if its typo then may be some other problem)

Ravi.
On Sun, Aug 3, 2008 at 4:21 PM, Nadun Herath [EMAIL PROTECTED] wrote:

 Thanks a lot Alessandro
 When I type that command.
 this appeared

 tcp6   0  0 :::8080 :::*

 It seems tomcat working well isn't it.? What is wrong.
 Thanks again.

 On Sun, Aug 3, 2008 at 7:43 PM, Alessandro Ferrucci 
 [EMAIL PROTECTED] wrote:

  Make sure none of the ports specified in conf/server.xml are being used.
  You can check this by running
 
  netstat -na | grep port
 
  if nothing comes up then the port is free.
 
  --
  Signed,
  Alessandro Ferrucci
 
 
  On Sun, Aug 3, 2008 at 10:07 AM, Nadun Herath [EMAIL PROTECTED]
  wrote:
 
   I am a newbie to tomcat. I installed it ubuntu
  
   added the following line to bashrc file
  
   export
  
 
 CLASSPATH=/usr/local/tomcat/common/lib/jsp-api.jar:/usr/local/tomcat/common/lib/servlet-api.jar
  
  
   When I run startup.sh it runs ok. Giving this message
  
   Using CATALINA_BASE:   /usr/local/tomcat
   Using CATALINA_HOME:   /usr/local/tomcat
   Using CATALINA_TMPDIR: /usr/local/tomcat/temp
   Using JRE_HOME:   /usr/lib/jvm/java-6-sun
  
   But when I type localhost/8080 it says can't connect. What is the
  problem.
   Please help. I thank you in advance.
  
 



Re: receiving 404 page not found from godaddy.com

2008-07-30 Thread Ravi Sharma
Hi
   I have tried godaddy's Shared hosting and i had the sme problem and they
gave me the same answer that upgrade to dedicated server, so then i though i
will try something. first of all they are still using tomcat 4.4.x something
and java 1.4(or may be 1.3 i dont remember properly), so first create that
environment on ur pc and test it an then upload it. i was able to run
index.jsp which was just pure jsp, but my other pages didnt work as i was
using Spring framework they were giving the same error page not found, and
reason is that because of old java version they are not able to support
spring framework. So i had to leave the godaddy Shared hosting and when i
did RD for dedicated servers, again i landed buying Godaddy's virtual
dedictaed Server(they were better then other provider in terms of money as
well as the server configuration they were providing). Now i am quite happy
with it.
Best of luck with godaddy's shared hosting deployment and stupid Technical
support on it.
Thanks,
Ravi.

On Tue, Jul 29, 2008 at 3:44 PM, jim stone [EMAIL PROTECTED] wrote:


 I have a small jsp application which I packaged as a war file and deployed
 to
 my godaddy user account. The war exploded as expected. In my webapp, under
 the newly exploded context root, I am able to hit the html files, however,
 the jsp's are giving me a 404 not found. I have tested this locally using
 tomcat 5.5 and it works like a charm. I've contacted godaddy.com to find
 out
 what may be the reason for the 404 error and all the rep said was that my
 account is not showing any errors and that's all he could do for me. He
 said
 they could not help with deployment issues.  If I wanted better
 diagnostics,
 I needed to upgrade to a dedicated server. I do have java/jsp enabled for
 the site so it should work. I chose to deploy as a war because it's much
 easier to deploy, however, I'm wondering if I should deploy the file
 individually. Has anyone had this same experience with deploying war files
 to godaddy.com. I'm considering using another host as I've had nothing but
 problems with this company.
 --
 View this message in context:
 http://www.nabble.com/receiving-404-page-not-found-from-godaddy.com-tp18712493p18712493.html
 Sent from the Tomcat - User mailing list archive at Nabble.com.


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




Re: Multiple websites in tomcat

2008-07-23 Thread Ravi Sharma
changed the worker.properties and restarted. but didnt work :(

also tried editing the file c:\windows\system32\drivers\

 etc\hosts and the accessed the url but didnt work  and it is accessing
 the right server


i dont know why JK.log is saying *no URI mapping found* when we are giving
JkMount option.
I have refreshed the logs on log.html page

Can we do the same with VirtualHost thing in httpd file.?

Please help.



On Wed, Jul 23, 2008 at 12:00 AM, André Warnier [EMAIL PROTECTED] wrote:

 For some reason, this thing does not seem to want to let you go through
 port 8009 (or 8010), or it refuses to redirect these URLs.
 Could you refresh the copy of jk.log accessible through the web page, and
 your new httpd.conf ?

 By the way, I can see your Tomcat examples pages also when I connect to
 port 9080, and I also see the Not Found when I try with port 80.

 Make one more change to workers.properties :

 #worker.list=wlb,jkstatus
 worker.list=ajp13w

 Restart Apache and try again.

 If that does not work, I have one more thing to try :
 I assume you are accessing this server from a Windows workstation.
 If yes, then do the following :
 - in a command window, do
 ping www.jaatmusic.com
 and note the IP address.
 - edit the file c:\windows\system32\drivers\etc\hosts and add the following
 line :
 xxx.xxx.xxx.xxx  jaatmusic
 (where xxx.xxx.xxx.xxx is the IP address you noted earlier)
 - save the hosts file
 - close and re-open your browser (important, to force it to re-read the
 hosts file)
 - try the following URL :
 http://jaatmusic/servlets-examples

 Do you still get the Not Found ?

 (By the above, I am trying to see if we are really accessing the server we
 think we are accessing).


 Ravi Sharma wrote:

  STEP 1 :

 [...]



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




Re: Multiple websites in tomcat

2008-07-22 Thread Ravi Sharma
 STEP 1 :
Stop Tomcat and Apache
Go back to the original configuration files.
Really.  Forget your changes for now. Put back
- the original Tomcat server.xml
- the original Apache httpd.conf
- the original workers.properties
[...]
Stoped the tomcat and Apache
Restored all these files which i changed. server.xml,
httpd.conf,workers.propertires

STEP 2 :
At the end of the original http.conf, add these lines :
JkLogFile /etc/httpd/logs/jk.log
JkLogLevel debug
JkMount /servlets-examples ajp13w
JkMount /servlet-examples/* ajp13w

(note the change of the URLs and the change of the worker name, to match
the existing worker name in workers.properties)

[...]
Added these four lines with s at the end of servlet, no type mistake.

STEP 3 :
Restart Tomcat and Apache, and wait 30 sec.

[...]
Restarted tomcat and Apache, first started tomcat and the apache
waited for 30 seconds.

STEP 4 :
Try :
a) http://www.jaatmusic.com:9080/servlets-examples
b) 
http://www.jaatmusic.com:80/servlets-exampleshttp://www.jaatmusic.com/servlets-examples

Both URLs should give you the same result.


With (a), you access Tomcat directly, through its HTTP connector at port
9080.
With (b), you access Tomcat through Apache (at port 80), the Apache
mod_jk module, and the Tomcat AJP13 Connector.

URL (a) is working fine.
but URL (b) gave the page not found error.

On Mozilla
Not Found

The requested URL /servlets-examples was not found on this server.
--
Apache/2.2.3 (CentOS) Server at www.jaatmusic.com Port 80



Let me know...
And then, we can start making changes again to get the ports you really
want etc..


Thanks,
Ravi.


On Tue, Jul 22, 2008 at 9:33 PM, André Warnier [EMAIL PROTECTED] wrote:

 Sorry, there is a typo in my previous message :
 The JkMount lines should be :
 JkMount /servlets-examples ajp13w
 JkMount /servlets-examples/* ajp13w

 (I forgot an s in the second one)



 Ravi Sharma wrote:

 Hi Andre,
   Thanks for reply and sorry for my incomplete reply.
 So here is what i have done now.
 First i have reinstalled everything again,So i have fresh environment with
 apache (version 2.2.3) and tomcat (version 5.5).
 JK module(1.2.26 ) is already installed in apache, so i don't need to get
 it
 from anywhere.

  Allright ! That was a very good idea.
 Now we have a chance to start from a clean situation.

 [...]


 You can access following files from this url
 http://www.jaatmusic.com/log.html
 httpd.conf
 server.xml
 worker.properties
 jk.conf which is being included in httpd.conf by using this line Include
 conf.d/*.conf
 from this url

  I looked at this.  That was also a good idea for now.
 So,

 STEP 1 :
 Stop Tomcat and Apache
 Go back to the original configuration files.
 Really.  Forget your changes for now. Put back
 - the original Tomcat server.xml
 - the original Apache httpd.conf
 - the original workers.properties

 STEP 2 :
 At the end of the original http.conf, add these lines :
 JkLogFile /etc/httpd/logs/jk.log
 JkLogLevel debug
 JkMount /servlets-examples ajp13w
 JkMount /servlet-examples/* ajp13w

 (note the change of the URLs and the change of the worker name, to match
 the existing worker name in workers.properties)

 STEP 3 :
 Restart Tomcat and Apache, and wait 30 sec.

 STEP 4 :
 Try :
 a) http://www.jaatmusic.com:9080/servlets-examples
 b) http://www.jaatmusic.com:80/servlets-examples

 Both URLs should give you the same result.

 With (a), you access Tomcat directly, through its HTTP connector at port
 9080.
 With (b), you access Tomcat through Apache (at port 80), the Apache
 mod_jk module, and the Tomcat AJP13 Connector.

 Let me know...
 And then, we can start making changes again to get the ports you really
 want etc..

 André




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




Re: Multiple websites in tomcat

2008-07-21 Thread Ravi Sharma
Hi Andre,
   Thanks for reply and sorry for my incomplete reply.
So here is what i have done now.
First i have reinstalled everything again,So i have fresh environment with
apache (version 2.2.3) and tomcat (version 5.5).
JK module(1.2.26 ) is already installed in apache, so i don't need to get it
from anywhere.

Step 1) I changed the server.xml file to include two connector one which you
provided and another for AJP connector as follows
The red color one was already there in server.xml after fresh installation,
even i was wondering why class name is not there, but i assumed that, may be
tomcat give some default class name. Any ways without class name port 9080
is working.

 Connector port=9080 maxHttpHeaderSize=8192
   maxThreads=150 minSpareThreads=25 maxSpareThreads=75
   enableLookups=false redirectPort=9443 acceptCount=100
   connectionTimeout=2 disableUploadTimeout=true /

Connector className=org.apache.coyote.tomcat4.CoyoteConnector
  port=*8180* minProcessors=5 maxProcessors=75
  enableLookups=true acceptCount=10 debug=0
  connectionTimeout=2 useURIValidationHack=false /

Connector className=org.apache.ajp.tomcat4.Ajp13Connector
port=*8010* minProcessors=5 maxProcessors=75
acceptCount=10 debug=0/

*Step 2*: Restarted tomcat.
restarted fine

*Step 3:*
Ran following commands
 netstat -an | grep 9080
tcp0  0 0.0.0.0:90800.0.0.0:*
LISTEN
 netstat -an | grep 8010
tcp0  0 0.0.0.0:80100.0.0.0:*
LISTEN
  netstat -an | grep 8180
tcp0  0 0.0.0.0:81800.0.0.0:*
LISTEN

and also checked the following url
http://www.jaatmusic.com:9080 (showing tomcat starting page)
http://www.jaatmusic.com:8010 (showing tomcat starting page)
http://www.jaatmusic.com:8180 (showing tomcat starting page)

*Step 4:*

accesed url
http://www.jaatmusic.com:9080/servlets-examples
and http://www.jaatmusic.com:8010/servlets-examples
and http://www.jaatmusic.com:8180/servlets-examples

all showing the same page which has links to different servlets.Means
working fine.

Clicked on HelloWorld link whose url on different ports are
http://www.jaatmusic.com:9080/servlets-examples/servlet/HelloWorldExample
http://www.jaatmusic.com:8010/servlets-examples/servlet/HelloWorldExample
http://www.jaatmusic.com:8180/servlets-examples/servlet/HelloWorldExample

All ran fine and showed me the correct output

*Step 5:* Checking the AJP port 8010
 netstat -an | grep 8010
tcp0  0 0.0.0.0:80100.0.0.0:*
LISTEN

and also telnet www.jaatmusic.com 8010 worked fine, i did get the
connection.
i typed something and closed the connection but didnt get anything exactly
like this in tomcat log
2008-07-21 00:29:44 Ajp13Processor[8010][5] [Ajp13] incomplete read, waited
#-1 got only 0

but i do have something like this in tomcat log
Jul 21, 2008 10:59:28 PM org.apache.jk.common.MsgAjp processHeader
SEVERE: BAD packet signature 14961
Jul 21, 2008 11:00:19 PM org.apache.jk.common.ChannelSocket receive
WARNING: can't read body, waited #3338
Jul 21, 2008 11:00:19 PM org.apache.jk.common.ChannelSocket
processConnection
WARNING: Closing ajp connection -1

*Step 6:* Updated the workers.properties to include these three lines

worker.tempWorker.type=ajp13
worker.tempWorker.host=localhost
worker.tempWorker.port=8010

and also updated this line
worker.list=wlb,jkstatus,*tempWorker*
# wlb and jkstatus was already there.


*Step 7* : now i updated the httpd.conf file with following lines

JkLogFile /etc/httpd/logs/jk.log
JkLogLevel debug
JkMount /examples testWorker
JkMount /examples/* testWorker

Restarted apache. it restarted fine.
**
*Step 8 :*
Finally i entered this url
http://www.jaatmusic.com/examples (nothing came up)
*IE said  *
HTTP 404 Page Not found, the web page can not be found.
*Mozilla said : *
Not Found

The requested URL /examples was not found on this server.
--
Apache/2.2.3 (CentOS) Server at www.jaatmusic.com Port 80


Then i tried
http://www.jaatmusic.com/examples/servlet/HelloWorldExample

*IE said*
HTTP 404 Page Not found, the web page can not be found.
*Mozilla said*
Not Found

The requested URL /examples/servlet/HelloWorldExample was not found on this
server.
--
Apache/2.2.3 (CentOS) Server at www.jaatmusic.com Port 80


You can access following files from this url
http://www.jaatmusic.com/log.html
httpd.conf
server.xml
worker.properties
jk.conf which is being included in httpd.conf by using this line Include
conf.d/*.conf
from this url


i have tried many other things too but it didnt work, so right now the
server setup is as what is written here.

Thanks a lot in advance

Ravi.


Re: Multiple websites in tomcat

2008-07-20 Thread Ravi Sharma
Thanks Andre.
I fixed the file and now my code looks like as follows but still my servlets
are not being called. Basically apache is not passing requests to tomcat,
only Alias is working but not JkMount

*So now my worker's file looks like this, i  added testWorker*

worker.list=wlb,jkstatus,testWorker

worker.testWorker.type=ajp13
worker.testWorker.host=localhost
worker.testWorker.port=8009

worker.ajp13w.type=ajp13
worker.ajp13w.host=localhost
worker.ajp13w.port=8010

worker.wlb.type=lb
worker.wlb.balance_workers=ajp13w

worker.jkstatus.type=status

*My Server.xml of Tomcat looks like this*

Connector className=org.apache.ajp.tomcat4.Ajp13Connector
port=8009 minProcessors=5 maxProcessors=75
acceptCount=10 debug=0/

*jk.conf loks like this(its in conf.d dir)
*
LoadModule jk_module modules/mod_jk.so

JkWorkersFile /etc/httpd/conf/workers.properties


*and httpd.conf looks like this

*
Include conf.d/*.conf


JkLogFile libexec/mod_jk.log
JkLogLevel debug
Alias /ex /usr/java/tomcat-5.5/webapps/servlets-examples
JkMount /ex/servlet/* testWorker
JkMount /temp/*.jsp testWorker
Location /usr/java/tomcat-5.5/webapps/examples/WEB-INF/
AllowOverride None
deny from all
/Location

*Still a Problem*

When i access www.jaatmusic.com/ex  http://www.jaatmusic.com/ex(try this
link please), it shows me the index page of my application(servlet-example)
which is a index.html page.So this step work fine. That means it usage the
Alias thing(Alias /ex /usr/java/tomcat-5.5/webapps/servlets-examples)
Now from this page there are links to invoke some servlet examples
http://www.jaatmusic.com/ex/servlet/HelloWorldExample, this link doesn't
work. As per my understanding it should have worked because of this
line - *JkMount
/ex/servlet/* testWorker*

When i access above link i got follwoing in apache log files
*file not exists usr/java/tomcat-5.5/webapps/servlets-examples/servlet,
referer: http://www.jaatmusic.com/ex/
*
and jk mod log says
* missing uri map for jaatmusic.com:/ex/servlet/HelloWorldExample*
but i have defined it *JkMount /ex/servlet/* testWorker

*and there is no log in tomcat as tomcat has not been hit.

i dont know what i am missing everything seems to be ok now but still not
working

also in my web.xml servlet is defined like this

servlet
servlet-nameHelloWorldExample/servlet-name
servlet-classHelloWorldExample/servlet-class
/servlet
servlet-mapping
servlet-nameHelloWorldExample/servlet-name
url-pattern*/servlet/HelloWorldExample*/url-pattern
/servlet-mapping

Please help.

Thanks,
Ravi.

On Sat, Jul 19, 2008 at 8:25 PM, André Warnier [EMAIL PROTECTED] wrote:

 Ravi Sharma wrote:
 [...]

 I'm not as competent as Rainer, but your problem may be here :


 worker.list=wlb,jkstatus,testWorker


 and here

  worker.ajp13w.type=ajp13
 worker.ajp13w.host=localhost
 worker.ajp13w.port=8009


 In other words, in the workers list, you are mentioning the worker
 testWorker, but in the following worker.* lines, you don't mention
 testWorker, but ajp13w.

 Maybe you want to change these 3 lines to
  worker.testWorker.type=ajp13
  worker.testWorker.host=localhost
  worker.testWorker.port=8009
 and try again ?


 Personally, I would also change this :

  Location /examples/WEB-INF/
 AllowOverride None
 deny from all
 /Location

  to this :

 Directory /var/www/xyz/examples/WEB-INF (*)
  Order allow,deny
  deny from all
 /Directory

 (*) replace this by the real disk path to WEB-INF

 the reason being that, if you are under Windows e.g., someone requesting
 the URI /examples/web-inf would get to the directory, because it does not
 match exactly the Location, and for Windows the directory path is
 case-insensitive, so Apache will serve it.
 See here :
 http://httpd.apache.org/docs/2.2/mod/core.html#location



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




Re: Multiple websites in tomcat

2008-07-20 Thread Ravi Sharma
ya thats true propblems gives u more knowledge..but this one is killing me
:)
i have removed the alias line too. now none of the link is working
:(
I dont know whats wrong

now httpd.conf has only this line

JkMount /ex/servlet/HelloWorldExample testWorker.

I really dont know what i am missing...
please help.

On Sun, Jul 20, 2008 at 2:44 PM, André Warnier [EMAIL PROTECTED] wrote:

 The good news is that you will learn more by encountering problems and
 solving them, than if everything worked correctly on the first pass.

 Ravi Sharma wrote:
 [...]

  Alias /ex /usr/java/tomcat-5.5/webapps/servlets-examples
 JkMount /ex/servlet/* testWorker


 I think that the two lines above conflict with eachother :

 First you are telling Apache that if it sees /ex in a URI, it should
 translate it to /usr/java/tomcat-5.5/webapps/servlets-examples.
 Then you are telling Apache that if it sees a URI like /ex/servlet/*, it
 should pass it to mod_jk (which will pass it to Tomcat).

 Here is my guess as to what happens, step by step :

 You send the following request to Apache :
 /ex/servlet/HelloWorldExample

 Because of the Alias, Apache will first translate this to the file
 location
 /usr/java/tomcat-5.5/webapps/servlets-examples/HelloWorldExample

 Then Apache will try to find a handler for that location.
 Because mod_jk is installed, Apache will ask mod_jk if it is interested in
 this URI.

 mod_jk will say no, because the above translated URI does not match
 /ex/servlet/* in the JkMount.  So mod_jk will return DECLINED to Apache.

 Then Apache will ask other possible handlers, and if nobody else wants this
 URI, then Apache will select its own default handler (the one which just
 returns local files).

 This default handler will try to find the file
 /usr/java/tomcat-5.5/webapps/servlets-examples/HelloWorldExample
 and will not find it. So it will return an error.

 The point is that an Alias happens earlier in the cycle of processing the
 request (the URI translation step), and the content generation step
 happens later.  mod_jk (and Tomcat) are involved in the content-generation
 phase.  But by the time mod_jk is getting asked if it wants to generate the
 content, the URI is already tanslated, and mod_jk does not recognise it.

 In short, for a test of the above, comment out the Alias line, restart
 Apache, and try again the URL
 http://www.jaatmusic.com/ex/servlet/HelloWorldExample

 Of course, with the above change, your first URL
 http://www.jaatmusic.com/ex
 will probably not work anymore, but that is normal and we will see that
 next.


 For a bit more more information on the order in which the various request
 processing steps happen in Apache, read through this :
 http://httpd.apache.org/docs/2.2/developer/request.html
 For the same with pictures, try this :
 http://www.apachetutor.org/dev/request


 André



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




Re: Multiple websites in tomcat

2008-07-20 Thread Ravi Sharma
 :
 2008-07-21 00:29:44 Ajp13Processor[8010][5] [Ajp13] incomplete read, waited
 #-1 got only 0
 )

 If all the above is ok, then Tomcat should be fine, and we can go back and
 check the Apache side.

 7) replace your JkMount line in Apache by these 2 lines :
 JkMount /examples testWorker
 JkMount /examples/* testWorker
 and restart Apache

 8) enter
 http://www.jaatmusic.com/examples
 (notice that this time you are *not* entering the port , because you
 want to connect through Apache, not go directly to Tomcat).
 Do you see the same Tomcat examples menu page as before ?
 If not, what do you see ? an error page of Apache, or one of Tomcat ?

 André




 Ravi Sharma wrote:

 ya thats true propblems gives u more knowledge..but this one is killing me
 :)
 i have removed the alias line too. now none of the link is working
 :(
 I dont know whats wrong

 now httpd.conf has only this line

 JkMount /ex/servlet/HelloWorldExample testWorker.

 I really dont know what i am missing...
 please help.

 On Sun, Jul 20, 2008 at 2:44 PM, André Warnier [EMAIL PROTECTED] wrote:

  The good news is that you will learn more by encountering problems and
 solving them, than if everything worked correctly on the first pass.

 Ravi Sharma wrote:
 [...]

  Alias /ex /usr/java/tomcat-5.5/webapps/servlets-examples

 JkMount /ex/servlet/* testWorker

  I think that the two lines above conflict with eachother :

 First you are telling Apache that if it sees /ex in a URI, it should
 translate it to /usr/java/tomcat-5.5/webapps/servlets-examples.
 Then you are telling Apache that if it sees a URI like /ex/servlet/*,
 it
 should pass it to mod_jk (which will pass it to Tomcat).

 Here is my guess as to what happens, step by step :

 You send the following request to Apache :
 /ex/servlet/HelloWorldExample

 Because of the Alias, Apache will first translate this to the file
 location
 /usr/java/tomcat-5.5/webapps/servlets-examples/HelloWorldExample

 Then Apache will try to find a handler for that location.
 Because mod_jk is installed, Apache will ask mod_jk if it is interested
 in
 this URI.

 mod_jk will say no, because the above translated URI does not match
 /ex/servlet/* in the JkMount.  So mod_jk will return DECLINED to
 Apache.

 Then Apache will ask other possible handlers, and if nobody else wants
 this
 URI, then Apache will select its own default handler (the one which just
 returns local files).

 This default handler will try to find the file
 /usr/java/tomcat-5.5/webapps/servlets-examples/HelloWorldExample
 and will not find it. So it will return an error.

 The point is that an Alias happens earlier in the cycle of processing
 the
 request (the URI translation step), and the content generation step
 happens later.  mod_jk (and Tomcat) are involved in the
 content-generation
 phase.  But by the time mod_jk is getting asked if it wants to generate
 the
 content, the URI is already tanslated, and mod_jk does not recognise it.

 In short, for a test of the above, comment out the Alias line, restart
 Apache, and try again the URL
 http://www.jaatmusic.com/ex/servlet/HelloWorldExample

 Of course, with the above change, your first URL
 http://www.jaatmusic.com/ex
 will probably not work anymore, but that is normal and we will see that
 next.


 For a bit more more information on the order in which the various request
 processing steps happen in Apache, read through this :
 http://httpd.apache.org/docs/2.2/developer/request.html
 For the same with pictures, try this :
 http://www.apachetutor.org/dev/request


 André



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





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




Re: Multiple websites in tomcat

2008-07-19 Thread Ravi Sharma
Hi,
   I have a server running apache on port 80, and tomcat on 9080. Now apache
has setting that when i enter my domain www.mydomain.com, it point sto a
particular directoty on my server and shows the index.html from that dir.
And now i have created one java application which i want to use for that
site. But tomcat is running on 9080, so i need to enter
www.mydomain.com:9080, and i dont want that.i want to access my java
application using www.mydomain.com. Can you tell me how can i do that.

Thanks,
Ravi.


Re: Multiple websites in tomcat

2008-07-19 Thread Ravi Sharma
Thanks a lot Gabe,
 Now i have very small problem. I have configured as per the follwoing
link
but when i restarting apache after changing the httpd.conf it gives error
for this line

JkWorkersFile /etc/httpd/conf/workers.properties

Syntax error on line 992 of /etc/httpd/conf/httpd.conf:
JkWorkersFile only allowed once


I added follwoing code to httpd.conf

LoadModule jk_module libexec/mod_jk-1.2.23-apache-2.2.x-linux-i686.so
JkWorkersFile /usr/java/tomcat-5.5/conf/workers.properties
JkLogFile libexec/mod_jk.log
JkLogLevel debug
Alias /temp /usr/java/tomcat-5.5/webapps/tomcat-docs
JkMount /temp/servlet/* testWorker
JkMount /temp/*.jsp testWorker
Location /temp/WEB-INF/
AllowOverride None
deny from all
/Location


i checked its defined only once in this file.
Am i doing something wrong.?

thanks in advance

Ravi.

On Sat, Jul 19, 2008 at 4:39 PM, Gabe Wong [EMAIL PROTECTED] wrote:

 Hi Ravi,
 You need to proxy Tomcat with Apache by using mod_jk or mod_proxy
 (preferred)
 Some pertinent links:
 http://tomcat.apache.org/connectors-doc/webserver_howto/apache.html
 http://marc.info/?l=tomcat-userm=121286145508630w=2


 Ravi Sharma wrote:

 Hi,
   I have a server running apache on port 80, and tomcat on 9080. Now
 apache
 has setting that when i enter my domain www.mydomain.com, it point sto a
 particular directoty on my server and shows the index.html from that dir.
 And now i have created one java application which i want to use for that
 site. But tomcat is running on 9080, so i need to enter
 www.mydomain.com:9080, and i dont want that.i want to access my java
 application using www.mydomain.com. Can you tell me how can i do that.

 Thanks,
 Ravi.





 --
 Regards

 Gabe Wong
 NGASI AppServer Manager
 JAVA AUTOMATION and SaaS Enablement for Cloud Computing
 http://www.ngasi.com
 NEW! FREE Developer account for Hosted version on Amazon EC2


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




Re: Multiple websites in tomcat

2008-07-19 Thread Ravi Sharma
its two times only in the mail. i was just explaining it. In actual
httpd.conf its only once.


On Sat, Jul 19, 2008 at 5:12 PM, Rainer Jung [EMAIL PROTECTED]
wrote:

 Ravi Sharma schrieb:

 Thanks a lot Gabe,
 Now i have very small problem. I have configured as per the follwoing
 link
 but when i restarting apache after changing the httpd.conf it gives error
 for this line

 JkWorkersFile /etc/httpd/conf/workers.properties


 Once ...

  Syntax error on line 992 of /etc/httpd/conf/httpd.conf:
 JkWorkersFile only allowed once


 I added follwoing code to httpd.conf

 LoadModule jk_module libexec/mod_jk-1.2.23-apache-2.2.x-linux-i686.so
 JkWorkersFile /usr/java/tomcat-5.5/conf/workers.properties


 Twice !

  JkLogFile libexec/mod_jk.log
 JkLogLevel debug
 Alias /temp /usr/java/tomcat-5.5/webapps/tomcat-docs
 JkMount /temp/servlet/* testWorker
 JkMount /temp/*.jsp testWorker
 Location /temp/WEB-INF/
 AllowOverride None
 deny from all
 /Location


 i checked its defined only once in this file.
 Am i doing something wrong.?


 Regards,

 Rainer


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




Re: Multiple websites in tomcat

2008-07-19 Thread Ravi Sharma
Hi Rainer,
Thanks, i checked in included files and found that it was already
declared in one of included conf file. Thanks for pointing me that.Now i
have corrected  it and server is starting properly with following warnings
which i am skipping as of now.
[Sat Jul 19 10:59:41 2008] [warn] module jk_module is already loaded,
skipping
[Sat Jul 19 10:59:41 2008] [warn] Useless use of AllowOverride in line 1000.

The only propblem is that servlet is not being called.


*So now my worker's file looks like this, i  added testWorker*

worker.list=wlb,jkstatus,testWorker
worker.ajp13w.type=ajp13
worker.ajp13w.host=localhost
worker.ajp13w.port=8009

*My Server.xml of Tomcat looks like this*

Connector className=org.apache.ajp.tomcat4.Ajp13Connector
port=8009 minProcessors=5 maxProcessors=75
acceptCount=10 debug=0/


*and httpd.conf looks like this

*LoadModule jk_module libexec/mod_jk-1.2.26-httpd-2.2.6.so
#AddModule mod_jk.c
#JkWorkersFile /usr/java/tomcat-5.5/conf/workers.properties
JkLogFile libexec/mod_jk.log
JkLogLevel debug
Alias /ex /usr/java/tomcat-5.5/webapps/servlets-examples
JkMount /ex/servlet/* testWorker
JkMount /temp/*.jsp testWorker
Location /examples/WEB-INF/
AllowOverride None
deny from all
/Location

*Now Problem*

When i access www.jaatmusic.com/ex(try this link please), it shows me the
index page of my application(servlet-example) which is a html page.So this
step work fine. That means it usage the Alias thing(Alias /ex
/usr/java/tomcat-5.5/webapps/servlets-examples)
Now from this page there are links to invoke some servlet examples
http://www.jaatmusic.com/ex/servlet/HelloWorldExample, this link doesn't
work. As per my understanding it should have worked because of this
line - *JkMount
/ex/servlet/* testWorker*
When i access above link i got follwoing in apache log files
*usr/java/tomcat-5.5/webapps/servlets-examples/servlet, referer:
http://www.jaatmusic.com/ex/
*

also in my web.xml servlet is defined like this

servlet
servlet-nameHelloWorldExample/servlet-name
servlet-classHelloWorldExample/servlet-class
/servlet
servlet-mapping
servlet-nameHelloWorldExample/servlet-name
url-pattern*/servlet/HelloWorldExample*/url-pattern
/servlet-mapping


Thanks in adavance. I am almost on the edge of starting my first web
application, please help.

Ravi.