Re: Tomcat, ActiveMQ, 'jndi.properties' file problem

2006-06-02 Thread Hadraba Petr

Hi Maciej,

I'm connecting from Tomcat to ActiveMQ with this configuration:

META-INF/context.xml:
Context
...
  Resource
  name=jms/ConnectionFactory
  auth=Container
  type=org.apache.activemq.ActiveMQConnectionFactory
  description=JMS Connection Factory
  factory=org.apache.activemq.jndi.JNDIReferenceFactory
  brokerURL=tcp://ws:61616
  brokerName=localhost
  useEmbeddedBroker=false /
  Resource
  name=jms/Test
  auth=Container
  type=org.apache.activemq.command.ActiveMQQueue
  factory=org.apache.activemq.jndi.JNDIReferenceFactory
  physicalName=TEST /
...
/Context


WEB-INF/web.xml:
...
  resource-env-ref

resource-env-ref-namejms/ConnectionFactory/resource-env-ref-name

resource-env-ref-typejavax.jms.ConnectionFactory/resource-env-ref-type
  /resource-env-ref

  resource-env-ref
  resource-env-ref-namejms/Test/resource-env-ref-name
  resource-env-ref-typejavax.jms.Queue/resource-env-ref-type
  /resource-env-ref
...


Hope, it helps...

PETR


On 6/2/06, Maciej Łabędzki [EMAIL PROTECTED] wrote:

Hi,
i develope my web application using ActiveMQ and run it under Apache
Tomcat 5. There is a problem - the 'jndi.properties' file seems to be
invisible, although it is placed on class path.

Has anybody met such a problem?

Maciej



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





--
Petr Hadraba
graphic artist and software designer
http://people.hadraba-soft.com/~petr
hadrabap AT bluetone DOT cz


Re: Tomcat, ActiveMQ, 'jndi.properties' file problem

2006-06-02 Thread Hadraba Petr

Hi,

sorry, I forgot to note, that the resources in the context.xml and
web.xml files are replacements for the jndi.properties. I'm using
Tomcat's build-in JNDI.

It looks like you're using one Queue with the name listenerDestination.

So, try the following:
META-INF/context.xml:
Context
...
 Resource
 name=jms/ConnectionFactory
 auth=Container
 type=org.apache.activemq.ActiveMQConnectionFactory
 description=JMS Connection Factory
 factory=org.apache.activemq.jndi.JNDIReferenceFactory
 brokerURL=ssl://localhost:32450
 brokerName=localhost
 useEmbeddedBroker=false /
 Resource
 name=jms/listenerDestination
 auth=Container
 type=org.apache.activemq.command.ActiveMQQueue
 factory=org.apache.activemq.jndi.JNDIReferenceFactory
 physicalName=dms.PublicLogQueue /
...
/Context

WEB-INF/web.xml:
...
 resource-env-ref

resource-env-ref-namejms/ConnectionFactory/resource-env-ref-name

resource-env-ref-typejavax.jms.ConnectionFactory/resource-env-ref-type
 /resource-env-ref

 resource-env-ref
 
resource-env-ref-namejms/listenerDestination/resource-env-ref-name
 resource-env-ref-typejavax.jms.Queue/resource-env-ref-type
 /resource-env-ref
...


And in the code you can obtain the Destination using
 try {
  InitialContext ic = new InitialContext();
  Context ctx = (Context) ic.lookup(java:comp/env);

  ConnectionFactory cf = (ConnectionFactory)
ctx.lookup(jms/ConnectionFactory);
  Connection conn = (Connection) cf.createConnection();
  conn.start();

  Session s = conn.createSession(false,
Session.CLIENT_ACKNOWLEDGE);
  Destination d = (Destination)
ctx.lookup(jms/listenerDestination);

  MessageProducer mp = s.createProducer(d);
  mp.setDeliveryMode(DeliveryMode.PERSISTENT);

  TextMessage tm = s.createTextMessage();
  tm.setText(Foo);

  mp.send(tm);

  tm = s.createTextMessage();
  tm.setText(Bar);

  mp.send(tm);

  conn.close();
  } catch (Exception e) {
  e.printStackTrace();
  }
...


If you want to run ActiveMQ under Tomcat, not as standalone broker,
specify useEmbeddedBroker=true in the context.xml.

The Resource tags can be also placed in the server.xml, but I have bad
experience with JDBC resources there, so I didn't try it.


Try the configuration above. This must work for you!

PETR


On 6/2/06, Maciej Łabędzki [EMAIL PROTECTED] wrote:

Hadraba Petr napisał(a):
 Hi Maciej,

 I'm connecting from Tomcat to ActiveMQ with this configuration:

Thx, but how it corresponds to my jndi.properties file?
How should I form my configuration files (context.xml, web.xml)?
jndi.properties:
---
java.naming.factory.initial =
org.activemq.jndi.ActiveMQInitialContextFactory
brokerURL =ssl://localhost:32450
queue.listenerDestination = dms.PublicLogQueue


Maciej



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





--
Petr Hadraba
graphic artist and software designer
http://people.hadraba-soft.com/~petr
hadrabap AT bluetone DOT cz


Re: File deletion problem

2006-05-10 Thread Hadraba Petr

Hi vasu!

What files do you want to delete? The files your application is using?

If yes, maybe you forgot call f.close()... Maybe... My idea...

PETR


On 5/10/06, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote:


Setup:
  Tomcat - 5.0.28
   Java- 1.4.2
   OS   - Windows XP

Problem:

  Within my webapp there is a need to delete a file. When I try to delete the file 
sometimes it gives the message the file can not be deleted beacuse it is being used 
by another user or process. The only way to get out of this situation is - stop 
tomcat, delete file, and start tomcat. We do not see this message always - it seems 
pretty random. We tried to isolate it, but unsuccessful. Any thoughts/comments?

Thank You.
vasu

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





--
Petr Hadraba
graphic artist and software designer
http://people.hadraba-soft.com/~petr
hadrabap AT bluetone DOT cz


Re: Unable to get tomcat default page

2006-05-09 Thread Hadraba Petr

Hmm,

you are running Windows, don't you? Windows XP!

It looks like a firewall issue... Try to enable the port 8080 for
localhost---sorry, I'm not Windows Firewall expert...

Have a nice night

PETR


On 5/9/06, Java Newbee [EMAIL PROTECTED] wrote:

When i am not connected to internet, i get the default Apache
Tomcat homepage after succesfully starting the Tomcat server.
However, once i get my internet connections enabled, I am
unable to get the default Apache Tomcat home page.

I tried to change the port 8080 just incase it was being used
by some other application when i get connected to net. But it
doesnt solve my problem. Can anyone please help me. I am
new at java and tomcat and hence would request a detailed
solution to the problem.

Thanks in advance





--
Petr Hadraba
graphic artist and software designer
http://people.hadraba-soft.com/~petr
hadrabap AT bluetone DOT cz


Re: Plan to support Servlet 2.5 spec

2006-05-03 Thread Hadraba Petr

Yes!

Glassfish is cool;-)

Also most of the sources are available -- https://glassfish.dev.java.net

Glassfish is more strict then Tomcat; I'm using Glassfish for
debugging and testing.

PETR


On 5/3/06, Bernhard Slominski [EMAIL PROTECTED] wrote:

 -Ursprüngliche Nachricht-
 Von: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
 Gesendet: Mittwoch, 3. Mai 2006 13:06
 An: Tomcat Users List
 Betreff: Re: Plan to support Servlet 2.5 spec


 When can I start to download some development builds that I
 can use to
 try things out. I am particular interested in the resource
 injection stuff.


In this case I would recommend the glassfisch project from Sun, it
implements JEE5 (thus Servlet 2.5, JSP 2.1) already.
It's available at: http://java.sun.com/javaee/glassfish/

Bernhard

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





--
Petr Hadraba
graphic artist and software designer
http://people.hadraba-soft.com/~petr
hadrabap AT bluetone DOT cz


Re: Properties file problem

2006-04-21 Thread Hadraba Petr
Hi Vikas,

some details:

I see you're correctly using the getClass.getResource() (I'm using
getServletContext().getResourceAsStream() or
getServletContext().getResource()). But, Why are you creating
resources? You see all the war content in the host OS filesystem
because of unpackWars=true. This is because of performance (I hope)
and if you set this to false, Tomcat will *read* resources (also
classes and anything else) from the WAR file directly! You are mixing
two things together: one are resources (they are using URL instead of
File) and on the other side Host OS FileSystem (the File objects).

