RE: Tomcat application won't start with MySQL Connection Pooling

2005-08-08 Thread James Adams
 Please note the following for the path attribute in
 the Tomcat 5.5 doc for Context:

 The value of this field must not be set except when
 statically defining a Context in server.xml, as it
 will be infered [sic] from the filenames
 used for either the .xml context file or the 
 docBase.

 Also, examine the
 $CATALINA_HOME/conf/[enginename]/[hostname]/ 
 directory (usually conf/Catalina/localhost/), and
 remove any .xml files that might have been
 automatically created previously for your
application
 and restart Tomcat.


Thanks for pointing this out.  I have made the changes
and still I have the problem of my application failing
to start.

However it looks like this is not a problem with
Tomcat but instead a problem with Spring.  My
application is a Spring MVC application, and I am
trying to get the MySQL DBCP DataSource via JNDI.  It
appears that this is where the problem lies, since I
can remove this part of the Spring configuration and
the application starts fine when Tomcat is started. 
Also I can run the test JSP and access the MySQL DBCP
DataSource with no errors.  So it seems that I have
the correct MySQL DBCP configuration, just not the
right Spring configuration for accessing it via JNDI.

Thanks again for your help with this.


--James

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



Tomcat application won't start with MySQL Connection Pooling

2005-08-05 Thread James Adams
I have tried adding connection pooling for a MySQL
database in Tomcat 5.5 by following the steps
described 
[URL=http://jakarta.apache.org/tomcat/tomcat-5.0-doc/jndi-datasource-examples-howto.html]here[/URL].
 Now when I start Tomcat my application fails to load.
 The only message I can find in any of the logs is

Aug 5, 2005 12:40:44 PM
org.apache.catalina.core.StandardContext start
SEVERE: Error listenerStart
Aug 5, 2005 12:40:44 PM
org.apache.catalina.core.StandardContext start
SEVERE: Context [/ioifocus] startup failed due to
previous errors

 
Where can I look for further information on what is
causing the error?  I'm pretty sure that I have
followed the Tomcat Connection Pooling example
faithfully (I added the commons libraries to Tomcat's
lib directory, I modified my server.xml and web.xml as
shown, etc.), and the XML I added to the server.xml
appears to be valid.  In any event I will include the
XML which I added to Tomcat's server.xml just in case
anyone can see a mistake (the following is included
under the Host element which defines localhost):

Context path=/ioifocus
 docBase=ioifocus
 debug=5
 reloadable=true
 crossContext=true
 
Logger
className=org.apache.catalina.logger.FileLogger
prefix=localhost_ioifocus_log.
suffix=.txt
timestamp=true/
 
Resource name=jdbc/MySqlDataSource
  auth=Container
  type=javax.sql.DataSource/
 
ResourceParams name=jdbc/MySqlDataSource
parameter
namefactory/name
   
valueorg.apache.commons.dbcp.BasicDataSourceFactory/value
/parameter
 
!-- Maximum number of dB connections in pool.
Make sure you
 configure your mysqld max_connections
large enough to handle
 all of your db connections. Set to 0 for
no limit.
--
parameter
namemaxActive/name
value100/value
/parameter
 
!-- Maximum number of idle dB connections to
retain in pool.
 Set to -1 for no limit.  See also the
DBCP documentation on this
 and the minEvictableIdleTimeMillis
configuration parameter.
--
parameter
namemaxIdle/name
value30/value
/parameter
 
!-- Maximum time to wait for a dB connection
to become available
 in ms, in this example 10 seconds. An
Exception is thrown if
 this timeout is exceeded.  Set to -1 to
wait indefinitely.
--
parameter
namemaxWait/name
value1/value
/parameter
 
!-- MySQL username and password for database
connections  --
parameter
nameusername/name
valueadmin/value
/parameter
parameter
namepassword/name
valueadminpassword/value
/parameter
 
!-- Class name for the official MySQL
Connector/J driver --
parameter
namedriverClassName/name
valuecom.mysql.jdbc.Driver/value
/parameter
 
!-- The JDBC connection url for connecting to
the MySQL database --
parameter
nameurl/name
   
valuejdbc:mysql://localhost:3306/ioifocus/value
/parameter
 
!-- Insure that databse connections are
removed and recycled
 if they become abandoned by a web
application which doesn't
 close resources such as ResultSets,
Statements, or Connections --
parameter
nameremoveAbandoned/name
valuetrue/value
/parameter
 
/ResourceParams
 
/Context

 
Thanks in advance for any help with this!
 

--James



__ 
Yahoo! Mail for Mobile 
Take Yahoo! Mail with you! Check email on your mobile phone. 
http://mobile.yahoo.com/learn/mail 

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



RE: Tomcat application won't start with MySQL Connection Pooling

2005-08-05 Thread James Adams
 
 I'm curious: why are you using the documentation for
an
 older level to configure the current version? 
Things 
 have changed in this area (among others) between 5.0
 and 5.5.



You bring up a very good point, thanks for spotting
that for me.

I have now created a context.xml according to the
example in the Tomcat 5.5 documentation and this time
I've placed it my application's META-INF directory in
the WAR (since it was pointed out to me that this
approach is preferable to modifying the server.xml
file).  Unfortunately I still get the same errors as
before, with no more information in the log files
other than the cryptic SEVERE: Error listenerStart
message.

Below are the contents of my META-INF/context.xml
file.  Does anything look amiss now?  Perhaps I need
to enclose this Context entry with a Server,
Service, or Host entry?


--- META-INF/context.xml -

Context path=/ioifocus
 docBase=ioifocus
 debug=5
 reloadable=true
 crossContext=true

Resource name=jdbc/MySqlDataSource
  auth=Container
  type=javax.sql.DataSource
  maxActive=100
  maxIdle=30
  maxWait=1
  username=admin
  password=XXX
  driverClassName=com.mysql.jdbc.Driver
 
url=jdbc:mysql://localhost:3306/ioifocus
  removeAbandoned=true /

/Context 



Thanks in advance for any further help/insight...


--James

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



Re: Log4j initialization problem

2002-03-20 Thread James Adams

Hello,

I have tried the ServletContextListener approach suggested below by
Sriram (thanks !) and I am still having the same problem, i.e. I get the
log file (specified in my log4j.properties file) created under whatever
directory I am at when I issue the tomcat start command.  It appears
that the log file is being created and placed in the current working
directory if I specify only the file name in the log4j.properties
File entry.  If I specify the full path, such as

log4j.appender.A1.File=/var/tomcat/webapps/myapp/LogMessages.txt

then it creates and places the file exactly where it the entry
specifies.  But I want to just specify the filename and have it created
under the webapp's context directory, that way I won't have to remember
to change the log4j.properties entry whenever the webapp is moved to
another context directory or installed on another machine which might
have a different webapps directory path.

So is there a way to get the log file to be created and placed under its
webapp's context directory ?

Also would it be more appropriate to post this topic/thread to the log4j
user group ([EMAIL PROTECTED]) ?

Thanks in advance for any suggestions or clues.


-James



 Hello,

 I don't have access to my computer right now, but here's roughly what
I
 do to use log4J within my Servlet 2.3 API compliant webapps.

 1. Create a properties file called log4j.properties
 2. Place this in WEB-INF folder.
 3. Write a ContextListener and in the contectInitialized method,
access the
 servlet context. Make sure you place this Listener implementation
along
 with your other classes and that you add an entry for it in web.xml
 4. Ask the servlet context to get the following resource as a stream
 e.g. InputStream is =
 servletContext.getResourceAsStream(/WEB-INF/log4j.properties);
 5. Create a properties file that'll initialize with this property
file.
 Properties properties = new Properties();
 properites.load(is);
 is.close();
 6. Now pass this newly initialized properties object to the
 PropertyConfigurator...

 That's it.

 Sriram



--
To unsubscribe:   mailto:[EMAIL PROTECTED]
For additional commands: mailto:[EMAIL PROTECTED]
Troubles with the list: mailto:[EMAIL PROTECTED]




Log4j initialization problem

2002-03-19 Thread James Adams

Hello,

I am having the problem of Tomcat initializing/creating my Log4j log
files in whatever directory that Tomcat is started from.  In other words
if I am currently at directory /kung/foo when I issue the command
/etc/init.d/tomcat start, then my log files will be created under
/kung/foo instead of under the /path/to/webapp directory, which is where
I thought that they should be created.

I have the following WEB-INF/classes/log4j.properties file:


# Set root category priority to DEBUG and its only appender to A1.
log4j.rootCategory=DEBUG, A1

# A1 is set to be a RollingFileAppender.
log4j.appender.A1=org.apache.log4j.RollingFileAppender

log4j.appender.A1.File=LogMessages-trajview.txt
log4j.appender.A1.MaxFileSize=500KB

# Keep one backup file
log4j.appender.A1.MaxBackupIndex=2

# A1 uses PatternLayout.
log4j.appender.A1.layout=org.apache.log4j.PatternLayout
log4j.appender.A1.layout.ConversionPattern=%5p %d (%F:%L) - %m%n
-


The log4j stuff is being initialized/configured by a servlet which has
the following init() method:

---
public void init()
{
// gets the base directory to use, from the web application's
context
String prefix = getServletContext().getRealPath(/);

// this looks in the web.xml for the initialization file
parameter
// which points to log4j.properties
String file = getInitParameter(log4j-init-file);

// if the log4j-init-file is not set, then no point in trying
if (file != null)
{
// apply the configuration specified in the initialization
file
PropertyConfigurator.configure(prefix + file);
}
}
--


The above mentioned Log4j initialization servlet is being called at
loadup time by virtue of the following entry in my web.xml:

-
servlet
servlet-namelog4j-init/servlet-name
servlet-classmyapp.servlet.Log4jInit/servlet-class
init-param
param-namelog4j-init-file/param-name
param-valueWEB-INF/classes/log4j.properties/param-value
/init-param
load-on-startup1/load-on-startup
/servlet
-


Because I have three separate webapps which should all have their own
log files I would like to have the log files created in the separate
webapp directories, or perhaps better yet in a logs subdirectory under
each webapp directory.  For example if a webapp is under
/var/tomcat/webappps/myapp then I would like for the log file to be
created as /var/tomcat/webapps/myapp/LogMessages.txt or as
/var/tomcat/webapps/myapp/logs/LogMessages.txt.  How can I get this to
happen ?  Should I make a change to a log4j.properties entry, or perhaps
I'm making an error in my log4j initialization servlet's init() method
by referencing the wrong path in the getRealPath() call ?

Any suggestions will be appreciated.  Thanks in advance.


-James


--
To unsubscribe:   mailto:[EMAIL PROTECTED]
For additional commands: mailto:[EMAIL PROTECTED]
Troubles with the list: mailto:[EMAIL PROTECTED]




Not finding class, mistakenly looking for null

2002-02-14 Thread James Adams

Hello,

I have a web application which is not finding a tag handler class, it is mistakenly 
looking for null.  The classes for this tag
handler is located in the WEB-INF/classes directory and is declared in web.xml.  The 
web application works as advertised on another
system which is running Tomcat version 4.0.1.   This server is also at version 4.0.1 
but obviously it still needs some
configuration before things are as they should be.

Some things to consider:

* The front page of my application is a JSP which appears as it should.
* The default Tomcat page, index.html doesn't appear when I try http://localhost:8080, 
I get a 404 Not Found message
* When I go to a page which utilizes the custom tag I get the following exception 
messages:

org.apache.jasper.compiler.CompileException: 
/var/tomcat4/webapps/dataview/Level2InteractiveSelect.jsp(48,8) Unable to load class
null
at org.apache.jasper.compiler.TagBeginGenerator.init(TagBeginGenerator.java)
at 
org.apache.jasper.compiler.JspParseEventListener$GeneratorWrapper.init(JspParseEventListener.java)


The tag library class is properly declared in web.xml and has a proper tld in 
WEB-INF/tlds, or at least I think it is proper since
it is working on the other machine which is running version 4.0.1.  Perhaps I have my 
jsp or tlib versions in the tld mixed up
?  Here's the tld for the taghandler in question:


--

?xml version=1.0 encoding=ISO-8859-1 ?

!DOCTYPE taglib
  PUBLIC -//Sun Microsystems, Inc.//DTD JSP Tag Library 1.2//EN
  http://java.sun.com/dtd/web-jsptaglibrary_1_2.dtd;


taglib

  tlib-version1.1/tlib-version
  jsp-version1.2/jsp-version
  short-nameerrorMessages/short-name
  uri/uri
  descriptionA tag library to display error messages/description

  tag
namemessage/name
tag-classdataview.taghandler.ErrorMessagesTagHandler/tag-class
descriptionOutputs an error message corresponding to the key provided, if 
present/description
attribute
  namekey/name
  requiredfalse/required
/attribute
  /tag

/taglib

---


Can anyone suggest what to do or where to look in order to figure this out ?  This is 
an upgrade from Tomcat 3.2.1, perhaps there
are old files from the previous version which are wreaking havoc ?  The system in 
question is running Red Hat 7.2 and when I enter
the following command

rpm -qa | grep tomcat

I see both versions present.  Perhaps I should remove the tomcat-3.2.1-1 RPM ?

Thanks in advance for any suggestions.


-James


--
To unsubscribe:   mailto:[EMAIL PROTECTED]
For additional commands: mailto:[EMAIL PROTECTED]
Troubles with the list: mailto:[EMAIL PROTECTED]




Log messages

2002-01-25 Thread James Adams

Is there a class I can use to write log messages to the Tomcat log files
?  Can anyone explain how this is done ?  Also I have looked a wee bit
at java.util.logging - can this also be used, or is it a better solution
?

Thanks for any suggestions.

-James Adams


--
To unsubscribe:   mailto:[EMAIL PROTECTED]
For additional commands: mailto:[EMAIL PROTECTED]
Troubles with the list: mailto:[EMAIL PROTECTED]




NoClassDefFoundError: sun/tools/javac/Main

2001-11-16 Thread James Adams

I am trying to get Tomcat working on an SGI - IRIX machine.  I can get
the example Tomcat page (index.html) as well as the example servlets.
However the example JSPs and my own JSPs are not being served and give
errors, such as:


001-11-16 12:22:04 - Ctx() : Compiling: /dataview/DataCenterFrameset.jsp
to
dataview.DataCenterFrameset_0
2001-11-16 12:22:04 - Ctx() : Class not found:
dataview.DataCenterFrameset_1
2001-11-16 12:22:04 - Ctx() : Status code:404 request:R(  +
/dataview/DataCenterFrameset.jsp +
null) msg:null


and when I try one of the example JSP I get:


java.lang.NoClassDefFoundError: sun/tools/javac/Main
at
org.apache.jasper.compiler.SunJavaCompiler.compile(SunJavaCompiler.java:136,
Compiled Code)
at
org.apache.tomcat.facade.JasperLiaison.javac(JspInterceptor.java:783,
Compiled Code)
at
org.apache.tomcat.facade.JasperLiaison.processJspFile(JspInterceptor.java:633,
Compiled Code)
at
org.apache.tomcat.facade.JspInterceptor.requestMap(JspInterceptor.java:446,
Compiled Code)
at
org.apache.tomcat.core.ContextManager.processRequest(ContextManager.java:968,
Compiled Code)
at
org.apache.tomcat.core.ContextManager.internalService(ContextManager.java:875,
Compiled Code)
at
org.apache.tomcat.core.ContextManager.service(ContextManager.java:833,
Compiled Code)
at
org.apache.tomcat.modules.server.Http10Interceptor.processConnection(Http10Interceptor.java:161,
Compiled Code)
at
org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:477,
Compiled Code)
at
org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:519,
Compiled Code)
at java.lang.Thread.run(Thread.java:484, Compiled Code)


