JNDI Issue with GlobalNamingResources DefaultContext Solved

2003-12-14 Thread Peter Harrison
Earlier I had posted messages and bug reports about a change of behaviour 
between 4.0.4 and 4.1. Previously I had defined a resource and resource 
parameters in the default context. This stopped working in 4.1, and I 
couldn't find a way that would allow me to both Autodeploy while keeping the 
datasource.

Resources defined in the DefaultContext do not work, while if the same entries 
are put into a specific Context they do work.

So what is the fix? Here is what I have done to get things working, including 
Autodeploy. Note that this is a fix for V5 - I havn't tried this yet on 4.1.

1. Move the resource and resourceparams to GlobalNamingResources.

2. Create a xml file under $tomcat_home/conf/Catalina/localhost in the name of 
the context:

Context path=/boo docBase=boo debug=0 privileged=true
ResourceLink name=jdbc/boo 
global=jdbc/boo type=javax.sql.DataSource /
/Context

The context entry will not block the deployment of the application, and the 
database will init correctly. Hope this helps people.

Regards,

Peter



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



Re: Servlets with JDBC connectivity

2003-12-03 Thread Peter Harrison
On Wed, 03 Dec 2003 16:18, Todd O'Bryan wrote:

 How do people handle this elegantly? The requirements are: a single,
 globally visible (within a webapp) database interface and the ability
 to access multiple databases easily.

The first point is to use a singleton to set up the database connection - or 
more correctly the connection pool. This way you can request a connection and 
return it to the pool easily. Of course every time you use one you will have 
to use try-catch blocks. Sorry no way around that.

However, if you are clever you will create data objects to hide all that 
stuff. Even better - why not get something to write all those horrid data 
objects - sql and trycatch blocks for you.

Last year we (another developer any myself) developed a project called sysmod, 
which essentially takes a xml description of a database schema and turns it 
into Java code and a real SQL schema. This is by no means a unique approach - 
tools like JBuilder allow you to use graphical UI's and UML to do something 
similar - and is even two way.

However, our approach is somewhat lighter. All we have is the XML model. The 
model generates the Java data objects. The code includes comments such that 
it creates nice JavaDoc as well, so in effect you have a self documenting 
business model from the XML. At this stage we have to write very little SQL, 
and no SQL at all for updating and adding records.

The actions (we use struts) become very simple because in addition to being 
able to load and save themselves from a database they can also load 
themselves from a request, therefore our code looks something like this:


Client client = ClientFactory.newClient();
client.loadFromRequest( client, request );
client.saveChanges();

This code essentially loads all the fields from the request prefixed by 
client into the data object. Then the call to saveChanges() saves the 
record to the database. The data objects also handle their own SQL 
exceptions, although they throw their own exceptions.

The Factory for each data object also provides lists of various kinds, ie you 
can call ClientFactory.findAll() and it will return a list of Client objects 
prefilled by a single query. You can also do a findByQuery with parameters to 
define the query.

The approach works very well, but is not without its drawbacks. It is quite 
easy to code things which look logical but create hundreds of queries and is 
inefficient. We are still working on ways to improve the system, such as 
caching data. It is also limiting - in that while it creates DataObjects it 
is not a trrue object hiracy. This is because the system is still based on a 
relational database. In other words this system is not a relational mapping 
tool. It is also not a object database.

However, it does provide a quick and easy way to prototype databases and the 
Java code to access it. Currently the system creates objects that are not JDO 
or EJB.

If you are interested I can provide it - 

Regards,

Peter Harrison

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



Re: JNDI-lookup fails with GlobalResources

2003-11-14 Thread Peter Harrison
On Fri, 14 Nov 2003 23:47, Martin Monsorno wrote:
 Hi *,

 I recently installed tomcat 4.1.29 and deployed a web application on
 it via a war-file.  The provided server.xml contains the following
 lines:



 So obviously, putting values into JNDI context fails.  (If I set the
 value in web.xml instead as an env-entry, everything goes well.)

 Have I forgotten to do some additional initialization or configuration
 or something else?  Any ideas?