So, you store database connection parameters in the property file. I
see two options to solve your problem:
1. Move the property file outside the resources if you want dynamic
creation. For example: temporary directory, any other directory which
location can be hard-wired as initial parameter in the web.xml file.
2. Use Tomcat's database pooler. You give more performence (if you're
not using your own database connection pooler)!


Please explain what you want to do, what's your goal...

Have a nice day

PETR


On 4/21/06, VIKASS NAGPAL [EMAIL PROTECTED] wrote:
 Hi All,

 I have a problem here. I have Pproperties file.
 It has the following code:

 File f = new File(propertyFolder);

 if (!f.exists()) f.mkdir();

 f = new File(propertyFolder +
 System.getProperty(file.separator) +
 propertyFileName);

 if (!f.exists())
 {
 String s = ((this.getClass().getResource(/ +
 propertyFileName)).toString());

 File pf = new File(s.substring(6));

 This code creates a folder with the name
 propertiespaydir and file with the name
 pdr.properties. In order to connect to the database i
 have to read the Servername, Database name, Username
 and password from this file or creates a file with the
 name pdr.properties file. But If i rename this
 pdr.properties file to something else then my code
 does not create the file with the name pdr.properties.
 So I cannot connect to the database. So anyone of you
 knows what change should i make into my existing code
 in order for me to create the file with the name
 pdr.properties in case it does not exist. I would
 really be thankful for any help in this matter.

 Thanks,
 With regards,
 Vikas Nagpal.


 __
 Do You Yahoo!?
 Tired of spam?  Yahoo! Mail has the best spam protection around
 http://mail.yahoo.com

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




--
Petr Hadraba
graphic artist and software designer
http://people.hadraba-soft.com/~petr
hadrabap AT bluetone DOT cz


Re: error listener start during aplication start up

2006-04-21 Thread Hadraba Petr
Hi,

this warning says that tomcat is using log4j, but can't find the
configuration file /common/classes/log4j.properties.

But I don't know how tell tomcat to ignore log4j.jar.:-(

More info about Tomcat vs. Log4j:
http://tomcat.apache.org/tomcat-5.5-doc/logging.html

PETR


On 4/21/06, lee hwaying [EMAIL PROTECTED] wrote:
 I have the following error message while starting up my application in
 Tomcat.
 I am using log4j.xml in my custom application. can someone help

 thanks.


 INFO: XML validation disabled
 log4j:WARN No appenders could be found for logger
 (org.apache.catalina.startup.TldConfig).
 log4j:WARN Please initialize the log4j system properly.

 _
 Find just what you are after with the more precise, more powerful new MSN
 Search. http://search.msn.com.my/ Try it now.


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




--
Petr Hadraba
graphic artist and software designer
http://people.hadraba-soft.com/~petr
hadrabap AT bluetone DOT cz


Re: Relative Link Question

2006-04-17 Thread Hadraba Petr
Hi,
you have two options: 1. move your application to the ROOT by renaming
your war to ROOT.war (case sensitive) or 2. use mod_rewrite.

PETR

On 4/17/06, biai [EMAIL PROTECTED] wrote:

 Hi.
 I have the same question as you do.
 When you get the answer, please email me to [EMAIL PROTECTED]

 Another question I have, is how can I access my website without stating
 MYAPP in the URL.
 e.g. instead of using http://myserver.com/myapp/servlet/index.jsp use only
 http://myserver.com/servlet/index.jsp?

 Appreciated for any help
 --
 View this message in context:
 http://www.nabble.com/Relative-Link-Question-t1452173.html#a3950702
 Sent from the Tomcat - User forum at Nabble.com.


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




--
Petr Hadraba
graphic artist and software designer
http://people.hadraba-soft.com/~petr
hadrabap AT bluetone DOT cz


Re: Relative Link Question

2006-04-15 Thread Hadraba Petr
Hi,

maybe the base / element will solve your problem...

PETR


On 4/15/06, Arshad Mahmood [EMAIL PROTECTED] wrote:
 Hi,

 Hmm. What are you trying to do? Surely your images are not actually in a
 directory called /webapp/images/ Your images are probably at the top
 level of your docBase. The webapp is surely just a context that is being
 mapping to a webapp under tomcat, and you probably want Apache to serve the
 images anyway (since you're fronting it with Apache).

 Are the images really not being displayed? What have you set the
 DocumentRoot to in the apache httpd.conf.

 Regards.

 -Original Message-
 From: Steven Huey [mailto:[EMAIL PROTECTED]
 Sent: 14 April 2006 23:49
 To: users@tomcat.apache.org
 Subject: Relative Link Question

 Hello,

 I've got a setup with Apache 2.2, Mod_Jk 1.2.15, and Tomcat 5.5.16
 and things are working pretty well except for relative links in my
 webapp.

 When accessing my webapp at http://myserver.com/mywebapp/index.jsp
 any relative links within subdirectories of the mywebapp directory
 don't include /mywebapp/ in the URL. For example I have a mywebapp/
 includes/ directory and some of the files use links such as:

 img src=/images/pic.jpg/

 Instead of linking to http://myserver.com/mywebapp/images/pic.jpg the
 link is http://myserver.com/images/pic.jpg.

 I've read that if I remove the leading / from the links it will
 work, but I already have a lot of links in this format and am
 wondering if there is a configuration change or something else I can
 do to resolve this.

 Thanks,
 Steve Huey



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




--
Petr Hadraba
graphic artist and software designer
http://people.hadraba-soft.com/~petr
hadrabap AT bluetone DOT cz


Re: PostgreSQL access via JNDI

2006-04-05 Thread Hadraba Petr
Hi,

I'm successfuly using PostgreSQL 8.1.3 with Tomcat 5.5.15 with JDBC
drivers 405 (build)...

I have the Resource ... / definition in the META-INF/context.xml and
in the WEB-INF/web.xml I have the resource-ref/ element. The
resource-env-ref/ I'm using for the ActiveMQ client connection.

Also the JDBC drivers are placed in the common/lib directory.

If you search the list, you will find my previous posts containing all
the configuration files.

Have a lot of fun!

PETR


On 4/5/06, Amila Suriarachchi [EMAIL PROTECTED] wrote:
 On 4/5/06, Mark Slater [EMAIL PROTECTED] wrote:
  
   I've been trying to get PostgreSQL set up to be accessed through JNDI
   in Tomcat 5.5.x. I found the docs page describing it, jndi-
   datasource-examples-howto.html, and followed the example there, but
   it still doesn't work. I'm trying to provide access to PostgreSQL for
   use by both JDO and JCR in my web-apps.
  
   Here's the Resource definition I'm using:
  
Resource name=jdbc/whisper_db
auth=Container
type=javax.sql.Datasource 
 
 
 S should be capital  as well  DataSource

  driverClassName=org.postgresql.Driver
url=jdbc:postgresql://127.0.0.1:5432/my_db
 
 
  this is a postgres problem rather than tomcat problem.
  try here jdbc:postgresql://localhost:5432/my_db (or template1)
 
  if you want to access the database giving 127.0.0.1 you have to put
  an entry in pg_hda.conf file.
 
 
 
   username=---
password=---
maxActive=10
maxIdle=100
maxWait=3000 /
  
  
   In my application's META-INF/context.xml, I have the following
   ResourceLink:
  
ResourceLink
global=jdbc/whisper_db name=jdbc/whisper_orm
   type=javax.sql.Datasource  /
  
   In my application's WEB-INF/web.xml, I have the following resource-
   env-ref:
  
resource-env-ref
descriptionWhisper's Database/description
resource-env-ref-namejdbc/whisper_orm/resource-env-ref-name
  
resource-env-ref-typejavax.sql.Datasource/resource-env-
   ref-type
/resource-env-ref
  
  
   Depending on where I put the Resource definition, I get different
   errors.
  
   If I put it in the web-app's META-INF/context.xml, or in $TOMCAT_HOME/
   conf/context.xml, my JDO implementation complains:
NestableRuntimeException: There was an error duing JNDI lookup
   of the name java:comp/env/jdbc/whisper_orm.

Caused by: javax.naming.NameNotFoundException: Name jdbc is not
   bound in this Context
  
   If I put it in $TOMCAT_HOME/conf/server.xml, in the
   GlobalNamingResources section, I get:
  
   2006-04-04 11:58:27,866 ERROR
   [org.apache.catalina.mbeans.GlobalResourcesLifecycleListener] -
   Exception processing Global JNDI Resources
   javax.naming.NamingException: Cannot create resource instance
at
   org.apache.naming.factory.ResourceFactory.getObjectInstance
   (ResourceFactory.java:132)
at javax.naming.spi.NamingManager.getObjectInstance
   (NamingManager.java:304)
at org.apache.naming.NamingContext.lookup(NamingContext.java:
   792)
at org.apache.naming.NamingContext.lookup (NamingContext.java:
   152)
at
   org.apache.catalina.mbeans.GlobalResourcesLifecycleListener.createMBeans
   (GlobalResourcesLifecycleListener.java:138)
at
   org.apache.catalina.mbeans.GlobalResourcesLifecycleListener.createMBeans
   (GlobalResourcesLifecycleListener.java:143)
at
   org.apache.catalina.mbeans.GlobalResourcesLifecycleListener.createMBeans
   (GlobalResourcesLifecycleListener.java:108)
at
   org.apache.catalina.mbeans.GlobalResourcesLifecycleListener.lifecycleEve
   nt(GlobalResourcesLifecycleListener.java:80)
at
   org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent
   (LifecycleSupport.java:119)
at org.apache.catalina.core.StandardServer.start
   (StandardServer.java:693)
at org.apache.catalina.startup.Catalina.start(Catalina.java:
   551)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke
   (NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke
   (DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at org.apache.catalina.startup.Bootstrap.start
   (Bootstrap.java:275)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:
   413)
  
   I'm assuming these errors are related, and that whatever is causing
   the NamingException is the same fundamental problem causing the
   NameNotFoundException in the context-based configuration. My problem
   is that I can't figure out what it is. The driver for the database
   (postgresql-8.1-405.jdbc3.jar ) is in $TOMCAT_HOME/common/lib/, and
   I've also tried 

Re: tomcat users file

2006-04-03 Thread Hadraba Petr
Hi,

check if the different user has read permissions for the
/opt/jakarta-tomcat-5.5.9/conf/tomcat-users.xml.new file

PETR


On 4/3/06, Ali Kassem [EMAIL PROTECTED] wrote:
 Hi

 I am using tomcat 5.5.9 with linux, and jdk1.5.0_6

 When I start the tomcat as root user every thing it started, but when I
 start it with another user

 It start  8080 port but I get the message in Catalina.out:



 ...

 ...

 Apr 4, 2006 2:54:27 AM org.apache.coyote.http11.Http11Protocol init

 INFO: Initializing Coyote HTTP/1.1 on http-8080

 Apr 4, 2006 2:54:27 AM org.apache.catalina.startup.Catalina load

 .

 INFO: Starting Servlet Engine: Apache Tomcat/5.5.9

 Apr 4, 2006 2:54:27 AM org.apache.naming.NamingContext lookup

 WARNING: Unexpected exception resolving reference

 java.io.FileNotFoundException:
 /opt/jakarta-tomcat-5.5.9/conf/tomcat-users.xml.new (Permission denied)

 at java.io.FileOutputStream.open(Native Method)

 at java.io.FileOutputStream.init(FileOutputStream.java:179)

 at java.io.FileOutputStream.init(FileOutputStream.java:131)

 at
 org.apache.catalina.users.MemoryUserDatabase.save(MemoryUserDatabase.jav
 a:462)

 ...

 ..

 Apr 4, 2006 2:54:27 AM org.apache.catalina.realm.UserDatabaseRealm start

 SEVERE: Exception looking up UserDatabase under key UserDatabase

 javax.naming.NamingException:
 /opt/jakarta-tomcat-5.5.9/conf/tomcat-users.xml.new (Permission denied)

 at
 org.apache.naming.NamingContext.lookup(NamingContext.java:804)

 at
 org.apache.naming.NamingContext.lookup(NamingContext.java:152)

 .



 I don't have any file called
 /opt/jakarta-tomcat-5.5.9/conf/tomcat-users.xml.new,

 I have the normal file tomcat-users.xml



 Can any one help

 thanks









 Ali KASSEM

 Project Leader - IT Dept.

 Banque Du Liban

 P.O.Box:11/5544 Beirut, Lebanon

 Tel:961-1-75 ext 4110

 Fax:961-1-343316









Re: ./configure --enable-ssl

2006-03-31 Thread Hadraba Petr
Hi,

I'm using OpenSSL and have no problems...

PETR


On 3/31/06, Indraveni [EMAIL PROTECTED] wrote:
 Hi friends,

If we are giving the apcahe configuration command as ./configure 
 --enable-ssl then which ssl packages does the system require.

  ssl support

  since I am facingan error saying no ssl modules


 -
  Jiyo cricket on Yahoo! India cricket
 Yahoo! Messenger Mobile Stay in touch with your buddies all the time.



Re: Web Application doesn't recognize domains using tomcat

2006-03-27 Thread Hadraba Petr
Hi Lety,

so, in short, I don't understand your problem. But, probably your
links (the a / element) have broken the href URL. Am I right?

Please, describe more your problem. I didn't find any problems about
URLs in the Tomcat 5.5.x...

PETR


On 3/25/06, Benitez Badillo, Leticia [EMAIL PROTECTED] wrote:
 Hi!



 I working with tomcat 5.5.9,



 I have a domain name 'www.myproject.com http://www.myproject.com/ ' ,
 an I can get into the server using it, but  once I try to navigate
 inside the application I need to use IP direction.



 The domain is on the dns server.



 I'm using jre1.5.0_04



 In my server.xml file have host name = localhost and the domain like an
 alias.





 I have other server with the same configuration and works properly. The
 only diference is that on this server I was using apache on 80 port. Now
 I shutdown apache and I'm try to use tomcat in that port.



 Is there any interference between apache and tomcat?



 I hope someone can help me.



 Lety B.







Re: Distinguish between users and robots in access log?

2006-03-27 Thread Hadraba Petr
Hi Scott,

look at awstats ( http://awstats.sourceforge.net ). This projects
parses Apache httpd's logs and can determine who's bot and who's not.
Maybe you find there some insteresting informations.

PETR


On 3/27/06, Jon Wingfield [EMAIL PROTECTED] wrote:
 Looks like you are running the default access log settings.
 For logging of user-agent and referer (when given) try:

 CustomLog logs/access_log combined

 http://httpd.apache.org/docs/1.3/logs.html#accesslog

 HTH,

 Jon

 Scott Purcell wrote:
  I really would like to find out how my (and if my site) is being
  indexed. I am using Tomcat 5.5 and I am running a ecommerce site. I have
  had nothing but trouble getting seen in search engines, so I would like
  to be able to somehow trace what pages robots are indexing.
 
 
 
  I did add a robots.txt and allow my whole domain to be indexed. So that
  being said, I added an access log but by default, I cannot really tell
  if I have users hitting my site, or when robots are visiting my site.
 
 
 
  Below is my access_log from Saturday. What I would like to be able to
  do, is distinguish between normal users, and robots. If I can verify
  that the robots are indexing my site, I would be happy, and then know I
  need to work more meta. But if they are not indexing my site, then I
  need to find out why.
 
 
 
  Does this make sense? Has anyone been through this before? Thanks ahead
  of time,
 
  Regards
 
  Scott
 
 
 
 
 
 
 
  Access log Saturday
 
  152.163.100.73 - - [26/Mar/2006:02:27:13 -0600] GET
  /unique/viewThumbProducts.do?type=categorysearchString=Candles%20%20Ar
  omacategoryID=13pageNumber=1 HTTP/1.0 200 17139
 
  152.163.100.72 - - [26/Mar/2006:02:27:14 -0600] GET
  /unique/includes/siteWide.css HTTP/1.0 200 15402
 
  152.163.100.134 - - [26/Mar/2006:02:27:14 -0600] GET
  /unique/images/head_text.jpg HTTP/1.0 200 18661
 
  152.163.100.138 - - [26/Mar/2006:02:27:16 -0600] GET
  /unique/images/spacer_transparent.gif HTTP/1.0 200 49
 
  152.163.100.133 - - [26/Mar/2006:02:27:16 -0600] GET
  /unique/images/browseProducts.gif HTTP/1.0 200 659
 
  152.163.100.66 - - [26/Mar/2006:02:27:16 -0600] GET
  /unique/images/moregreatfinds.gif HTTP/1.0 200 564
 
  152.163.100.69 - - [26/Mar/2006:02:27:16 -0600] GET
  /unique/images/searchText.gif HTTP/1.0 200 624
 
  152.163.100.138 - - [26/Mar/2006:02:27:16 -0600] GET
  /unique/images/go.gif HTTP/1.1 200 308
 
  152.163.100.204 - - [26/Mar/2006:02:27:16 -0600] GET
  /unique//images/thumb/UP00130.jpg HTTP/1.0 200 10044
 


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




Re: Check if file exists in WEB-INF folder

2006-03-24 Thread Hadraba Petr
Hello,

be careful using filesystem directly. This piece of code will not work
if the unpackWARs=no. Use
getServletContext().getResource(/WEB-INF/jsp/test.jsp) == null
instead. This will work for both options: for unpacked WARs and
packed WARs.

PETR


On 3/23/06, Rapthor [EMAIL PROTECTED] wrote:

 It works! Thanks.
 --
 View this message in context: 
 http://www.nabble.com/Check-if-file-exists-in-WEB-INF-folder-t1329073.html#a3549945
 Sent from the Tomcat - User forum at Nabble.com.


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




Re: [OT] How does Synchronized code interact with other applications

2006-03-21 Thread Hadraba Petr
Hi,

On 3/20/06, David Kerber [EMAIL PROTECTED] wrote:
 Caldarale, Charles R wrote:

 From: David Kerber [mailto:[EMAIL PROTECTED]
 Subject: Re: [OT] How does Synchronized code interact with
 other applications
 
 Ok.  So if I were to port the Delphi app to java and run it
 as another thread in my app, I would be ok there...
 
 
 
 Not necessarily.  You will still have the same file open twice, once for
 the writer, once for the reader.  When the writes become visible is
 still under control of NTFS.
 
 
 Ok.

 If you're going to run the two apps inside the same JVM, do you even
 need to write a file?  You should be able to just pass String objects
 from one to the other.
 
 
 The output side is a database write, and part of our design criteria was
 to be able to stop and start the database without interfering with data
 flow from the remote sites into the central office.  So we write the
 data to disk and acknowledge the successful receipt of the data to the
 sites at that time.  Then we can read the data out of the disk file and
 write it to the database indpendently.

and what about to use JMS (ActiveMQ for example)?


 
 
 Does fileWriter.flush() do almost the same thing?
 
 
 
 No guarantee - there are two levels of buffering going on.  The flush()
 API pushes the stream information out to the file system, but does not
 require that it actually be written to disk.  Only the sync() does that.
 I don't know if the results of the flush() are visible to other
 processes in NTFS.
 
 
 They are, as far as I understand it.

 Dave



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




Solution: Connecting from Tomcat to ActiveMQ

2006-03-18 Thread Hadraba Petr
Hi all friends,

I spent two days solving this problem and because there is not so
complex informations about this in the internet, I find this helpful.

I hope, this will help.

I need to connect from Tomcat web application into the standalone
ActiveMQ broker. I repeat -- standalone broker. But I found several
problems. First, the configuration:

Sun Java 5 (06)
Apache Tomcat 5.5.15
ActiveMQ 4.0-M4

The first:
- start ActiveMQ using the bin/activemq bash script (sorry, I'm using
Linux, for windows use appropriate bat/cmd scripts and remembere the
(back)slash hell).
So, You can connect to the broker using jconsole:

jconsole service:jmx:rmi:///jndi/rmi://localhost:1099/jmxrmi

Second, start tomcat with the simple servlet sending TextMessage using
JMS objects obtained from JNDI.

But, there is a bug, in the M4 ActiveMQ distribution.

Then you close the connection (the close() method), your connection to
the broker is closed but the `Connection already closed' Exception
during `cleanup()' is thrown. This exception does not throws to the
Servlet code itselfs, but is secreted in the tomcat's another thread,
so you can see it only in the log or in the Eclipse console.

WARNING: Cleanup failed
org.apache.activemq.ConnectionClosedException: The connection is already closed
at 
org.apache.activemq.ActiveMQConnection.asyncSendPacket(ActiveMQConnection.java:1030)
at 
org.apache.activemq.ActiveMQConnection.cleanup(ActiveMQConnection.java:1191)
at 
org.apache.activemq.ActiveMQConnection.transportFailed(ActiveMQConnection.java:1585)
at 
org.apache.activemq.ActiveMQConnection.onException(ActiveMQConnection.java:1338)
at 
org.apache.activemq.transport.TransportFilter.onException(TransportFilter.java:102)
at 
org.apache.activemq.transport.TransportFilter.onException(TransportFilter.java:102)
at 
org.apache.activemq.transport.TransportFilter.onException(TransportFilter.java:102)
at 
org.apache.activemq.transport.TransportSupport.onException(TransportSupport.java:90)
at 
org.apache.activemq.transport.tcp.TcpTransport.run(TcpTransport.java:149)
at java.lang.Thread.run(Thread.java:595)

And, if you does not call the close() method, no Exception is thrown
and the connection (the socket) will stay connected. If you trigger
the servlet (for ex. using the GET program), you will see in the
jconsole more and more unused connections.

The solution is simple: Upgrade ActiveMQ to the latests SNAPSHOT.

The latest SNAPSHOT is working very very good.

And one note. You can see in the ActiveMQ log the Exception:

java.lang.ClassNotFoundException: mx4j.tools.naming.NamingService

Simply download latest binary distribution of the mx4j project and
copy the mx4j-tools.jar into the $ACTIVEMQ_HOME/lib. Cool.


And, If you are looking for something like this problem (Tomcat +
ActiveMQ + JMS + JNDI), here is my web application configuration
files:

META-INF/context.xml:
Context
...
Resource
name=jms/ConnectionFactory
auth=Container
type=org.apache.activemq.ActiveMQConnectionFactory
description=JMS Connection Factory
factory=org.apache.activemq.jndi.JNDIReferenceFactory
brokerURL=tcp://ws:61616
brokerName=localhost
useEmbeddedBroker=false /
Resource
name=jms/Test
auth=Container
type=org.apache.activemq.command.ActiveMQQueue
factory=org.apache.activemq.jndi.JNDIReferenceFactory
physicalName=TEST /
...
/Context


WEB-INF/web.xml:
...
resource-env-ref
   
resource-env-ref-namejms/ConnectionFactory/resource-env-ref-name
   
resource-env-ref-typejavax.jms.ConnectionFactory/resource-env-ref-type
/resource-env-ref

resource-env-ref
resource-env-ref-namejms/Test/resource-env-ref-name
resource-env-ref-typejavax.jms.Queue/resource-env-ref-type
/resource-env-ref
...

And the peace of Servlet code using this configuration:
...
   try {
InitialContext ic = new InitialContext();
Context ctx = (Context) ic.lookup(java:comp/env);

ConnectionFactory cf = (ConnectionFactory)
ctx.lookup(jms/ConnectionFactory);
Connection conn = (Connection) cf.createConnection();
conn.start();

Session s = conn.createSession(false,
Session.CLIENT_ACKNOWLEDGE);
Destination d = (Destination) ctx.lookup(jms/Test);

MessageProducer mp = s.createProducer(d);
mp.setDeliveryMode(DeliveryMode.PERSISTENT);

TextMessage tm = s.createTextMessage();
tm.setText(Foo);

mp.send(tm);

tm = 

Re: Mapping different different folders in a webapp to different urls

2006-03-13 Thread Hadraba Petr
Hi,

and what about to write a servlet filter?

I have my test domain with several virtual hosts IN CNAME to localhost
(or any other IP where is Tomcat listening) in my DNS. I wrote an
simple filter which parses virtual host name (request.getLocalName()
-- always contains full computer name from requested URL) and forwards
request to specified servlet (according to configuration) using
RequestDispatcher... Note that I'm not using JSP, I'm using servlets
only because I have my own CMS which is vhost, domain, context-path,
servlet-path independed and must support various output formats.

This is working for me. Sessions are OK, because I don't need
cross-vhost navigation...

PETR


On 3/13/06, Per Johnsson [EMAIL PROTECTED] wrote:
 Hi!

 We have managed to do that but with a side effect that Tomcat loads each
 webapp several times. This is an example config.

 Host name=www.aaa.com appBase=webapps unpackWARs=true
 autoDeploy=false xmlValidation=false xmlNamespaceAware=false
   Context path= docBase=aaa debug=0 crossContext=true/
 /Host
 Host name=www.bbb.com appBase=webapps unpackWARs=true
 autoDeploy=false xmlValidation=false xmlNamespaceAware=false
   Context path= docBase=bbb debug=0 crossContext=true/
 /Host


 I think by setting the webapps folder to a empty dummy folder you could
 get rid of the autoloaded webapps
 and only get those you want. I have not tried it out much. I'm looking for
 a nicer solution

 Host name=www.aaa.com appBase=webappsDummy unpackWARs=true
 autoDeploy=false xmlValidation=false xmlNamespaceAware=false
   Context path= docBase=webapps/aaa debug=0 crossContext=false/
 /Host
 Host name=www.bbb.com appBase=webappsDummy unpackWARs=true
 autoDeploy=false xmlValidation=false xmlNamespaceAware=false
   Context path= docBase=webapps/bbb debug=0 crossContext=false/
 /Host


 So if someone knows another way of only load the defined context I'm more
 than glad to hear about it.

 Regards Per Jonsson



 Tim Diggins [EMAIL PROTECTED] wrote on 2006-03-13 12:38:59:

  If you are planning to use apache anyway, then you could use mod_rewrite

  for this (see apache docs on mod_rewrite - but basically rewrite
  (internally) the a.abc.com to abc.com/a and connect abc.com/a via
  mod_jk to tomcat /a and then tomcat doesn't need to know about the
  rewrite).
 
  don't __think__ there is a tomcat way to distribute a webapp across
  urls, but you __might__ get the same effect by having virtual hosts in
  tomcat, each with a ROOT webapp, and enabling single-sign-on (to enable
  the same session across the webapps).
 
  I've never used single-sign-on, but that's the first thing I'd check, if

  you want a tomcat-only solution.
 
  hth Tim
 
 
 
  Kumar Limbu wrote:
   Hi Guys,
  
  
  
   Hi everyone. I am new to this mailing list and I have a configuration
   problem.
  
  
  
   I searched through the web and googled around but I couldn't get a
   satisfactory reply. I also went through the mailing list, but I
 couldn't
   come across anything specific to my need.
  
  
  
   We are about to deploy an application. What we are looking to do is to
 map
   each individual folder within the web application to a different urls.
  
   What I mean by this is,
  
   For example we have a web application called webapp and within webapp
 we
   have folders like a, b and c. What I would like to know is , how can I
 map
   these folder to urls like a.abc.com , b.abc.com and c.abc.com. Is
 there any
   way to do this? I haven't really been able to find a reasonable
 solution to
   this problem. So if anyone knows how to do it please drop a word.
  
  
  
   Thank You,
  
   Kumar
  
  
  
  
  
  
 
 
  -
  To unsubscribe, e-mail: [EMAIL PROTECTED]
  For additional commands, e-mail: [EMAIL PROTECTED]
 


 
 This e-mail and the information it contains may be privileged and/or
 confidential.  It is for the intended addressee(s) only.
 The unauthorised use, disclosure or copying of this e-mail, or any 
 information it contains, is prohibited.
 If you are not an intended recipient, please contact the sender and delete 
 the material from your computer.
 





Re: How can I set tomcat NOT Case Sensitive

2006-03-08 Thread Hadraba Petr
Sorry,
for my posting, but

On 3/8/06, David Delbecq [EMAIL PROTECTED] wrote:
 Buddy wu a écrit :

 2006/3/7, David Kerber [EMAIL PROTECTED]:
 
 
 Context caseSensitive=false
 
 
 thanks a lot. it worked.
 and I think someone discussed other problem of these question maybe
 right. but my goal is only to let tomcat's URL or URI (I don't kown
 which is wright, or all are write) case-insensitive. I don't care the
 case-sensitive feature in jsp or servlet file can work( maybe it MUST
 case-sensitive, because of java language, but I don't care about
 these. I just need URL is CASE-INSENSITIVE, And it will be ok to me)
 
 
 
 This only applies to ressource url, not servlet url, neither filters,
 nor security-constraint.

 and the security problem that someone has said, I think it may not be
 so important. If a hacker want to detect your site, I think he will
 test all posibles JSP Jsp jSP and others.
 
 
 
 That's not where security problem lies:
 Let's assume your public site is at
 http://yourserver/yourwebapp/index.jsp
 if casesensitiveness is deactivated and you are using a case sensitive
 filesystem (like the microsoft ones), accessing

NTFS, FAT -- mayby they are case sensitive, but the filesystem layer
not. Try to create two files in one directory; one named a.txt and the
second A.txt. The billboard ocures! On Unix systems is this possible
-- Makefile is not makefile;-)

 http://yourserver/yourwebapp/index.jsP will point to same filesystem
 ressouce, but with one exception, it will not be handled by jsp engine
 and requester will simply get the jsp source  instead of generated html
 (a jsp source could contain potentially critical informations like
 database connection informations)

 More dangerous, suppose your application have an admin interface located at
 http://yourserver/yourwebapp/admin/
 with a security-constraint in web.xml mapped to 'admin/*', any anonymous
 user can have his browser point at 'AdMiN/' and will have access to
 admin interface without authentification, bypassing securities!

 Of course it's not a problem if you don't have jsps, neither servlets,
 nor security constraints, that if you are serving static content. But
 then ,why using tomcat?

 but thanks again ,everyone
 
 
 Buddy wu wrote:
 
 
 
 2006/3/7, Long [EMAIL PROTECTED]:
 
 
 
 
 Buddy wu wrote:
 I wan't to know there is any way to set tomcat NOT CASE SENSITIVE in 
  URL
 I mean: when I write in browser's 'http://localhost/test.html'
 equals to 'http://localhost/TEST.htm'.  Can I do it ? or just in
 WINDOWS can but Linux/unix can't?
 
 Right, url is case-insensitive under Windows because the file system
 
 
 
 
 But, the FACT is that under Windows the URL is CASW-SENSITIVE, not
 case-insecsitive , why?
 
 I've tried, under Windows, test.html and TEST.html is diffrent in
 tomcat server. Is there a parameter to set??
 
 
 
 
 
 can't tell a difference between test.html and TEST.html. The difference
 is there under Linux/UNIX.
 
 Long
 
 
 -
 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]
 
 
 
 
 
 
 
 
 -
 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]
 
 
 


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




Re: JDBC DataSources with SYBASE Adaptive Server Anywhere

2006-03-06 Thread Hadraba Petr
Hello Thomas,

thank you for your informations! I will order ASA developer edition
and learn new database;-) Now, I'm looking for a database which
provides internationalization features; specially ORDER BY [(var)char
| text] column and I have no success:
ASE and localization -- it's a workaround.
PostgreSQL -- it's the same. You must define locale during database
storage creation:-(
Firebird -- currently I have no experience:-(
Oracle -- expensive:-(

So, maybe ASA will solve my problem

Regarding T-SQL: I don't know how you, but I find T-SQL great... Some
constructions are interesting

Regarding JDBC: Maybe the native library causes your problems. I'm
using only pure-Java drivers located in the common/lib with no
problems.

Regarding DBCP: I found DBCP classes in the stack traces during my
driver's debugging. And finally -- there is naming-factory-dbcp.jar in
the common/lib...

Regarding Tomcat and data sources: I found this more then obscure. I
have one question: If you write a webapp which uses database; where
shall I define the datasource names? Hardwiring is not a solution. And
put them (the definitions) into some configuration file into the
webapp war file?? Ofcourse, Tomcat have the admin app in which you can
define app-specific database cources... But Sun Java System App server
not... There are in the SJSAS only global resources... I must learn
more...

So, many many thanks for your informations; I'm sorry that I didn't help you:-(

Have a nice day

PETR


On 3/6/06, Tom Bednarz [EMAIL PROTECTED] wrote:
 Hi Petr,

 Thanks for your feedback. It still does not work for me, no matter where
 I put the damn JAR file. So I will use my own pooling class directly in
 my webapp based on Apaches DBCP which is part of Jakarta Commons. It is
 probably faster then fiddeling with this bloody driver configuaration.

 I currently should use the pool from JSP's and not from Java code.
 However, it should not make a difference.

 Just for your information regarding ASA and ASE: ASA is a database
 originally written by a company called WATCOM in Canada. I use the
 software for more then 10 years and it is one of the best DB engines
 money can buy. Even with large databases (several GB in size) it is
 faster then MS SQL Server. ASE is only faster if there are hundreds of
 concurrent users, but ASE has still many limitations in SQL syntax, db
 space management, datatypes etc. Also it only understands T-SQL while
 ASA understands both T-SQL and ANSI SQL.

 Regarding JDBC: jConnect is a driver provided from SYBASE. It works on
 ASE as well as on ASA and uses the Tabular Data Stream TDS protocol.
 jConnect is quite slow and does NOT support scrollable cursors, but it
 is a pure java, level 4 driver. JDBCODBC.IDriver is a NATIVE library
 driver (level 3). It is NOT using bridge, it is using a native DLL or
 .SO on UNIX. To connect one needs to setup a ODBC datasource which may
 be painful, if you have to redistribute a client. (You need to integrate
 the entire ODBC stuff in your setup program).  This driver is relatively
 new (compared to jConnect) and was introduced with ASA 8 (I think).
 Currently we have ASA 9.x. Earlier version only could use jConnect.

 Cheers

 Thomas

 Hadraba Petr wrote:

 Hi,
 
 I studied something about Sybase ASA and here are my pieces of knowledge:
 - ASA is, unlike ASE, ODBC based insted of TDS
 - the JDBC drivers are generic JDBC-to-ODBC bridge and can be used to
 access _any_ database throw ODBC
 - the JDBC drivers are not freely downloadable (I didn't find any)
 
 - You can access ASA also throw jConnect (TDS based Sybase's JDBC drivers)
 This solution is functional but the speed (power) is less -- Sybase
 does not recomand to use jConnect drivers.
 
 So, I tried to use my ASE under Tomcat (Currently, I'm successfuly
 using PostgreSQL). The following solution works fine under Tomcat
 standalone and Tomcat under Eclipse.
 
 Small HOWTO for Tomcat 5.5.15/jdk1.5.0_06/Linux:
 1. Locate your existing JDBC driver, or try use jConnect
 (http://www.sybase.com/products/middleware/jconnectforjdbc)
 2. Copy the driver jar(s) into ${CATALINA_HOME}/common/lib
 3. Create your META-INF/context.xml
 4. Make the resource references in the WEB-INF/web.xml
 5. Use the data source(s) in your code
 
 I saw the `Cannot load JDBC driver class' and it seens the drivers
 must be in the common/lib directory.
 
 Finally, here is my context.xml, web.xml and example lines using the database
 
 Hope this helps
 
 PETR
 
 
 META-INF/context.xml
 ?xml version=1.0 encoding=UTF-8?
 Context
 Resource
 auth=Container
 scope=Shareable
 description=Logging database connection
 name=jdbc/project/logger
 type=javax.sql.DataSource
 driverClassName=org.postgresql.Driver
 url=jdbc:postgresql://127.0.0.1:5432/project
 username=uname
 password=password6
 maxIdle=20

Re: JDBC DataSources with SYBASE Adaptive Server Anywhere

2006-03-05 Thread Hadraba Petr
'
 
 org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:510)
 
 org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:375)
 
 org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314)
 org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264)
 javax.servlet.http.HttpServlet.service(HttpServlet.java:802)


 This means it does not find the driver jar file. I put it in all
 possible directories (lib directories of the webapp, tomcats common/lib
 and shared/lib) but all without success. Do I have to set a CLASSPATH
 somewhere??

 Tom


 Hadraba Petr wrote:

 Hi,
 
 I'm not using Sybase under Tomcat; I have PostgreSQL...
 
 Eclipse? My configuration is, Eclipse does not modify Tomcat
 configuration (this is the default)
 
 In your WebContent under META-INF create context.xml with the
 Resource ... / definition. The Context / element does not require
 any attributes:
 Context
   Resource ... your=attributes ... /
 /Context
 
 And finaly, place the JDBC driver JAR into your WEB-INF lib.
 
 Catalina will automaticaly load your driver. My configuration is
 working properly.
 
 This configuration is working for me fine!
 
 JNDI names? Look at the JNDI section in the J2EE Tutorial in the Sun's
 web site. The examples are very helpful.
 
 There is also another question:
 It's good solution to place JDBC driver into the webapp's lib directory?
 
 
 Hope it helps
 
 PETR
 
 PS.: My Adaptive Server Enterprise 15 is working good, but not under
 Tomcat; it's standalone application... The initialization, driver URL
 was taken from the Sybase's JDBC documentation on their web sites.
 
 
 On 3/3/06, Tom Bednarz [EMAIL PROTECTED] wrote:
 
 
 I try to configure a JDBC DataSource for my Adaptive Server Anywhere 9
 database. Unfortunately without any success so far!
 I use Tomcat 5.5.18.
 
 The error is well known and looks as follows:
 
 org.apache.jasper.JasperException: Unable to get connection, DataSource
 invalid: org.apache.tomcat.dbcp.dbcp.SQLNestedException: Cannot create
 JDBC driver of class '' for connect URL 'null'
 
  org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:510)
 org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:375)
 
 org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314)
 org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264)
 javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
 
 
 I use the JDBCODBC driver to connect. Here is the configuration:
 
 server.xml
 
 Resource
   name=jdbc/MyService
   type=javax.sql.DataSource
   password=sql
   driverClassName=ianywhere.ml.jdbcodbc.IDriver
   maxIdle=2
   maxWait=5000
   validationQuery=select * from CodeTable
   username=dba
   url=jdbc:odbc:dsn=MyService
   maxActive=50
   removeAbandoned=true
   removeAbandonedTimeout=60
   logAbandoned=true/
 
 Web.xml
 
   resource-ref
   descriptionDatabase connection/description
   res-ref-namejdbc/MyService/res-ref-name
   res-typejavax.sql.DataSource/res-type
   res-authContainer/res-auth
   /resource-ref
 
 Note: I currently do NOT deplay using a WAR file since I use Eclipse as
 develpment environment to debug etc. So I do NOT have an application
 specific context.xml file at the moment.
 
 Could anybody please explain what needs to be put into the name
 property? It seems that jdbc/ is mandatory but what needs to follow the
 slash is not clear to me! Is it the ODBC datasource name, the database
 name or any choosen name??
 
 Many thanks for your help.
 
 Tom
 
 -
 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]




Re: Tomcat 5.X dies after some time

2006-03-03 Thread Hadraba Petr
Hi,

I saw this error yesterday. I tried to run second instance of the Tomcat.

First tomcat was configured to use port 8080 and redirect port 8443

The second instance was configured to port 9080 and redirect 9443

When I tried to start the new instance, the error about port 8005
occured... In the server.xml I didn't find anything about port 8005:-(

PETR


On 3/3/06, foo shyn [EMAIL PROTECTED] wrote:
 Hi,

 It seems that there're other application that are using 8005 as port on ur
 server as well.

 fooshyn

 - Original Message -
 From: Devireddy, Nagendra Reddy (STSD) [EMAIL PROTECTED]
 To: Tomcat Users List users@tomcat.apache.org
 Sent: Friday, March 03, 2006 5:40 PM
 Subject: Tomcat 5.X dies after some time


 Hi,

 Tomcat 5.X is dieing after some time throwing the following error ..
 Can some one please help me ..
 INFO: Server startup in 22840 ms
 StandardServer.await: create[8005]: java.net.BindException: Address
 already in use
 java.net.BindException: Address already in use
 at java.net.PlainSocketImpl.socketBind(Native Method)
 at java.net.PlainSocketImpl.bind(PlainSocketImpl.java:331)
 at java.net.ServerSocket.bind(ServerSocket.java:318)
 at java.net.ServerSocket.init(ServerSocket.java:185)
 at
 org.apache.catalina.core.StandardServer.await(StandardServer.java:496)
 at org.apache.catalina.startup.Catalina.await(Catalina.java:619)
 at org.apache.catalina.startup.Catalina.start(Catalina.java:579)
 at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
 at
 sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.jav
 a:39)
 at
 sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessor
 Impl.java:25)
 at java.lang.reflect.Method.invoke(Method.java:324)
 at
 org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:287)
 at
 org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:425)
 Mar 3, 2006 3:01:20 PM org.apache.coyote.http11.Http11Protocol pause
 INFO: Pausing Coyote HTTP/1.1 on http-7510



 Thanks and Regards,
 Nagendra Reddy. D
 Hewlett Packard ISO (STSD)
 Bangalore.
 Ph : 080-22052254
 +hp = Everything is Possible




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




Re: JDBC DataSources with SYBASE Adaptive Server Anywhere

2006-03-03 Thread Hadraba Petr
Hi,

I'm not using Sybase under Tomcat; I have PostgreSQL...

Eclipse? My configuration is, Eclipse does not modify Tomcat
configuration (this is the default)

In your WebContent under META-INF create context.xml with the
Resource ... / definition. The Context / element does not require
any attributes:
Context
  Resource ... your=attributes ... /
/Context

And finaly, place the JDBC driver JAR into your WEB-INF lib.

Catalina will automaticaly load your driver. My configuration is
working properly.

This configuration is working for me fine!

JNDI names? Look at the JNDI section in the J2EE Tutorial in the Sun's
web site. The examples are very helpful.

There is also another question:
It's good solution to place JDBC driver into the webapp's lib directory?


Hope it helps

PETR

PS.: My Adaptive Server Enterprise 15 is working good, but not under
Tomcat; it's standalone application... The initialization, driver URL
was taken from the Sybase's JDBC documentation on their web sites.


On 3/3/06, Tom Bednarz [EMAIL PROTECTED] wrote:
 I try to configure a JDBC DataSource for my Adaptive Server Anywhere 9
 database. Unfortunately without any success so far!
 I use Tomcat 5.5.18.

 The error is well known and looks as follows:

 org.apache.jasper.JasperException: Unable to get connection, DataSource
 invalid: org.apache.tomcat.dbcp.dbcp.SQLNestedException: Cannot create
 JDBC driver of class '' for connect URL 'null'
 
 org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:510)
 org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:375)

 org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314)
 org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264)
 javax.servlet.http.HttpServlet.service(HttpServlet.java:802)


 I use the JDBCODBC driver to connect. Here is the configuration:

 server.xml

 Resource
   name=jdbc/MyService
   type=javax.sql.DataSource
   password=sql
   driverClassName=ianywhere.ml.jdbcodbc.IDriver
   maxIdle=2
   maxWait=5000
   validationQuery=select * from CodeTable
   username=dba
   url=jdbc:odbc:dsn=MyService
   maxActive=50
   removeAbandoned=true
   removeAbandonedTimeout=60
   logAbandoned=true/

 Web.xml

   resource-ref
   descriptionDatabase connection/description
   res-ref-namejdbc/MyService/res-ref-name
   res-typejavax.sql.DataSource/res-type
   res-authContainer/res-auth
   /resource-ref

 Note: I currently do NOT deplay using a WAR file since I use Eclipse as
 develpment environment to debug etc. So I do NOT have an application
 specific context.xml file at the moment.

 Could anybody please explain what needs to be put into the name
 property? It seems that jdbc/ is mandatory but what needs to follow the
 slash is not clear to me! Is it the ODBC datasource name, the database
 name or any choosen name??

 Many thanks for your help.

 Tom

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




Re: Problems Starting Tomcat

2006-03-03 Thread Hadraba Petr
Hi,

do you have the tomcat-users.xml file in the $CATALINA_HOME/conf
directory? The user database I think is the file storing user names,
roles and their passwords...

Hope it helps

PETR


On 3/3/06, C Rose [EMAIL PROTECTED] wrote:
 Hi all

 I'm having problems starting Tomcat after my home account (in which
 Tomcat is installed) was moved from one server to another.

 The most visible thing that has changed is that my home directory now
 has a different path. Before the move, my installation of Tomcat worked
 fine. Now it won't start (not quite true, see below). I have searched
 for references to the old home directory path (only in files such as
 conf/Catalina/localhost/my-web-app.xml) and modified them accordingly,
 but this doesn't fix the problem.

 I have modified my JAVA_HOME and CATALINA_HOME environment variables to
 point to the correct directories. They are correctly reported when I run
 startup.sh and shutdown.sh.

 To be more precise, Tomcat does seem to start, but doesn't seem to
 respond to any HTTP requests. The error that is reported in the logs is
 given at the end of this email, but Google hasn't been able to help me
 shed any light on this. The error makes reference to 'UserDatabase', but
 I've never touched such a thing; grepping for it in the Tomcat directory
 shows that it's used all over the place, but nowhere that I've been playing.

 Suggestions are very welcome.

 Chris

 Error in the catalina.out log:

 SEVERE: Catalina.start:
 LifecycleException:  No UserDatabase component found under key UserDatabase
  at
 org.apache.catalina.realm.UserDatabaseRealm.start(UserDatabaseRealm.java:259)
  at
 org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1075)
  at
 org.apache.catalina.core.StandardEngine.start(StandardEngine.java:478)
  at
 org.apache.catalina.core.StandardService.start(StandardService.java:476)
  at
 org.apache.catalina.core.StandardServer.start(StandardServer.java:2298)
  at org.apache.catalina.startup.Catalina.start(Catalina.java:556)
  at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
  at
 sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
  at
 sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
  at java.lang.reflect.Method.invoke(Method.java:324)
  at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:284)
  at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:422)

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




Re: images

2006-02-22 Thread Hadraba Petr
Hmm,

I wrote simple servlet which finds corresponding image in webapp
resources and sends it to the client. This servlet also sets some
headers like Last-Modified etc:-( I'm writing web application which
uses SEO, supports XHTML, WML etc and I don't want to have tons of
servlets:-(

If you want, I can share the sources...

PETR


On 2/22/06, Zohar Amir [EMAIL PROTECTED] wrote:
 Hi,
 I have a servlet that transforms an XML using XSLT. In the result HTML I
 want to include some images. Where do I place those images? I tried the
 WebContent directory, but they could not be loaded (I even tried getting
 them explicitly, but the servlet was invoked instead).
 Thanks,
 Zohar.

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




Re: how to get help if no answer from this list?

2006-02-20 Thread Hadraba Petr
Hi,

did you try to copy the `activation.jar' in the common/lib/ (or
common/endorsed/ if newer version then in JRE) directory? This path is
_always_ included in the CLASSPATH by the startup scripts...

I have there JDBC drivers, xalan, xerces (in the common/endorsed-) and
it works fine.

And the second benefit of this directories is platform independence...
Simply you copy tomcat directory to UNIX or other Windoze with no
Control Panel hacking or other problems...

PETR


On 2/20/06, Richard Schilling [EMAIL PROTECTED] wrote:
 Dr. Exner:

 Don't dismay.  Sometimes it takes this listserve of volunteers time to
 answer questions.

 You didn't mention what platform you're using, but it appears to be
 Windows - by you mentioning the Windows control panel.

 /WEB-INF/server-config.wsdd was created, but you should check it for
 settings appropriate for your installation.  If it was there to begin
 with you might check the path your shortcut executes Tomcat in.

 As for the .jar files not being found, you might want to try setting the
 path that Tomcat starts in in the shortcut link.  There's a place to
 indicate what directory to run the program from.

 Richard Schilling
 Cognition Group, Inc.
 Seattle, WA





 Dr. Exner wrote:
  Hi,
 
  for a course including a short introduction and demo on web services I
  have to decide, whether to base it on java/tomcat/axis or on C#/.NET.
  Because I'm using xerces-j already in this course (and for some other
  reasons), I preffered the java solution. However, I hang with the test
  installation and I got no answer to my question from this list. Is there
  another chance for support with tomcat/axis or is C#/.NET the solution
  to my aim?
 
  The question was:
  
  with both, the preconfigured version from
  jakarta-tomcat-5.5.9-preconfigured.zip and the installation from
  apache-tomcat-5.5.15.exe I get the following startup messages:
 
  - Unable to find config file.  Creating new servlet engine config file:
/WEB-INF/server-config.wsdd
  - Unable to find required classes (javax.activation.DataHandler and
javax.mail.internet.MimeMultipart). ...
 
  However, the activation.jar (from jaf-1.0.2) is included in the
  CLASSPATH (via Windows Control Panel) correctly and a test
  application successfully uses the javax.activation.DataHandler class
  from this archive.
 
  I wouldn't care for this but the main reason for using tomcat (at the
  moment) is the axis-j toolset. While validating the axis installation with
  the happy axis page I get the same error:
 Error: could not find class javax.activation.DataHandler from file
 activation.jar
 Axis will not work.
  -
  For my understanding axis inherits the runtime environment from the
  tomcat server.
  Of course I experienced with the settings in the autoexec.bat file from
  the tomcat installation.
 
 
  Kind Regards
   D. Exner
 
 
  -
  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]




Re: Assistance required

2006-02-16 Thread Hadraba Petr
Try upgrade from GNU Java (which is the default JVM in the Fedora
distribution) to the Sun Java 5.

GNU Java has too many issues because of is not in the final version (I
remembere) :-(

PETR


On 2/16/06, Medha Parathasarathy [EMAIL PROTECTED] wrote:
 I have gone through the server.xml model given by the tomcat site.
 However when i try to test the connectivity using a java program :

 
 import java.sql.*;

 public class jdbc
 {
 public static void main(String args[]) throws Exception
 {
 Class.forName(com.mysql.jdbc.Driver);
 Connection con = 
 DriverManager.getConnection(jdbc:mysql://localhost/B2BData);
 Statement st = con.createStatement();
 ResultSet rs = st.executeQuery(select * from admuser);
 while(rs.next())
 {
 System.out.println(rs.getString(1));
 }
 con.close();
 }
 }

 ===
 when i compile the program with javac jdbc.java no eror is given however
 when i run the program i get the following errors :

 java ./jdbc
 Exception in thread main java.lang.NoClassDefFoundError: ./jdbc
at gnu.java.lang.MainThread.run() (/usr/lib64/libgcj.so.6.0.0)
 Caused by: java.lang.ClassNotFoundException: ./jdbc
at java.lang.Class.forName(java.lang.String, boolean,
java.lang.ClassLoader) (/usr/lib64/libgcj.so.6.0.0)
at gnu.java.lang.MainThread.run() (/usr/lib64/libgcj.so.6.0.0)

 Now i donot know what to do further.

 Regards


 Sarathy


 On Thu, 16 Feb 2006 15:41:49 +0530, Awaneesh Shatmanyu
 [EMAIL PROTECTED] said:
  Hi,
 
  You can visit the site www.coreservlets.com , it will help to configure
  the Tomcat.
  You would be able to get the examples of server.xml and web.xml too.
 
  Regards,
  Awaneesh Shatmanyu
 
 
 
  -Original Message-
  From: Medha Parathasarathy [mailto:[EMAIL PROTECTED]
  Sent: Thursday, February 16, 2006 11:29 AM
  To: Tomcat Users List
  Subject: Assistance required
 
  Hi,
 
  I am new to tomcat. I am trying to configure tomcat, jdbc and mysql. I
  am facing problem in the configuration of jdbc. Can some body assist me
  with a prototype of server.xml and web.xml
 
  environement fedore core4
 
  regards
 
 
  --
  http://www.fastmail.fm - A no graphics, no pop-ups email service
 
 
  -
  To unsubscribe, e-mail: [EMAIL PROTECTED]
  For additional commands, e-mail: [EMAIL PROTECTED]
 
 
 
 
  This email may contain confidential or privileged information for the
  intended recipient(s) and the views expressed in the same are not
  necessarily the views of Zensar Technologies Ltd. If you are not the
  intended
  recipient or have received this e-mail by error, its use is strictly
  prohibited, please delete the e-mail and notify the sender. Zensar
  Technologies Ltd. does not accept any liability for virus infected mails.
 
 
  -
  To unsubscribe, e-mail: [EMAIL PROTECTED]
  For additional commands, e-mail: [EMAIL PROTECTED]
 

 --
 http://www.fastmail.fm - Access all of your messages and folders
   wherever you are


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




Re: default webapp not understanding

2006-02-14 Thread Hadraba Petr
Hi,

no, you must delete whole the original contents of the existing
directory webapps/ROOT and deploy your own ROOT.war web application.
Be careful. The `ROOT' word is case sensitive.

The default URL mapping is:

http://[machine]:[port]/[context]/[servlet]/

where
machine is currently localhost, port is 8080 by default

context is in the context.xml file and usualy is the same as the web
application name
servlet: it's defined in web.xml servlet-mapping tag


If you deploy your application as ROOT application, the context path
will be only `/' (slash).


Chuck explains it to me (thank you Chuck!) one month before. Look into
the mailing-list history.

Hope to help you

Have a nice day!

PETR


On 2/14/06, Scott Purcell [EMAIL PROTECTED] wrote:
 Sorry, I didn't catch the other one.

 Tomcat 5.5x on xp

 If I deploy the webapp in ROOT, then the structure would look like this:
 $TOMCAT_HOME/webapps/root/mywebapp.
 And the index.html would still live in root .. isn't that correct. So I
 would still need a way to go from the root/index.html to the
 mywebapp/index.html correct?

 This is where it gets confusing.



 Thanks,

 -Original Message-
 From: Caldarale, Charles R [mailto:[EMAIL PROTECTED]
 Sent: Tuesday, February 14, 2006 10:46 AM
 To: Tomcat Users List
 Subject: RE: default webapp not understanding

  From: Scott Purcell [mailto:[EMAIL PROTECTED]
  Subject: default webapp not understanding
 
  I am having trouble understanding what is meant by the default webapp.

 (It would help if you'd tell us what Tomcat level you're running...)

 For 5.5.x, the default webapp is the one located in webapps/ROOT.war or
 the webapps/ROOT directory.

  Can I somehow configure this to go to the above
  $TOMCAT_HOME/webapps/mywebapp/index.html?

 Deploy your webapp in webapps/ROOT, not webapps/mywebapp.

  I get confused when the doc states that the entry in the host
  must also have a context entry? Can anyone clarify that.

 Where does it say that?  The current doc states that you _can_ nest
 Context tags inside Host, not that you must.  Putting Context tags
 in server.xml is strongly discouraged these days, but not all of the doc
 has caught up to that fact.

  Here from the docs
 
  Exactly one of the Hosts associated with each Engine MUST have a name
  matching the defaultHost attribute of that Engine.

 That attribute for simple Tomcat installations is localhost, which you
 already have.  Nothing to do with contexts.

  - 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 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]




Re: jdbc context

2006-02-13 Thread Hadraba Petr
Hi,

maybe helps this, but it's working on Tomcat 5.5.15:-(

http://mail-archives.apache.org/mod_mbox/tomcat-users/200602.mbox/[EMAIL 
PROTECTED]


PETR

On 2/13/06, chen jacky [EMAIL PROTECTED] wrote:
 hi,
   Do you mean add the following code in the web.xml?
 resource-ref
   descriptionDB Connection/description
   res-ref-namejdbc/TestDB/res-ref-name
   res-typejavax.sql.DataSource/res-type
   res-authContainer/res-auth
   /resource-ref

 But this still need to add the jdbc config in the server.xml,right?
 Can you give me some suggestions?

 From: Duan, Nick [EMAIL PROTECTED]
 Reply-To: Tomcat Users List users@tomcat.apache.org
 To: Tomcat Users List users@tomcat.apache.org
 Subject: RE: jdbc context
 Date: Mon, 13 Feb 2006 10:11:34 -0500
 
 You should be able to add the context info in your web.xml file.  In
 other words, instead of making the JDBC resource available to all web
 apps, you make it only to particular applications.  If this JDBC
 connection is only used by the workflow web app, defining it in web.xml
 is actually preferred.
 
 ND
 
 -Original Message-
 From: jacky [mailto:[EMAIL PROTECTED]
 Sent: Monday, February 13, 2006 5:07 AM
 To: users@tomcat.apache.org
 Subject: jdbc context
 
 hi,
 I have deploy a workflow webapp in Tomcat4.1.31. First time, i add
 the following code in server.xml:
 
 Context path=/myworkflow docBase=myworkflow reloadable=true 
Resource name=jdbc/DefaultDS type=javax.sql.DataSource/
ResourceParams name=jdbc/DefaultDS
parameter
   namemaxActive/name
  !-- Maximum number of DB connections in pool.Set to 0 for no limit.
 --
   value100/value
  /parameter
  parameter
   namemaxIdle/name
  !-- Maximum number of idle DB connections to retain in pool.Set to
 0 for no limit. --
   value30/value
  /parameter
  parameter
   namemaxWait/name
  !-- Maximum time to wait for a DB connection to become available in
 ms.An exception is thrown if this timeout is exceeded.Set to -1 to wait
 indefinitely. --
   value15000/value
  /parameter
  parameter
   nameremoveAbandoned/name
  !-- Abandoned DB connections are removed and recycled --
   valuetrue/value
  /parameter
  parameter
   nameremoveAbandonedTimeout/name
  !-- Use the removeAbandonedTimeout parameter to set the number of
 seconds a DB connection has been idle before it is considered abandoned.
 --
   value60/value
  /parameter
  parameter
   namelogAbandoned/name
  !-- Log a stack trace of the code which abandoned --
   valuefalse/value
  /parameter
  parameter
   namefactory/name
  !--DBCP Basic Datasource Factory --
   valueorg.apache.commons.dbcp.BasicDataSourceFactory/value
/parameter
 
 parameternameusername/namevaluesa/value/parameter
  parameternamepassword/namevalue/value/parameter
  parameternamedriverClassName/name
 
 valuecom.microsoft.jdbc.sqlserver.SQLServerDriver/value/parameter
  parameternameurl/name
 
 valuejdbc:microsoft:sqlserver://localhost:1433;databaseName=myworkflow
 /value/parameter
/ResourceParams
 /Context
 
 It works well. But now, we need to migrate myworkflow into another
 tomcat4.1.31, in which the server.xml can't be modified.
 So what shall i do to deploy the jdbc context? Thanks for your help!
 
   Best Regards.
 jacky
 
 
 -
 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]