Can anybody suggest what I might look for in order to correct this
situation ?  I am using Tomcat 3.3 and SGI Irix 6.5.  Thanks in advance
for any suggestions.

-James


--
To unsubscribe:   mailto:[EMAIL PROTECTED]
For additional commands: mailto:[EMAIL PROTECTED]
Troubles with the list: mailto:[EMAIL PROTECTED]




Re: NoClassDefFoundError: sun/tools/javac/Main

2001-11-16 Thread James Adams

I have heard that perhaps I need to make sure that tools.jar is in
Tomcat's CLASSPATH.

How can I determine the environment variables being used by Tomcat
?  Where are these set ?  I assume that there is a config file which is
handling this...

Thanks for suggestions,

-James


--
To unsubscribe:   mailto:[EMAIL PROTECTED]
For additional commands: mailto:[EMAIL PROTECTED]
Troubles with the list: mailto:[EMAIL PROTECTED]




Why am I getting a Javascript file request instead of my servlet ?

2001-11-14 Thread James Adams

I have a page (JSP) which contains a form with a servlet as the action
of the form.  However whenever I submit the form I am getting a Not
Found 404 error telling me that a Javascript file which is used for
Javascript on the page is not found.  I am perplexed as to why this is
happening, especially since the Javascript is working as it should.  I
should instead be forwarded to the servlet which will handle the form
parameters.  Can anyone suggest ways to find out what is going wrong
?  Thanks in advance for any suggestions...