It doesn't work :(

Either go to Tomcat 4.04 - I know that works - or you have to define the 
resources in a specific Context - which will prevent the war unpacking. So 
you have to run tomcat with no context first - so the thing unpacks (or do it 
manually), and then insert a context with appropriate resources and restart 
tomcat so the webapp runs.

I reported the bug on Bugzilla:

http://nagoya.apache.org/bugzilla/show_bug.cgi?id=22677

However, it appears to have been 'resolved' - by providing a work around, 
which doesn't appear to work. The issue is that you can't find any resource 
in the defaultcontext or the globalnamingresources.

This bug means I'm still on 4.0.4 until it gets resolved.

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



Re: need help

2003-11-03 Thread Peter Harrison
On Mon, 03 Nov 2003 21:42, S.Gokul wrote:
 Hi,

 I do have jdk1.3 installed and I have made the changes in the startup.bat
 file in the tomcat bin folder. But still I am not able to run it.

 It starts up and then after a few seconds it closes the tomcat window. I
 think its throwing some java exception. Can u help me out.

If you are running under Windows98, and you are trying to use a PIF - (like a 
shortcut), you must make sure the memory allocation is set to 4096 bytes. If 
you keep it set to auto the startup fails. Or at least it did years ago 
when I last tried using it under 98.

The problem is that the classpath and system variables set up by the startup 
scripts run out of space.

Hope this helps.

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



Re: Missing jdbc context

2003-10-27 Thread Peter Harrison
On Thu, 23 Oct 2003 00:59, Johann Uhrmann wrote:
 Hello,

 I have some problems with Tomcat 4.1.27 and database connection pooling:

 Apparently, the context java:comp/env/jdbc does not exist.
 Can someone give me a hint why that context is not available?

This sounds suspeciously like the resource issue around DefaultContect and 
GlobalResources.

Try moving everything from the GlobalResources to a specific Context for your 
web application. You will need to do this *after* you deploy it, otherwise a 
war will not unpack.

If it works under the manually defined context you will know the issue is a 
known bug. There have been rumours this issue has been resolved, although I 
have not been able to do a build myself yet from the CVS tree to test it 
again (I tried). I'm pretty sure its not in any official release yet.

However, 4.0.4 does work - we are currently using this version on our live 
machines.

Regards,
Peter

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



Re: redirect port 8080 to 443

2003-10-11 Thread Peter Harrison
On Sat, 11 Oct 2003 17:38, Bill Barker wrote:
 It's in the FAQ:
 http://jakarta.apache.org/tomcat/faq/security.html#https

 Twan Munster [EMAIL PROTECTED] wrote in message
 news:[EMAIL PROTECTED]
 Hello,

 I'm using apache+mod_ssl+mod_jk to make a secure connection.
 But every time I call a page in cocoon it is called through port 8080. Is
 it possible to redirect a call to port 8080  to port 443? And not for the
 entire server, but only for a certain directory?How is this done?

Assuming you have configured tomcat correctly to handle SSL its simply a 
matter of using https:// rather than http:// in you URL's.

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



Re: What is a good dev-enviroment for servlet/tomcat?

2003-10-08 Thread Peter Harrison
On Thu, 09 Oct 2003 07:54, epyonne wrote:
 IMHO, instead of one instance per developer, I think you should have one
 development server with one instance of Tomcat shared by the 3 developers.
 If each of them is working on individual project, each developer can has
 his/her own application directory in Tomcat.  And if they are working as a
 team on one project, you can use a version control software like CVS to
 control it.

Don't think I agree with this. We are always stopping and starting Tomcat in 
our environment. We have four developers, each with their own database and 
tomcat. We use CVS and do a intergration build every morning on all the 
development machines to ensure no check ins have broken anything.

In terms of IDE - I have been using eclipse, other developers like jEdit, or 
even - god forbid - vim. We don't use netbeans as if forces you to use a odd 
directory structure. Our structure is something like