-James




--
To unsubscribe:   mailto:[EMAIL PROTECTED]
For additional commands: mailto:[EMAIL PROTECTED]
Troubles with the list: mailto:[EMAIL PROTECTED]




Why am I getting a Javascript file instead of my servlet ?

2001-11-14 Thread James Adams

I have a page (JSP) which contains a form with a servlet as the action
of the form.  However whenever I submit the form I am getting a Not
Found 404 error telling me that a Javascript file which is used for
Javascript on the page is not found.  I am perplexed as to why this is
happening, especially since the Javascript is working as it should.  I
should instead be forwarded to the servlet which will handle the form
parameters.  Can anyone suggest ways to find out what is going wrong
?  Thanks in advance for any suggestions...

-James


--
To unsubscribe:   mailto:[EMAIL PROTECTED]
For additional commands: mailto:[EMAIL PROTECTED]
Troubles with the list: mailto:[EMAIL PROTECTED]




Re: Why am I getting a Javascript file request instead of my servlet ?

2001-11-14 Thread James Adams

As a test I have set the action of the form equal to alert(1) as well as
to a test JSP which prints the form parameters, both of these work
well.  However when the action is my form handler servlet that's when I
get the bad voodoo - it tells me that it can't find the .js file when I
submit, and it shows that it is looking for the file in the same
directory as where the servlet would be located.  Why it is looking for
the .js file instead of the servlet which is the specified action of the
form ?  All other form actions I've tried seem to work OK, but my
servlet has some Javascript monkey business happening with it that just
shouldn't be happening, but why is not obvious.

-James


--
To unsubscribe:   mailto:[EMAIL PROTECTED]
For additional commands: mailto:[EMAIL PROTECTED]
Troubles with the list: mailto:[EMAIL PROTECTED]




Re: Why am I getting a Javascript file request instead of my servlet ?

2001-11-14 Thread James Adams

[EMAIL PROTECTED] wrote:


   

 Subject: Why am I getting a Javascript file request instead of my servlet ?
 Date: Wed, 14 Nov 2001 12:11:49 -0700
 From: James Adams [EMAIL PROTECTED]
 To: [EMAIL PROTECTED]

 I have a page (JSP) which contains a form with a servlet as the action
 of the form.  However whenever I submit the form I am getting a Not
 Found 404 error telling me that a Javascript file which is used for
 Javascript on the page is not found.  I am perplexed as to why this is
 happening, especially since the Javascript is working as it should.  I
 should instead be forwarded to the servlet which will handle the form
 parameters.  Can anyone suggest ways to find out what is going wrong
 ?  Thanks in advance for any suggestions...

 -James



It appears that this was a case of losing track of the context.

I have fixed my problem by setting the location of the Javascript file using 
%=request.getContextPath()% and all is well now.

Thanks Raj for your suggestion, this got me past today's obstacle.


-James


--
To unsubscribe:   mailto:[EMAIL PROTECTED]
For additional commands: mailto:[EMAIL PROTECTED]
Troubles with the list: mailto:[EMAIL PROTECTED]