/project
/project/doc - documention
/project/bin - classes
/project/dist - for war file or jars
/project/jsp - jsp's
/project/model - business model
/project/src - source code.

Most tools can handle different paths for these things - probably netbeans can 
too - but we found netbeans rather slow. We use mainly lightweight tools. 
Also, idea deserves a mention, and although it costs it has some nice 
refactoring features.

Sorry - don't want to start a general IDE flamewar, so this will be the last I 
say on this subject :)


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



Re: Tomcat 5.0.12: Does DataSourceRealm work inside a Context?

2003-10-06 Thread Peter Harrison
On Tue, 07 Oct 2003 07:34, Matt Raible wrote:
 I've having this same issue with Tomcat 4.1.27 - has anyone gotten this to
 work?  My resource name is jdbc/appfuse and I've tried:

 java:/comp/env/jdbc/appfuse
 jdbc/appfuse
 appfuse

 And none of them work - the same error:

 Name java is not bound in this context
 Name jdbc is not bound in this context
 Name appfuse is not bound in this context

 It thougt this might be caused by having my Realm stuff before my
 Resource stuff, but after moving, I still get the same errors.

I have posted a bug today here:
http://nagoya.apache.org/bugzilla/show_bug.cgi?id=23634

While it is not identical I think its the same issue that many of us have been 
having. 

Also, I was wondering if anyone felt like me about Bugzilla - I found is very 
unclear - and can't be certain that a bug report I wrote earlier is not 
there. It was somewhat frustrating as a system. I have developed a bug 
tracking system for my own development. Would anyone be interested in seeing 
it (its a Tomcat web app of course).

Regards,
Peter

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



Re: JNDI+dbcp Can't find my jdbc driver

2003-10-05 Thread Peter Harrison
On Mon, 06 Oct 2003 13:51, Josh G wrote:

 Tried that, still nothing. And there's nothing showing up in
 var/mysql.log either. Is there any way to dig up where exactly the
 problem is between tomcat and mysql?

A known issue was with putting the resources under either the default context 
or the global resources. If you do thins you end up with various errors. This 
might not be the same issue of course. To fix it place the resources in a 
Context you intend to run under.

Regards,
Peter

PS : Anyone have success at posting bugz on bugzilla for Tomcat. I reported 
this bug in detail, but can't seem to find it - as if its been delt with - 
but I can't find it.

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



Re: JNDI+dbcp Can't find my jdbc driver

2003-10-05 Thread Peter Harrison
On Mon, 06 Oct 2003 14:55, Josh G wrote:

 Unfortunately it's already in a specific context as far as I can tell :(
 I've downloaded the source to dbcp and it seems it's throwing a
 SQLException on DriverManager.getDriver(url) but there's no reason I can
 see that it should, as the url it returns worked just fine when we were
 doing it the old fashioned way, the only difference is we called
 getConnection instead of calling getdriver and doing things seperately
 like dbcp does. Anybody know why getDriver would throw a SQLException
 where getConnection would not?

There are a few other issues as well. There is a new and old way of doing the 
connection parameters. The old way had a parameter called 'user' - which has 
been changed to 'username' - and 'url' replaced 'Driver'. If you are using 
DBCP then you need to use 'username' and 'url'.

Below is an example that I use myself (with some changes to protect the 
innocent):

DefaultContext debug=0 reloadabe=true

Resource name=jdbc/foo 
auth=Container
type=javax.sql.DataSource/

ResourceParams name=jdbc/foo

parameter
namefactory/name
valueorg.apache.commons.dbcp.BasicDataSourceFactory/value
/parameter

parameter
namemaxActive/name
value100/value
/parameter

parameter
namemaxIdle/name
value30/value
/parameter

parameter
namemaxWait/name
value1/value
/parameter

parameter
namevalidationQuery/name
valueSELECT 1;/value
/parameter

parameter
nameremoveAbandoned/name
valuetrue/value
/parameter

parameter
nameremoveAbandonedTimeout/name
value500/value
/parameter

parameter
nameusername/name
valuebill/value
/parameter

parameter
namepassword/name
valuezap/value
/parameter

parameter
namedriverClassName/name
valueorg.postgresql.Driver/value
/parameter

parameter
nameurl/name
valuejdbc:postgresql://localhost/foo/value
/parameter

/ResourceParams
/DefaultContext

 This is really starting to get ridiculous, I've spent way too long
 trying to make this work, and I'm pulling my hair out so to speak.

I know how you feel. Trying to get this working under 4.1.27 was impossible 
due to the afforementioned bug - so I'm still on 4.0.4. I spent two or three 
days trying everything. Wish I had time to get in and debug it - 

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



Re: DataSource and JNDI problem at Tomcat 4+Apache

2003-10-01 Thread Peter Harrison
On Thu, 02 Oct 2003 01:01, Tuna Vardar wrote:

 What can be the cause for the exception I mentioned above? Any comments?

Sounds very similar to the issue I had when trying to move to 4.1.27. When I 
moved from 4.0.4 to 4.1.27 the exact same issue arose. If you put everything 
under a context it should be okay.

Have you simply added the connector to an existing install, or did you try a 
new install with the connector? Also, the warp connector is actually old - 
isn't the Apache connector for 4.1.X the AJP connector?

Regards,
Peter

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



Re: Tomcat on Linux

2003-09-29 Thread Peter Harrison
On Mon, 29 Sep 2003 06:42, Joao Medeiros wrote:
 Hi folks,

 I've decided to start doing some testing on Tomcat under Linux for which
 I have installed Redhat 8 which is now up and running, downloaded the
 JSDK for Linux which is also setup and downloaded the Tomcat files but
 before I go ahead and start installing it I was wondering if you could
 help me out determining a few things:

 - Shall I create a new user, i.e. 'Tomcat' and install the server under
 it or shall I just put it under ROOT? I know that if I do choose to
 install it under a different user other than ROOT I'll have to setup
 special execute permissions so the server can run on port 80 for
 instance...

I have generally set up Tomcat under my own user account and run it on 8080. 
If you are in production you should be running Apache on the front end 
anyway, although I suggest you set up a tomcat account under users if this 
is the case, and install tomcat in /usr/local/tomcat. You don't need to do 
anything clever to make it work - tomcat runs without any special 
permissions.

I have however installed the JDK under /usr/local/java, and given execute 
permissions, but not write permissions. In other words its a standard JDK 
install if performed under root. I havn't dealt with permissions to TCP port 
80 if tomcat isn't running as root, so I can't help there.

 - I read somewhere that in order for Tomcat to run as a daemon one will
 have to use the jsvc tool. Has anyone got any experience in doing it?

I have a script which runs on boot to start tomcat on my production boxes. It 
can be found online easy enough. Essentially the script calls startup.sh. I 
have been running Tomcat on Linux for at least four years now - since 1999 
when I first got into this technology.

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



Single Login Authentication with Tomcat

2003-09-22 Thread Peter Harrison
I was wondering it anyone knows how to do NT based one login authentication 
with web applications. I was hoping there is some way a client can be 
authenticated based on their system login.

Obviously there would have to be a common authentication service like LDAP or 
Active Directory involved. Is there some kind of Applet or ActiveX component 
which can be used to transmit something back to the server to authenticate?

Regards,
Peter

PS : I know you can have a Realms based login - the question is how to use the 
system login to authenticate web apps.

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



Re: a beginner pb

2003-09-21 Thread Peter Harrison
On Mon, 22 Sep 2003 00:51, itsme reda wrote:

 but i ve a pb to run some servlets that i ve put in a
 test folder under webapps . every thing is correct
 because i got those servlet from a cd of a book. the
 pb that i get when i call this servlet from the
 browser- knowing that the url introduced is correct
 -is 404
 can anyone help me to resolve this pb

First of all putting some servlets in a folder under webapps won't nessasarily 
work. At the very least you need the following structure:

/WEB-INF directory
/WEB-INF/classes directory
/WEB-INF/web.xml file

The web.xml file can be very minimal, but is required in order for tomcat to 
recognise it as a web application. Also, how are you calling the servlet? If 
you want to call a servlet directly it usually looks somthing like:

http://localhost:8080/test/servlet/com.foo.MyTestServlet

However, if you want to have a more friendly URL you can create a mapping in 
the web.xml file like this:

servlet
servlet-nametest/servlet-name
servlet-classcom.foo.MyTestServlet/servlet-class
/servlet

servlet-mapping
servlet-nametest/servlet-name
url-patterntest/url-pattern
/servlet-mapping

Regards,
Peter

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



Re: WAR

2003-09-18 Thread Peter Harrison
On Thu, 18 Sep 2003 19:11, Jerald Powel wrote:
 Hello,

 Can anyone tell me, what is the purpose of the WAR file, how does one
 create / implement it? Where may I find doco about WAR please?

A WAR file is a web application archive. Essentially its a compressed file 
with all the files you need for your web application in the appropriate 
directory structure. When you put a WAR file into the webapps directory of 
tomcat it automatically uncompresses the file and creates a new context 
without having to explicitly write the context yourself.

The following article on OnJava.com should provide you will a good start:
http://www.onjava.com/pub/a/onjava/2001/04/19/tomcat.html

You might also consider purchasing a good book. For example, in Mastering 
Tomcat Development on page 381 there is a description of how to set up Ant 
to build and deploy web applications.

http://www.wiley.com/WileyCDA/WileyTitle/productCd-0471446629.html


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



Re: Cannot load JDBC driver class 'null'

2003-09-17 Thread Peter Harrison
On Fri, 12 Sep 2003 00:16, Ben Anderson wrote:
 Ok, I know this topic has been posted many times, but I can't find anything
 to help.



There is no help - its a bug. I tried posting a bug on Bugzilla, but I can't 
find the bug any longer. I'm still running 4.0.4 because I can't easily move 
to 4.1.27 until this is resolved. I'll try to fix it myself when I get time.

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



Re: Cannot load JDBC driver class 'null'

2003-09-17 Thread Peter Harrison
On Fri, 12 Sep 2003 04:41, Ben Anderson wrote:
 I moved the Resource and ResaourceParams tags to myApp.xml and put it
 in the webapps folder(with the war).  I'm still getting the exact same
 errors.

More specifically, in 4.1.27 you can't define your JDBC resources in either 
the DefaultContext or the GlobalResources. You need to explicitly define a 
Context for your webapp, and insert the resources into that context.

If however you are trying to deploy by copying a war into webapps then you are 
out of luck, because by having a context it won't unpack the war :(

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



Re: Can not load JNDI DataSource in Servlet.init()