Re: Taglibs Jasper CompileException

2001-10-02 Thread James Adams

It turns out that the unterminated description element which was causing
the CompileException was actually in the web.xml file.  Strange that I
never get any errors or exceptions when web.xml is processed during a
restart of Tomcat.

-James




How to get an Applet to run in a JSP ?

2001-10-02 Thread James Adams

I have an applet which runs fine when I include it in a HTML page, but
whenever I try to include it in a JSP I get a pop-up message from my
browser (Netscape 4.78) telling me that I need to download the Java
plugin. I get the same behavior when testing with Internet Explorer.
Obviously I already have the plugin or else I wouldn't be able to see
the applet from the HTML page, or is this a mistaken assumption ?

I am using Tomcat 3.2.1 and Apache 1.3.19.

The HTML looks like this:


!DOCTYPE HTML PUBLIC -//W3C//DTD HTML 4.01 Transitional//EN
html
head
titleData Selection/title
meta http-equiv=Content-Type content=text/html; charset=iso-8859-1

/head
body
form name=main_form method=post action=mailto:[EMAIL PROTECTED];

bh3Select Lat/Lon Region:/h3/b

table border=1
tr
td
applet CODE=LiveMap_30.class
ARCHIVE=LiveMap_30.jar
NAME=map
MAYSCRIPT
WIDTH=500
HEIGHT=160
param name=base_image  value=gifs/java_0_world_20k.jpg
param name=img_x_domain value=-180 180
param name=img_y_domain value=-90 90
param name=toolType value=XY
param name=tool_x_range value=-180 180
param name=tool_y_range value=-90 90
/applet
/td
/tr
/table
input type=hidden name=min_lat value=
input type=hidden name=max_lat value=
input type=hidden name=min_lon value=
input type=hidden name=max_lon value=
p
input type=submit name=Process Request value=Process Request
/p
/form
/body
/html
--


The JSP looks like this:

--
!DOCTYPE HTML PUBLIC -//W3C//DTD HTML 4.01 Transitional//EN
html
head
titleData Selection/title
/head
body
form name=main_form method=post action=mailto:[EMAIL PROTECTED];
bh3Select Lat/Lon Region:/h3/b
jsp:plugin type=applet
code=/WEB-INF/classes/LiveMap_30.class
archive=/WEB-INF/lib/LiveMap_30.jar
name=map
width=500
height=160
jsp:params
jsp:param name=base_image
value=/WEB-INF/images/java_0_world_20k.jpg/
jsp:param name=img_x_domain value=-180 180/
jsp:param name=img_y_domain value=-90 90/
jsp:param name=toolType value=XY/
jsp:param name=tool_x_range value=-180 180/
jsp:param name=tool_y_range value=-90 90/
jsp:param name=mayscript value=true/
/jsp:params
/jsp:plugin
input type=hidden name=minLat value= 
input type=hidden name=maxLat value= 
input type=hidden name=minLon value= 
input type=hidden name=maxLon value= 
br
p
input type=submit name=Process Request value=Process Request
/p
/form
/body
/html
--


Is it possible that I have to include some entries in my
$TOMCAT_HOME/WEB-INF/web.xml file so that Tomcat will know about the
applet, something like

applet
applet-nameLiveMap/applet-name
applet-class/WEB-INF/classes/LiveMap_30.class/applet-class
/applet


The code for this applet is at
http://tmap.pmel.noaa.gov/~callahan/JAVA/map_v3.0/LiveMap_30.java


Any ideas or suggestions will be very appreciated.


-James




Taglibs Jasper CompileException

2001-10-01 Thread James Adams

I am getting a weird exception message when I try to use a taglib.  I
hope somebody reading this forum can enlighten me.  This is my first
foray into using taglibs.

I have a JSP which has the following lines of code in place to use my
taglib:


%@ taglib uri=/WEB-INF/errorMessages-taglib.tld
   prefix=errorMessages %

  errorMessages:message key=all /


I have the taglib descriptor file under the web application's WEB-INF
directory named errorMessages-taglib.tld and it looks like this:

-
?xml version=1.0 encoding=ISO-8859-1 ?

!DOCTYPE taglib
  PUBLIC -//Sun Microsystems, Inc.//DTD JSP Tag Library 1.1//EN
  http://java.sun.com/j2ee/dtds/web-jsptaglibrary_1_1.dtd;

taglib

  tlibversion1.0/tlibversion
  jspversion1.1/jspversion
  shortnameerrorMessages/shortname
  urn/urn
  infoA tag library to display error messages/info

  tag
namemessage/name
tagclassdataview.taghandler.ErrorMessagesTagHandler/tagclass
infoOutputs an error message corresponding to the key provided, if
present/info
bodycontentEMPTY/bodycontent
attribute
  namekey/name
  requiredfalse/required
/attribute
  /tag

/taglib
--


I have included a taglib entry in my web.xml which looks like:


taglib
taglib-urierrorMessages/taglib-uri

taglib-location/WEB-INF/errorMessages-taglib.tld/taglib-location
/taglib



Unfortunately I am getting a Jasper compile exception when I attempt to
load the page, telling me that it can't open the tld and that I need to
terminate a description element, even though there is no description
element in the tld (included above).  Below is the exception I get:


Internal Servlet Error:
org.apache.jasper.compiler.CompileException:
/var/tomcat/webapps/dataview/Select.jsp(8,4) Unable to open taglibrary
/WEB-INF/errorMessages-taglib.tld : Parse Error in the tag library
descriptor: Next character must be  terminating element
description.
at
org.apache.jasper.compiler.JspParseEventListener.handleDirective(JspParseEventListener.java)

at
org.apache.jasper.compiler.DelegatingListener.handleDirective(DelegatingListener.java)

at org.apache.jasper.compiler.Parser$Directive.accept(Parser.java)
at org.apache.jasper.compiler.Parser.parse(Parser.java)
at org.apache.jasper.compiler.Parser.parse(Parser.java)
at org.apache.jasper.compiler.Parser.parse(Parser.java)
at org.apache.jasper.compiler.Compiler.compile(Compiler.java)
at org.apache.jasper.servlet.JspServlet.doLoadJSP(JspServlet.java)
at org.apache.jasper.servlet.JasperLoader12.loadJSP(JasperLoader12.java)

..


Can anybody see what it is that I'm doing wrong ?  I thought that I had
followed the examples in the references I've looked at but obviously
something's not working as advertised.  However the exception message
doesn't make any sense in the context (though this is unfortunately
typical of most exception messages), and there is nothing which I can
see which relates to my tag library descriptor, so I am thinking that
perhaps this exception is happening someplace else.  In any event I'm
clueless as to how I might proceed, I've tried several different
approaches (moving the tld to a different directory, using a different
or no taglib in web.xml, etc.) but with no luck at all.

Thanks in advance for any suggestions or solutions.


-James




How to make a URL map to a servlet ?

2001-09-26 Thread James Adams

I have a servlet which looks at the request, makes sure that there is a
Session and the necessary beans included in the Session and then directs
to a JSP page.  I want to be able to enter a URL and get the servlet
(which will direct me to the JSP).

I have the JSP in $TOMCAT_HOME/webapps/myapp/Myapp.jsp and the servlet
in $TOMCAT_HOME/webapps/myapp/WEB-INF/classes/Servlet.

Can anyone tell me how I can set things up so that I can enter a URL and
get the servlet to run ?  I have tried using URL's such as
http://myserver.my.domain:8080/myapp/Servlet and
http://myserver.my.domain:8080/myapp/servlet/Servlet but these don't
appear to work.  I'm stumped.

I'm running Tomcat version 3.2.1-1, the OS is Red Hat 7.0.

Thanks in advance for any suggestions or insight.  Please Cc:
[EMAIL PROTECTED] if you can.


-James




Re: How to make a URL map to a servlet ?

2001-09-26 Thread James Adams

Thanks for the quick response Lester.

I thought web.xml might be the key.  I have actually already added some
entries to web.xml in order to try to get this to work but I guess I'm not
quite there yet.  Here's what I have so far, perhaps somebody can tell me what
I'm doing wrong:

-

?xml version=1.0 encoding=ISO-8859-1?

!DOCTYPE web-app
PUBLIC -//Sun Microsystems, Inc.//DTD Web Application 2.3//EN
http://java.sun.com/j2ee/dtds/web-app_2_3.dtd;

web-app
  display-nameMOPITT Data Selection/display-name
  session-timeout30/session-timeout
  servlet
servlet-nameServlet/servlet-name
servlet-classServlet/servlet-class
  /servlet
  servlet
servlet-nameSelectValidator/servlet-name
servlet-classSelectValidator/servlet-class
  /servlet
/web-app

-

Thanks,
James




Lester June Cabrera wrote:

 Hi James,

 Tomcat is bundled with a build utility. By editing /etc/web.xml in your
 development directory, you should be able to map your servlet class to your
 desired URL.

 Lester

 At 01:58 AM 9/26/01 -0600, you wrote:
 I have a servlet which looks at the request, makes sure that there is a
 Session and the necessary beans included in the Session and then directs
 to a JSP page.  I want to be able to enter a URL and get the servlet
 (which will direct me to the JSP).
 
 I have the JSP in $TOMCAT_HOME/webapps/myapp/Myapp.jsp and the servlet
 in $TOMCAT_HOME/webapps/myapp/WEB-INF/classes/Servlet.
 
 Can anyone tell me how I can set things up so that I can enter a URL and
 get the servlet to run ?  I have tried using URL's such as
 http://myserver.my.domain:8080/myapp/Servlet and
 http://myserver.my.domain:8080/myapp/servlet/Servlet but these don't
 appear to work.  I'm stumped.
 
 I'm running Tomcat version 3.2.1-1, the OS is Red Hat 7.0.
 
 Thanks in advance for any suggestions or insight.  Please Cc:
 [EMAIL PROTECTED] if you can.
 
 
 -James




Re: How to make a URL map to a servlet ?

2001-09-26 Thread James Adams

One other thing, my web.xml file is located as
$TOMCAT_HOME/webapps/myapp/WEB_INF/web.xml and not as /etc/web.xml - is this
perhaps where I've gone wrong ?