2003-08-26 Thread Peter Harrison
On Tue, 26 Aug 2003 09:04, Madere, Colin wrote:
 Well then it may be something else.  I'm essentially doing what you are
 with a JNDI datasource defined in the DefaultContext with nothing in the
 web.xml (except to pass along the JNDI name so it's not hard-coded).  It
 breaks for me (and a bunch of other people posting recently using 4.1.x)
 when I try to move that to GlobalNamingResources and use a ResourceLink.

I have tried various configurations. If there is nothing in the web.xml you 
get a different error, and the error occurs earlier, ie in init phase. If 
there is a reference in the web.xml the init of the connection pool appears 
to work, but fails with the null exception when you try to obtain a 
connection.

Bottom line is the same problem has two different sets of errors depending on 
the configuration. 

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



Re: Globally defined JNDI DataSource (was: JNDI DataSource Realm)

2003-08-24 Thread Peter Harrison
On Thu, 21 Aug 2003 12:08, Madere, Colin wrote:
 Yep.  Here's server.xml with edits.  Anyone else doing this JNDI datasource
 stuff with DefaultContext?

Yes, I am having the same problem. 

There are now three threads on this issue, one suggesting the issue is being 
caused by the DataSource factory not being defined.



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



Re: Question about Tomcat Documentation

2003-08-23 Thread Peter Harrison
From previous message:

 I was thinking that maybe now there's a default factory that can handle 
 things, but now when I run the App I get an exception:

 Cannot load JDBC driver class 'null'

 Which makes me think the default factory is not correct. So is the 
 documentation wrong, or are there cases where it can work with the 
 default factory?

On Sat, 23 Aug 2003 09:16, Madere, Colin wrote:
 Possibly the same as the issue in this recent thread:

 Tomcat 4.1 DefaultContext Bug?, regarding DefaultContext resources not
 being available to implicit contexts, check archives.

Yes, this sounds like exactly the problem I am having. It is working when the 
resource is put into the standard Context, but not when its put into the 
Global Resources or Default Context.

Is there a solution anyone knows of?

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



Re: Tomcat 4.1 DefaultContext Bug?

2003-08-21 Thread Peter Harrison
On Thu, 21 Aug 2003 15:26, Kwok Peng Tuck wrote:
 Specifically what problems do you have when running the app as a  war
 file  ?

The main problem I think is that Velocity requires files. You supply the 
directory, and it accesses them from the filesystem. If you don't unpack 
Velocity can't find its files. There is probably a way around this so that 
Velocity can use the war directly, however I was hoping to simply migrate 
from 4.0 to 4.1, and was hoping it would just be a minor configuration issue 
to get it going.

I've read the 4.1 documentation, and from what I can see the specification in 
terms of the DefaultContext hasn't changed, although they are definitly 
behaving differently. Perhaps its time to look at the code :)



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



Tomcat 4.1 DefaultContext Bug?

2003-08-20 Thread Peter Harrison
I have spent the last three days trying everything to move from 4.0 to 4.1. 
The problem is with the datasources. When the resource is in a specific 
Context everything works, but when its in the DefaultContext I am getting a

java.sql.SQLException: Cannot load JDBC driver class 'null'

The server.xml has a resource defined:

Resource name=jdbc/foo auth=Container type=javax.sql.DataSource/

ResourceParams name=jdbc/foo
parameternameuser/namevaluefoo/value/parameter
parameternamepassword/namevaluebar/value/parameter
parameternamedriverClassName/name
valueorg.postgresql.Driver/value/parameter
parameternameurl/name

valuejdbc:postgresql://localhost/foo/value/parameter
/ResourceParams

My web.xml now has:

 resource-ref
  descriptionFoo Database/description
  res-ref-namejdbc/foo/res-ref-name
  res-typejavax.sql.DataSource/res-type
  res-authContainer/res-auth
  /resource-ref


The driver is there - since I it works when the Context is specific. The 
problem however is that a Context that is specified will block unpacking of a 
war. There are some issues with using the war directly without unpacking - so 
I need to define the datasource in the DefaultContext. However this isn't 
working.

Simply changing from DefaultContext to Context solves the problem - proving 
that it is the DefaultContext which doesn't appear to work.

Help :)

Peter

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



Issue moving from 4.0 to 4.1

2003-08-18 Thread Peter Harrison
I am moving from Tomcat 4.0 to 4.1, and I am having an issue with the 
DefaultContext.

With 4.0 we had an entry under the DefaultContext that sets up a resource for 
our connection pool.

   DefaultContext debug=0 reloadabe=true

  Resource name=jdbc/project auth=SERVLET
type=javax.sql.DataSource/

  ResourceParams name=jdbc/project
parameternameuser/namevaluefoo/value/parameter
parameternamepassword/namevaluebar/value/parameter
parameternamedriverClassName/name
  valueorg.postgresql.Driver/value/parameter
parameternamedriverName/name
  valuejdbc:postgresql://localhost/foo/value/parameter
  /ResourceParams

/DefaultContext

Each time we deploy we would delete the old project directory and put a new 
jar file in the webapps directory. Under T 4.0.X this works fine. However, 
under 4.1 I have tried the same thing with no luck. I know there was a change 
- that user changes to username and driverName to url in the JNDI parameters:

   DefaultContext debug=0 reloadable=false

  Resource name=jdbc/project auth=SERVLET
type=javax.sql.DataSource/

  ResourceParams name=jdbc/project
parameternameusername/namevaluefoo/value/parameter
parameternamepassword/namevaluebar/value/parameter
parameternamedriverClassName/name
  valueorg.postgresql.Driver/value/parameter
parameternameurl/name
  valuejdbc:postgresql://localhost/foo/value/parameter
  /ResourceParams

/DefaultContext

however I am still getting the following error:
javax.naming.NameNotFoundException: Name jdbc is not bound in this Context

If I specify the resource in a specific Context all is well - except that the 
war file doesn't unpack. If I have the resources in the DefaultContext it 
appears to be ignored.

Help.

Regards,
Peter

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



Re: IO Exception: Connection reset by peer: socket write error

2003-01-15 Thread Peter Harrison
On Thu, 16 Jan 2003 10:37, Lior Shliechkorn wrote:
 Hi,

 I'm running an app from a remote location (Chicago) with a database located
 in New York. I know this is not by any means a recommended practice,
 however, it's for testing purposes. My question is why this is occuring?
 The application works fine, but if I try to access it after a little time
 has passed I get that exception thrown.

A wild guess might be that the connection is being reset by the DB after a 
peiod of non-use, which throws an IO Exception the next time the DB is 
accessed by the web app. Usually a SQL exception would be thrown however, so 
don't treat this suggestion as gospel.

I know at least two databases which have this behaviour (Postgres, and some 
versions of Interbase).

Regards,

Peter

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




Re: WARP (Apache-Tomcat)

2003-01-14 Thread Peter Harrison
On Wed, 15 Jan 2003 10:58, enLogica wrote:
 I am attempting to setup Tomcat 4.1 with Apache 2.0.4.  Per the
 instructions in my book I am suppose to download the Web Application
 Module for Apache in order to allow these two to talk, but it is not
 listed on
 http://modules.apache.org/search.

Perhaps:
http://jakarta.apache.org/builds/jakarta-tomcat-4.0/archives/v4.0.1/bin

I had problems finding it again when deploying against apache yesterday.

Regards,

Peter

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




Re: servlet with Tomcat

2003-01-14 Thread Peter Harrison
On Wed, 15 Jan 2003 09:57, Steve R Burrus wrote:
  Nicole, that's really fine and good that you bothered to send me a web
 page that purportedly offers me some free advice on how the hell I go about
 seeing/viewing a compiled servlet, BUT I really thought that you could, if
 you would please, directly give some help on editing that web.xml file!

There are a number of good sources for information. The Servlet API 2.3 
specification provides the official standard for the XML web application 
configuration descriptor - web.xml. The tomcat documentation itself provides 
a pretty reasonable overview. Finally you might consider purchasing a book on 
the subject.

Regards,

Peter Harrison

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




Re: jsp versus xml syntax

2003-01-14 Thread Peter Harrison
On Wed, 15 Jan 2003 10:45, Erik Price wrote:

 But in that JSP, there is a conditional test to determine whether or not
 certain links should be displayed.  Namely, administrative functions
 should not be displayed to users who don't have administrative access.
 The way I have it right now is an if statement in a scriptlet, which
 displays the appropriate HTML depending on the user's session
 information (the user is represented with a bean, and it checks one of
 the properties of the bean to make this decision).

 I know that this is how a lot of JSPs are written, so it's not
 necessarily *bad*.  But you seem to be hinting at a better way of doing
 it.  My best guess is that you're referring to creating a custom tag of
 some sort that displays the navigation, and the logic for what to
 display should be tucked away into the tag definition?  I'm only
 guessing here.  If you could expound a bit that would be helpful for a
 lot of us, I'm sure.