-James


Lester June Cabrera wrote:

 Hi James,

 Tomcat is bundled with a build utility. By editing /etc/web.xml in your
 development directory, you should be able to map your servlet class to your
 desired URL.

 Lester

 At 01:58 AM 9/26/01 -0600, you wrote:
 I have a servlet which looks at the request, makes sure that there is a
 Session and the necessary beans included in the Session and then directs
 to a JSP page.  I want to be able to enter a URL and get the servlet
 (which will direct me to the JSP).
 
 I have the JSP in $TOMCAT_HOME/webapps/myapp/Myapp.jsp and the servlet
 in $TOMCAT_HOME/webapps/myapp/WEB-INF/classes/Servlet.
 
 Can anyone tell me how I can set things up so that I can enter a URL and
 get the servlet to run ?  I have tried using URL's such as
 http://myserver.my.domain:8080/myapp/Servlet and
 http://myserver.my.domain:8080/myapp/servlet/Servlet but these don't
 appear to work.  I'm stumped.
 
 I'm running Tomcat version 3.2.1-1, the OS is Red Hat 7.0.
 
 Thanks in advance for any suggestions or insight.  Please Cc:
 [EMAIL PROTECTED] if you can.
 
 
 -James




Re: How to make a URL map to a servlet ?

2001-09-26 Thread James Adams

So if my machine is named server.ucar.edu, and my servlet's class file
is located as
$TOMCAT_HOME/webapps/myapp/WEB-INF/classes/servlet/Servlet.class then I
should have an entry like the following in my web.xml:

servlet-classserver.ucar.edu.myapp.sevlet.ServletClass/servlet-
class

I've tried the above approach but still no joy - maybe I'm still using
the wrong URL.  Any hints on what I should use as my URL ?

Thanks for the help...

-James


 Hi
 Well, you have to put the full path to the servlet in the servlet-
 class
 tag.. like
 servlet-classorg.whatever.whoever.ServletClass/servlet-
 class
 Hope this helps
 Red




Re: How to make a URL map to a servlet ?

2001-09-26 Thread James Adams

 Hi James

 Add the following to your web.xml which is located in the  WEB-INF
directory

 servlet
 servlet-namemyServlet/servlet-name
 display-namemyServlet/display-name
 descriptionThe description for my  servlet/description
 servlet-class  server.ucar.edu.myapp.sevlet.ServletClass
 /servlet-class
   /servlet

   servlet-mapping
 servlet-namemyServlet/servlet-name
 url-pattern/myurlmapping/url-pattern
   /servlet-mapping

 Now you should be able to access the servlet by
 http://domain/myurlmapping
 to quote the example above...

 Hope you get it working...
 Donie



Well I've given the above a whirl and still no joy.  I'll outline what
I've done so far:

My host name is host.acd.ucar.edu.

I'm calling my application datacenter.

My servlet is in a package called dataview.servlet.

My servlet's class file:
$TOMCAT_HOME/webapps/datacenter/WEB-INF/classes/dataview/servlet/Select.class

I have the following web.xml:

-
?xml version=1.0 encoding=ISO-8859-1?

!DOCTYPE web-app
PUBLIC -//Sun Microsystems, Inc.//DTD Web Application 2.3//EN
http://java.sun.com/j2ee/dtds/web-app_2_3.dtd;

web-app

  display-nameSimple Test of MOPITT Data Center/display-name
  session-timeout30/session-timeout

  servlet
servlet-nameSelect/servlet-name
display-nameSelect/display-name
descriptionA servlet which validates/initializes the Session and
forwards to the data/views selection form page/description

servlet-classelbrus.acd.ucar.edu.datacenter.dataview.servlet.Select/servlet-class

  /servlet

  servlet-mapping
servlet-nameSelect/servlet-name
url-pattern/Select/url-pattern
  /servlet-mapping

/web-app
-


I am using the following URLs, with the results listed:

http://host.acd.ucar.edu:8080/datacenter/Select
Not Found (404), not found request

http://host.acd.ucar.edu/datacenter/Select
Not Found  (being sent from Apache Server)

I have been able to get the Servlet to work with the following URL:

http://host.acd.ucar.edu:8080/datacenter/servlet/dataview.servlet.Select

but this isn't exactly what I had in mind.

Any further help is greatly appreciated.


-James




Re: Rep: Image Not Found

2001-09-07 Thread James Adams

Vijaya you win the prize, having .. in front of the URL made all the
difference.  Thanks so much !