The problem is essentially one of demarkation. If you say its okay for a 
developer to add a little bit of code they might get the idea its okay to add 
a little more. When its easier to add a little bit of code to a JSP to fix a 
problem you will do it - because the negitive design consequences are down 
the track. Its easier to have a hard and fast rule than to have a fuzzy rule 
that leads to misunderstandings.

Some problems you run into when putting code into a JSP :

- It makes it dificult to write unit tests for the included code.
- reduces and discourages the reuse of code.
- encourages 'cut and paste' - which reduces maintainability.
- means that page designers and coders work on the same file.

I personally like to use velocity with struts, as velocity doesn't allow 
business logic in HTML, is less verbose, and doesn't have the same debugging 
issues I found with JSP. Struts allows a rather elegant solution to the 
problem mentioned above about having multiple response pages to a single 
request.

shameless plug
For those interested about my thinking and approach with Velocity you might 
like to read the book I co-authored called 'Mastering Tomcat Development'.
/shameless plug

Regards,

Peter Harrison

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




Re: installation problems: tomcat 3.2.2+ apache 1.3.20 + jetspeed 1.3.a1 on suse linux

2001-06-28 Thread Peter Harrison



This means there is already 
somethinglistening on one of the ports tomcat listens to, ie either 8080 
or 8007. Is there something else listening to port 8080, such as 
Apache?

  - Original Message - 
  From: 
  Sumit Ranjan 
  To: [EMAIL PROTECTED] 
  
  Sent: Friday, June 29, 2001 4:08 PM
  Subject: installation problems: tomcat 
  3.2.2+ apache 1.3.20 + jetspeed 1.3.a1 on suse linux
  
  hi!
  can anyone help me with installation of Tomcat 
  3.2.2+ Apache 1.3.20 + jetspeed 1.3.a1 on suse linux.
  i have done everything as per the installation 
  instruction yet wwhen i try to start tomcat it does not start and shows an 
  error : java.net.bindexception: address already in 
  use.
  
  Sumit 
Ranjan


Re: FIRST POST - Servlet installation problem

2001-06-27 Thread Peter Harrison

You need to at least change working.properties file to point to the correct
directories.


- Original Message -
From: Clifford P. Helsel [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Thursday, June 28, 2001 2:46 PM
Subject: RE: FIRST POST - Servlet installation problem


 Hi Jann,

 I haven't modified anything in the jakarta-tomcat-3.2.2\conf directory.
 I have a feeling that I should but I couldn't find anything in the docs
 that explained what to put there... Am I supposed to modify anything?
 Any pointer to better docs?

 Thanks,
 Cliff.


 -Original Message-
 From: Jann VanOver [mailto:[EMAIL PROTECTED]]
 Sent: Wednesday, June 27, 2001 10:41 PM
 To: '[EMAIL PROTECTED]'
 Subject: RE: FIRST POST - Servlet installation problem

 Have you added a mapping in Tomcat's urlworkermap.properties file ?

 -Original Message-
 From: Clifford P. Helsel [mailto:[EMAIL PROTECTED]]
 Sent: Wednesday, June 27, 2001 7:40 PM
 To: [EMAIL PROTECTED]
 Subject: RE: FIRST POST - Servlet installation problem
 Importance: High


 This does not solve one problem, that of redirection, or rather
 accessing the Servlet through IIS.  By going to port 8080 I am still
 using the Tomcat engine to serve the page:

 For example, in my configuration, this URL works

 http://localhost:8080/myservlet/servlet/myservlet

 However, this does not (and I would expect it to)

 http://localhost/myservlet/servlet/myservlet

 Thanks,
 Cliff.

 -Original Message-
 From: Peter Davison [mailto:[EMAIL PROTECTED]]
 Sent: Wednesday, June 27, 2001 10:32 PM
 To: [EMAIL PROTECTED]
 Subject: Re: FIRST POST - Servlet installation problem

 Hi Clifford.

 Note the lack of :8080 in the URL you mention.

 Try this:

 http://localhost:8080/servlet/myservlet

 and see if that works any better.

 P.

 CH I'm using the url: http://localhost/servlet/myservlet
 CH