-James



 Vijaya Kumar wrote:
 
 Well, If your image locates like below
 
 /webapps
 /your_Appln
 /webinf
 
  related class files
 
 /images
 
 place all the image files here
 
 then try the url mapping using ../images/imagename. Hope it'll work,
 b'cas
 I'm usingurl(../images/bg1.jpg)   in my stylesheet. Note I'm
 using two
 periods.
 
 Here is some patches:
 Insdide Servlet
   pw.println(htmlheadLINK href='../style/mystyle.css'
 rel=stylesheet type=text/css/head);
 
 In Style Sheet
 
 body
 {
  background: url(../images/bg1.jpg) fixed
 }
 a
 {
  text-decoration:none
 }
 
 Rgds
 Vijay
 
  -Original Message-
  From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]On Behalf Of
 James
  Adams
  Sent: Friday, September 07, 2001 12:49 AM
  To: [EMAIL PROTECTED]
  Subject: Image file not found - why not ?
 
 
  I have a JSP which tries to load an image which is
  referenced by a URI which is set in the request by a servlet.
 
  img src=%= request.getAttribute(imageURL) %
   alt=IMAGE NOT FOUND
 
  Unfortunately this has never worked because Tomcat can never
  find the image.  Perhaps I am using a bad URI ?  I have the
  image located under my application's base directory in a
  subdirectory
  named images.  The URIs I've tried are images/MyImage.jpg,
  ./images/MyImage.jpg and
  /images/MyImage.jpg, all of which are not found when I
  view the page.
 
  Can anyone please tell me what I'm doing wrong ?  Thanks in
  advance for all suggestions, and email of the responses would be
  appreciated if possible ([EMAIL PROTECTED]).
 
 
  -James
 



Image file not found - why not ?

2001-09-06 Thread James Adams

I have a JSP which tries to load an image which is 
referenced by a URI which is set in the request by a servlet.

img src=%= request.getAttribute(imageURL) % 
 alt=IMAGE NOT FOUND

Unfortunately this has never worked because Tomcat can never 
find the image.  Perhaps I am using a bad URI ?  I have the
image located under my application's base directory in a
subdirectory
named images.  The URIs I've tried are images/MyImage.jpg,
./images/MyImage.jpg and
/images/MyImage.jpg, all of which are not found when I 
view the page.

Can anyone please tell me what I'm doing wrong ?  Thanks in
advance for all suggestions, and email of the responses would be
appreciated if possible ([EMAIL PROTECTED]).


-James



JSP page not found - any ideas why ?

2001-08-23 Thread James Adams

Hello,

I am attempting to set up my first web application using Tomcat.  I have
taken the following first steps but still no enchilada - the initial JSP
isn't found when I try to access it (Not Found 404):

- I have put a JSP in a directory named $TOMCAT_HOME/james1.  The JSP is
named Test1.jsp and I'm trying to access it via the URL 
http://localhost:8080/james1/Test1.jsp.

- I have modified $TOMCAT_HOME/conf/server.xml with a context for the
web application with the following entry:

Context path=/james1
 docBase=webapps/james1
 crossContext=false
 debug=0
 reloadable=true 
/Context

- I have restarted Tomcat (not sure if that was necessary).


The JSP uses a servlet whose class is available in
$TOMCAT_HOME/james1/WEB-INF/classes, but I doubt that this is a problem
since the page can't even be located.

I am using Tomcat version 3.2.1 on a RedHat 7.0 machine.


Any help or suggestions will be greatly appreciated !  Thanks in
advance...


-James



Re: JSP page not found - any ideas why ?

2001-08-23 Thread James Adams

I made a mistake in the previous posting - the JSP is actually located
in the directory $TOMCAT_HOME/webapps/james1, not $TOMCAT_HOME/james1 as
I originally posted.  Unfortunately it appears that my problem isn't as
simple as the erroneous posting leads you to believe.  :(

Still stuck...


-James



James Adams wrote:
 
 Hello,
 
 I am attempting to set up my first web application using Tomcat.  I have
 taken the following first steps but still no enchilada - the initial JSP
 isn't found when I try to access it (Not Found 404):
 
 - I have put a JSP in a directory named $TOMCAT_HOME/james1.  The JSP is
 named Test1.jsp and I'm trying to access it via the URL
 http://localhost:8080/james1/Test1.jsp.
 
 - I have modified $TOMCAT_HOME/conf/server.xml with a context for the
 web application with the following entry:
 
 Context path=/james1
  docBase=webapps/james1
  crossContext=false
  debug=0
  reloadable=true 
 /Context
 
 - I have restarted Tomcat (not sure if that was necessary).
 
 The JSP uses a servlet whose class is available in
 $TOMCAT_HOME/james1/WEB-INF/classes, but I doubt that this is a problem
 since the page can't even be located.
 
 I am using Tomcat version 3.2.1 on a RedHat 7.0 machine.
 
 Any help or suggestions will be greatly appreciated !  Thanks in
 advance...
 
 -James



Re: JSP page not found - any ideas why ?

2001-08-23 Thread James Adams

Thanks so much - the problem was due to my modification of server.xml. 
I've removed the modification and restarted Tomcat and now I can see my
pages fine.

-James

 

Jeff Turner wrote:
 
 Have a read of:
 http://jakarta.apache.org/tomcat/tomcat-3.2-doc/appdev/index.html
 
 Specifically the bit where it says Copy unpacked directory hierarchy
 into a subdirectory in directory $TOMCAT_HOME/webapps/.
 
 Ie, if you want http://localhost:8080/james1/Test1.jsp to work, you need
 to put the JSP in $TOMCAT_HOME/webapps/james1/Test1.jsp, and restart
 Tocmat.
 
 You only need to modify  if your webapp resides outside the
 $TOMCAT_HOME/webapps/ directory (it auto-deploys from there).