|
From: Ken K. <kk...@kk...> - 2003-06-21 19:16:33
|
Spring Petclinic Demo/tutorial Application
************************************************
Author: Ken Krebs kk...@kk...
Date: 21-JUNE-2003
NOTE: This document is VERY VERY VERY PRELIMINARY !!! I'm just getting started.
I will actually be providing more detailed installation instructions as well as the
tutorial instructions.
Tools I Used
============
Java SDK 1.4.1_01
Ant 1.5.1
JUnit 3.8.1
Tomcat 4.1.18
Hypersonic SQL 1.7.1 OR Mysql 3.23.53 with mysql-connector-java-2.0.14-bin.jar
spring-full-0.8.jar compiled with files available on 21-JUNE-2003
Primary Ant Targets
===================
clean --> Cleans output dirs
build --> Compile main source tree java files into class files
webapp --> Builds the web application archive
docs --> Create Javadoc API documentation
test --> Run tests & reinitialize database
all --> Clean,build,webapp,docs,test
NOTE: Ant will need to have a copy of the db and JUnit jars in it's lib directory.
Directory Structure
=========================================================================================
f-- indicates a file
d-- indicates a directory
D-- indicates a directory that is created by the Ant build script
d-- Petclinic1 : the root directory of the project
f-- build.xml : the Ant build script
f-- build.properties : a properties file for the Ant build script
d-- src : Java source file directory tree
d-- websrc : the web application source directory tree
d-- test : a parallel testing directory tree
d-- db : database sql scripts and related files
d-- hsqldb : directory for files related to HSQL, contains scripts and context defs
d-- mysql : directory for files related to MYSQL, contains scripts and context defs
f-- petclinic_tomcat_all.xml : context definition for all db's
f-- build.xml : Ant script for populating/emptying the database
D-- build : compiled .class files
D-- dist : Java archive files
D-- docs : Javadoc files
D-- war : the web application image from which the .war file is generated
IMPORTANT NOTE: Edit the build.properties file in the project root directory to select or configure the database and
set local file specifications for your installation.
Database Overview
=================
Support has been provided for use with either MYSQL or HypersonicSQL (default). SQL text scripts are provided for
database creation. Ant scripts are provided for database population. XML files are provided for setup of Tomcat pooled
connection datasources. There are separate applicationContext.xml files provided for the tests and the webapp. The
webapp use a JNDI pooled connection supplied by Tomcat. The test version uses DriverManagerDataSource connections.
The files db/hsqldb directory can be copied to another location and the database HSQL database can be started from there.
There are Windows batch files provided containing the Java commands for starting the HSQL server and manager that can be
run by double-clicking. The petclinic.script file will then initialize the HSQL database automatically.
owners - PK id
types (as in pet types) - PK id
pets - PK id, FK type_id, FK owner_id
vets - PK id
specialties - PK id
vet_specialties (link table) - FK vet_id, FK specialty_id
visits - PK id, FK pet_id
NOTE: Each table has a corresponding table with a "_seq" suffix added to its name. These tables are used to provide primary keys.
There is not yet a lot of sample data that has been provided. When exploring the application, the most interesting owner names to search on are "Davis" and "Coleman". I will probably add more sample data later.
If you wish to add to the sample data, please send me your insert script code and I will integrate it.
Spring Framework Parts Demonstrated
===================================
Beans
- XmlBeanFactory (singleton & prototype)
- InitializingBean
- BeanUtils
- CustomDateEditor
Context
- ApplicationContext
- ClassPathXmlApplicationContext
- ApplicationContextAware
- ApplicationContextException
- ResourceBundleMessageSource
Logging support
- Commons Log & Logfactory
- Log4J configuration
Validation
- Validator
- Errors
Web application
- ContextLoaderListener
- DispatcherServlet
- BindTag
- ResourceBundleViewResolver
- JstlView
- RedirectView
- SimpleUrlHandlerMapping
- PropertiesMethodNameResolver
- AbstractFormController
- SimpleFormController
- ServletRequestDataBinder
- ModelAndView
- MultiActionController
JDBC support
- MappingSqlQuery
- SqlParameter
- SqlUpdate
- DriverManagerDataSource
- AbstractDataFieldMaxValueIncrementer
- HsqlMaxValueIncrementer
- MySQLMaxValueIncrementer
JNDI support
- JndiObjectFactoryBean
Business Classes
================
petclinic.Clinic (interface) - The high-level business interface API
petclinic.ClinicImpl - The default implementation of Clinic.
Provides caches of all specialties, all vets, all pet types,
as well as owners and their pets and visits that have been found.
JavaBeans:
petclinic.Entity (simple JavaBean superclass of all database related Javabeans)
petclinic.NamedEntity (adds name property to Entity, used to provide specialties and pet types)
petclinic.Person (superclass of Vet and Owner)
petclinic.Vet (holds List of specialties)
petclinic.Owner (holds List of pets)
petclinic.Pet (holds List of visits)
petclinic.Visit
Exceptions:
petclinic.NoSuchIDException (unchecked)
Validators:
petclinic.validation.FindOwnerValidator
petclinic.validation.OwnerValidator
petclinic.validation.PetValidator
petclinic.validation.VisitValidator
Persistence Classes
===================
petclinic.ClinicDAO (interface) - The high-level persistence interface API
petclinic.ClinicJdbcDAO - The default implementation of ClinicDAO.
Provides inner class Data Access Objects that implement
8 types of Queries, 3 types of Inserts, and 2 types of Updates.
NOTE: The business and persistence classes are COMPLETELY independent of the presentation layer.
Presentation (web application) Classes
======================================
petclinic.web.ClinicController - subclass of MultiactionController to handle simple display oriented URL's
petclinic.web.AbstractSearchFormController - subclass of SimpleFormController adds the notion of a search form via an abstract search method,
OnSubmit triggers display of 1 of 3 views :
formView : if no items found
selectView : if multiple items found
successView : if a single item found
petclinic.web.FindOwnerForm - subclass of petclinic.web.AbstractSearchFormController which implements the search method
petclinic.web.AbstractClinicForm - subclass of SimpleFormController that is the superclass of the Add and Edit forms
petclinic.web.AddOwnerForm - used to add a new Owner
petclinic.web.EditOwnerForm - used to edit an existing Owner
petclinic.web.AddPetForm - used to add a new Pet
petclinic.web.EditPetForm - used to edit an existing Pet
petclinic.web.AddVisitForm - adds a new Visit
petclinic.WebUtils - provides static utility methods
Test Classes
============
petclinic.ClinicImplTest - a simple and incomplete JUnit test class for ClinicImpl
Views & Implemented Use Cases
=============================
welcomeView - home screen provides links to display vets list, find an owner, or view documentation
vetsView - displays all vets and their specialties
findOwnersForm - allows user to search for owners by last name
findOwnersRedirectView - redirects to findOwnerForm
selectOwnerView - allows user to select from multiple owners with the same last name
ownerView - displays a user's data and a list of the owner's pets and their data
ownerRedirect - redirects to ownerView
ownerForm - allows adding/editing an owner
petForm - allows adding/editing a pet
visitForm - allows adding a visit
NOTE: All views are implemented using JSP & JSTL
JSP Pages
=========
NOTES: all JSP's are stored under /WEB-INF/jsp except for index.jsp which is the configured "welcome-file".
The use of JSP technology in the appplication is not exposed to the user.
All pages are simple implementations focusing only on functionality.
index.jsp - redirects to the welcome page.
includes.jsp - statically included in all JSP's, sets session="false" and specifies the taglibs in use.
uncaughtException.jsp - the configured "error-page" displays a stack trace.
welcome.jsp - displays links to search for an owner or display the vets page.
vets.jsp - displays a list of vets and their specialties.
findOwners.jsp - displays a form allowing the user to search for an owner by Last Name.
owners.jsp - displays a list of owners meeting the search criteria with a selection button for each owner.
owner.jsp - displays an owner and the pets owned along with the visit history.
ownerForm.jsp - displays a form that allows adding or editing an owner.
petForm.jsp - displays a form that allows adding or editing a pet.
visitForm.jsp - displays a form that allows adding a visit.
The following JSP's each display a form field and the bound error data for that field.
address.jsp
city.jsp
telephone.jsp
lastname.jsp
firstname.jsp
The following JSTL tags are used:
c:out
c:redirect
c:url
c:forEach
c:if
fmt:message
fmt:formatDate
NOTE: I welcome ANY comments, criticisms, or suggestions. The application is intentionally
incomplete but if you have suggestions for additions that provide useful, additional tutorial
value, I would be glad to hear them. Version 1 of the tutorial is intended to provide an
introduction to the core functionality of Spring, not its more advanced features.
Ken Krebs
kk...@kk... |
|
From: <tri...@tr...> - 2003-06-22 16:03:52
|
Ken, I have installed the code, but I am having trouble with the connection pool while starting up the application. I have checked everything - username, password, port. I can connect using mysql command line tool, but not using this connection pool. Tried three different versions of MySQL drivers - older versions seems to hang the server, while the most recent one gives a connection error. I am clueless - any ideas? This is the error I get: Apache Tomcat/4.1.10 DBCP borrowObject failed: java.sql.SQLException: Unable to connect to any hosts due to exception: java.net.BindException: Address already in use JDBC Driver: mysql-connector-java-3.0.8-stable-bin.jar This is the server environment: Server Version Apache Tomcat/4.1.10 JVM Version 1.4.0_02-b02 JVM Vendor Sun Microsystems Inc. OS Name Linux OS Version 2.2.20-idepci OS Arch i386 This is the context configuration: <Context className="org.apache.catalina.core.StandardContext" cachingAllowed="true" charsetMapperClass="org.apache.catalina.util.CharsetMapper" cookies="true" crossContext="false" debug="4" displayName="petclinic1" docBase="/home/tom/public_html/www.springframework.org/webapps/petclinic" mapperClass="org.apache.catalina.core.StandardContextMapper" path="/webapps/petclinic" privileged="false" reloadable="true" swallowOutput="false" useNaming="true" wrapperClass="org.apache.catalina.core.StandardWrapper"> <Resource name="jdbc/petclinicMYSQL" auth="Container" type="javax.sql.DataSource"/> <ResourceParams name="jdbc/petclinicMYSQL"> <parameter> <name>factory</name> <value>org.apache.commons.dbcp.BasicDataSourceFactory</value> </parameter> <parameter> <name>validationQuery</name> <value></value> </parameter> <parameter> <name>password</name> <value>xxx</value> </parameter> <parameter> <name>url</name> <value>jdbc:mysql://localhost/spring</value> </parameter> <parameter> <name>driverClassName</name> <value>com.mysql.jdbc.Driver</value> </parameter> <parameter> <name>maxIdle</name> <value>2</value> </parameter> <parameter> <name>username</name> <value>tom</value> </parameter> <parameter> <name>maxActive</name> <value>50</value> </parameter> <parameter> <name>maxIdle</name> <value>10</value> </parameter> <parameter> <name>maxWait</name> <value>10000</value> </parameter> <parameter> <name>removeAbandoned</name> <value>true</value> </parameter> <parameter> <name>removeAbandonedTimeout</name> <value>60</value> </parameter> <parameter> <name>logAbandoned</name> <value>true</value> </parameter> </ResourceParams> </Context> This is from "catalina.out": Jun 22, 2003 11:40:40 AM org.apache.coyote.http11.Http11Protocol init INFO: Initializing Coyote HTTP/1.1 on port 8080 Starting service Tomcat-Apache-modjk Apache Tomcat/4.1.10 DBCP borrowObject failed: java.sql.SQLException: Unable to connect to any hosts due to exception: java.net.BindException: Address already in use This is from www.springframework.org-catalina.2003-06-22.log: 2003-06-22 11:54:35 WebappLoader[/wiki]: Deploying class repositories to work directory /usr/local/jakarta-tomcat/4.1.10/work/Standalone/www.springframework.org/wiki 2003-06-22 11:54:35 WebappLoader[/wiki]: Deploy class files /WEB-INF/classes to /usr/local/jakarta-tomcat/4.1.10/work/Standalone/www.springframework.org/wiki/WEB-INF/classes 2003-06-22 11:54:35 WebappLoader[/wiki]: Deploy JAR /WEB-INF/lib/activation.jar to /usr/local/jakarta-tomcat/4.1.10/work/Standalone/www.springframework.org/wiki/WEB-INF/lib/activation.jar 2003-06-22 11:54:35 WebappLoader[/wiki]: Deploy JAR /WEB-INF/lib/commons-beanutils.jar to /usr/local/jakarta-tomcat/4.1.10/work/Standalone/www.springframework.org/wiki/WEB-INF/lib/commons-beanutils.jar 2003-06-22 11:54:35 WebappLoader[/wiki]: Deploy JAR /WEB-INF/lib/commons-fileupload-1.0-dev.jar to /usr/local/jakarta-tomcat/4.1.10/work/Standalone/www.springframework.org/wiki/WEB-INF/lib/commons-fileupload-1.0-dev.jar 2003-06-22 11:54:35 WebappLoader[/wiki]: Deploy JAR /WEB-INF/lib/commons-logging.jar to /usr/local/jakarta-tomcat/4.1.10/work/Standalone/www.springframework.org/wiki/WEB-INF/lib/commons-logging.jar 2003-06-22 11:54:35 WebappLoader[/wiki]: Deploy JAR /WEB-INF/lib/java2html.jar to /usr/local/jakarta-tomcat/4.1.10/work/Standalone/www.springframework.org/wiki/WEB-INF/lib/java2html.jar 2003-06-22 11:54:35 WebappLoader[/wiki]: Deploy JAR /WEB-INF/lib/jstl.jar to /usr/local/jakarta-tomcat/4.1.10/work/Standalone/www.springframework.org/wiki/WEB-INF/lib/jstl.jar 2003-06-22 11:54:35 WebappLoader[/wiki]: Deploy JAR /WEB-INF/lib/jsx.jar to /usr/local/jakarta-tomcat/4.1.10/work/Standalone/www.springframework.org/wiki/WEB-INF/lib/jsx.jar 2003-06-22 11:54:35 WebappLoader[/wiki]: Deploy JAR /WEB-INF/lib/junit.jar to /usr/local/jakarta-tomcat/4.1.10/work/Standalone/www.springframework.org/wiki/WEB-INF/lib/junit.jar 2003-06-22 11:54:35 WebappLoader[/wiki]: Deploy JAR /WEB-INF/lib/log4j.jar to /usr/local/jakarta-tomcat/4.1.10/work/Standalone/www.springframework.org/wiki/WEB-INF/lib/log4j.jar 2003-06-22 11:54:35 WebappLoader[/wiki]: Deploy JAR /WEB-INF/lib/lucene-1.2a.jar to /usr/local/jakarta-tomcat/4.1.10/work/Standalone/www.springframework.org/wiki/WEB-INF/lib/lucene-1.2a.jar 2003-06-22 11:54:36 WebappLoader[/wiki]: Deploy JAR /WEB-INF/lib/mail.jar to /usr/local/jakarta-tomcat/4.1.10/work/Standalone/www.springframework.org/wiki/WEB-INF/lib/mail.jar 2003-06-22 11:54:36 WebappLoader[/wiki]: Deploy JAR /WEB-INF/lib/mysql.jar to /usr/local/jakarta-tomcat/4.1.10/work/Standalone/www.springframework.org/wiki/WEB-INF/lib/mysql.jar 2003-06-22 11:54:36 WebappLoader[/wiki]: Deploy JAR /WEB-INF/lib/standard.jar to /usr/local/jakarta-tomcat/4.1.10/work/Standalone/www.springframework.org/wiki/WEB-INF/lib/standard.jar 2003-06-22 11:54:36 WebappLoader[/wiki]: Deploy JAR /WEB-INF/lib/template4java.jar to /usr/local/jakarta-tomcat/4.1.10/work/Standalone/www.springframework.org/wiki/WEB-INF/lib/template4java.jar 2003-06-22 11:54:37 StandardManager[/wiki]: Seeding random number generator class java.security.SecureRandom 2003-06-22 11:54:37 StandardManager[/wiki]: Seeding of random number generator has been completed 2003-06-22 11:54:37 StandardWrapper[/wiki:default]: Loading container servlet default 2003-06-22 11:54:37 StandardWrapper[/wiki:invoker]: Loading container servlet invoker 2003-06-22 11:54:38 StandardContext[/webapps/petclinic]: Starting 2003-06-22 11:54:38 StandardContext[/webapps/petclinic]: Processing start(), current available=false 2003-06-22 11:54:38 StandardContext[/webapps/petclinic]: Configuring default Resources 2003-06-22 11:54:38 StandardContext[/webapps/petclinic]: Configuring non-privileged default Loader 2003-06-22 11:54:38 StandardContext[/webapps/petclinic]: Configuring default Manager 2003-06-22 11:54:38 StandardContext[/webapps/petclinic]: Processing standard container startup 2003-06-22 11:54:38 WebappLoader[/webapps/petclinic]: Deploying class repositories to work directory /usr/local/jakarta-tomcat/4.1.10/work/Standalone/www.springframework.org/webapps_petclinic 2003-06-22 11:54:38 WebappLoader[/webapps/petclinic]: Deploy class files /WEB-INF/classes to /home/tom/public_html/www.springframework.org/webapps/petclinic/WEB-INF/classes 2003-06-22 11:54:38 WebappLoader[/webapps/petclinic]: Deploy JAR /WEB-INF/lib/commons-logging.jar to /home/tom/public_html/www.springframework.org/webapps/petclinic/WEB-INF/lib/commons-logging.jar 2003-06-22 11:54:38 WebappLoader[/webapps/petclinic]: Deploy JAR /WEB-INF/lib/jstl.jar to /home/tom/public_html/www.springframework.org/webapps/petclinic/WEB-INF/lib/jstl.jar 2003-06-22 11:54:38 WebappLoader[/webapps/petclinic]: Deploy JAR /WEB-INF/lib/log4j-1.2.8.jar to /home/tom/public_html/www.springframework.org/webapps/petclinic/WEB-INF/lib/log4j-1.2.8.jar 2003-06-22 11:54:38 WebappLoader[/webapps/petclinic]: Deploy JAR /WEB-INF/lib/spring-full-0.8.jar to /home/tom/public_html/www.springframework.org/webapps/petclinic/WEB-INF/lib/spring-full-0.8.jar 2003-06-22 11:54:38 WebappLoader[/webapps/petclinic]: Deploy JAR /WEB-INF/lib/standard.jar to /home/tom/public_html/www.springframework.org/webapps/petclinic/WEB-INF/lib/standard.jar 2003-06-22 11:54:38 WebappLoader[/webapps/petclinic]: Reloading checks are enabled for this Context 2003-06-22 11:54:38 ContextConfig[/webapps/petclinic]: ContextConfig: Processing START 2003-06-22 11:54:38 StandardContext[/webapps/petclinic]: Setting deployment descriptor public ID to '-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN' 2003-06-22 11:54:38 StandardContext[/webapps/petclinic]: Setting deployment descriptor public ID to '-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN' 2003-06-22 11:54:38 ContextConfig[/webapps/petclinic]: Accumulating TLD resource paths 2003-06-22 11:54:38 ContextConfig[/webapps/petclinic]: Scanning <taglib> elements in web.xml 2003-06-22 11:54:38 ContextConfig[/webapps/petclinic]: Adding path '/WEB-INF/tlds/spring/i21.tld' for URI '/spring-i21' 2003-06-22 11:54:38 ContextConfig[/webapps/petclinic]: Adding path '/WEB-INF/tlds/jstl/fmt.tld' for URI '/jstl-fmt' 2003-06-22 11:54:38 ContextConfig[/webapps/petclinic]: Adding path '/WEB-INF/tlds/jstl/c.tld' for URI '/jstl-c' 2003-06-22 11:54:38 ContextConfig[/webapps/petclinic]: Scanning TLDs in /WEB-INF subdirectory 2003-06-22 11:54:38 ContextConfig[/webapps/petclinic]: Scanning JARs in /WEB-INF/lib subdirectory 2003-06-22 11:54:38 ContextConfig[/webapps/petclinic]: Adding path '/WEB-INF/lib/commons-logging.jar' 2003-06-22 11:54:38 ContextConfig[/webapps/petclinic]: Adding path '/WEB-INF/lib/jstl.jar' 2003-06-22 11:54:38 ContextConfig[/webapps/petclinic]: Adding path '/WEB-INF/lib/log4j-1.2.8.jar' 2003-06-22 11:54:38 ContextConfig[/webapps/petclinic]: Adding path '/WEB-INF/lib/spring-full-0.8.jar' 2003-06-22 11:54:38 ContextConfig[/webapps/petclinic]: Adding path '/WEB-INF/lib/standard.jar' 2003-06-22 11:54:38 ContextConfig[/webapps/petclinic]: Scanning TLD at resource path '/WEB-INF/tlds/jstl/fmt.tld' 2003-06-22 11:54:38 ContextConfig[/webapps/petclinic]: Scanning JAR at resource path '/WEB-INF/lib/spring-full-0.8.jar' 2003-06-22 11:54:38 ContextConfig[/webapps/petclinic]: Scanning JAR at resource path '/WEB-INF/lib/log4j-1.2.8.jar' 2003-06-22 11:54:38 ContextConfig[/webapps/petclinic]: Scanning TLD at resource path '/WEB-INF/tlds/jstl/c.tld' 2003-06-22 11:54:38 ContextConfig[/webapps/petclinic]: Scanning JAR at resource path '/WEB-INF/lib/commons-logging.jar' 2003-06-22 11:54:38 ContextConfig[/webapps/petclinic]: Scanning JAR at resource path '/WEB-INF/lib/jstl.jar' 2003-06-22 11:54:38 ContextConfig[/webapps/petclinic]: Scanning TLD at resource path '/WEB-INF/tlds/spring/i21.tld' 2003-06-22 11:54:38 ContextConfig[/webapps/petclinic]: Scanning JAR at resource path '/WEB-INF/lib/standard.jar' 2003-06-22 11:54:38 ContextConfig[/webapps/petclinic]: Processing TLD at 'META-INF/sql-rt.tld' 2003-06-22 11:54:38 ContextConfig[/webapps/petclinic]: Processing TLD at 'META-INF/c.tld' 2003-06-22 11:54:38 ContextConfig[/webapps/petclinic]: Processing TLD at 'META-INF/x.tld' 2003-06-22 11:54:38 ContextConfig[/webapps/petclinic]: Processing TLD at 'META-INF/c-rt.tld' 2003-06-22 11:54:38 ContextConfig[/webapps/petclinic]: Processing TLD at 'META-INF/sql.tld' 2003-06-22 11:54:38 ContextConfig[/webapps/petclinic]: Processing TLD at 'META-INF/fmt-rt.tld' 2003-06-22 11:54:38 ContextConfig[/webapps/petclinic]: Processing TLD at 'META-INF/scriptfree.tld' 2003-06-22 11:54:38 ContextConfig[/webapps/petclinic]: Processing TLD at 'META-INF/fmt.tld' 2003-06-22 11:54:39 ContextConfig[/webapps/petclinic]: Processing TLD at 'META-INF/x-rt.tld' 2003-06-22 11:54:39 ContextConfig[/webapps/petclinic]: Processing TLD at 'META-INF/permittedTaglibs.tld' 2003-06-22 11:54:39 ContextConfig[/webapps/petclinic]: Pipline Configuration: 2003-06-22 11:54:39 ContextConfig[/webapps/petclinic]: org.apache.catalina.core.StandardContextValve/1.0 2003-06-22 11:54:39 ContextConfig[/webapps/petclinic]: ====================== 2003-06-22 11:54:39 NamingContextListener[/Standalone/www.springframework.org/webapps/petclinic]: Creating JNDI naming context 2003-06-22 11:54:39 NamingContextListener[/Standalone/www.springframework.org/webapps/petclinic]: Resource parameters for jdbc/petclinicMYSQL = ResourceParams[name=jdbc/petclinicMYSQL, parameters={url=jdbc:mysql://localhost/spring, validationQuery=, maxIdle=10, maxActive=50, maxWait=10000, driverClassName=com.mysql.jdbc.Driver, removeAbandoned=true, username=tom, factory=org.apache.commons.dbcp.BasicDataSourceFactory, logAbandoned=true, removeAbandonedTimeout=60, password=tom}] 2003-06-22 11:54:39 NamingContextListener[/Standalone/www.springframework.org/webapps/petclinic]: Adding resource ref jdbc/petclinicMYSQL 2003-06-22 11:54:39 NamingContextListener[/Standalone/www.springframework.org/webapps/petclinic]: ResourceRef[className=javax.sql.DataSource,factoryClassLocation=null,factoryClassName=org.apache.naming.factory.ResourceFactory,{type=scope,content=Shareable},{type=auth,content=Container},{type=url,content=jdbc:mysql://localhost/spring},{type=validationQuery,content=},{type=maxIdle,content=10},{type=maxActive,content=50},{type=maxWait,content=10000},{type=driverClassName,content=com.mysql.jdbc.Driver},{type=removeAbandoned,content=true},{type=username,content=tom},{type=factory,content=org.apache.commons.dbcp.BasicDataSourceFactory},{type=logAbandoned,content=true},{type=removeAbandonedTimeout,content=60},{type=password,content=tom}] 2003-06-22 11:54:39 NamingContextListener[/Standalone/www.springframework.org/webapps/petclinic]: Resource parameters for UserTransaction = null 2003-06-22 11:54:39 StandardManager[/webapps/petclinic]: Seeding random number generator class java.security.SecureRandom 2003-06-22 11:54:39 StandardManager[/webapps/petclinic]: Seeding of random number generator has been completed 2003-06-22 11:54:39 StandardContext[/webapps/petclinic]: Posting standard context attributes 2003-06-22 11:54:39 StandardContext[/webapps/petclinic]: Configuring application event listeners 2003-06-22 11:54:39 StandardContext[/webapps/petclinic]: Configuring event listener class 'com.interface21.web.context.ContextLoaderListener' 2003-06-22 11:54:39 StandardContext[/webapps/petclinic]: Sending application start events 2003-06-22 11:55:21 StandardContext[/webapps/petclinic]: Exception sending context initialized event to listener instance of class com.interface21.web.context.ContextLoaderListener org.apache.commons.dbcp.DbcpException: java.sql.SQLException: Unable to connect to any hosts due to exception: java.net.BindException: Address already in use at org.apache.commons.dbcp.DriverConnectionFactory.createConnection(DriverConnectionFactory.java:85) at org.apache.commons.dbcp.PoolableConnectionFactory.makeObject(PoolableConnectionFactory.java:184) at org.apache.commons.pool.impl.GenericObjectPool.borrowObject(Unknown Source) at org.apache.commons.dbcp.AbandonedObjectPool.borrowObject(AbandonedObjectPool.java:117) at org.apache.commons.dbcp.PoolingDataSource.getConnection(PoolingDataSource.java:110) at org.apache.commons.dbcp.BasicDataSource.getConnection(BasicDataSource.java:312) at com.interface21.jdbc.datasource.DataSourceUtils.getConnection(DataSourceUtils.java:133) at com.interface21.jdbc.core.JdbcTemplate.doWithResultSetFromPreparedQuery(JdbcTemplate.java:285) at com.interface21.jdbc.core.JdbcTemplate.query(JdbcTemplate.java:270) at com.interface21.jdbc.object.SqlQuery.execute(SqlQuery.java:121) at com.interface21.jdbc.object.SqlQuery.execute(SqlQuery.java:129) at petclinic.dao.ClinicJdbcDAO.getVets(Unknown Source) at petclinic.ClinicImpl.loadVets(Unknown Source) at petclinic.ClinicImpl.afterPropertiesSet(Unknown Source) at com.interface21.beans.factory.support.AbstractBeanFactory.callLifecycleMethodsIfNecessary(AbstractBeanFactory.java:457) at com.interface21.beans.factory.support.AbstractBeanFactory.createBean(AbstractBeanFactory.java:125) at com.interface21.beans.factory.support.AbstractBeanFactory.getSharedInstance(AbstractBeanFactory.java:171) at com.interface21.beans.factory.support.AbstractBeanFactory.getBeanInternal(AbstractBeanFactory.java:238) at com.interface21.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:219) at com.interface21.beans.factory.support.ListableBeanFactoryImpl.preInstantiateSingletons(ListableBeanFactoryImpl.java:198) at com.interface21.beans.factory.xml.XmlBeanFactory.loadBeanDefinitions(XmlBeanFactory.java:236) at com.interface21.beans.factory.xml.XmlBeanFactory.loadBeanDefinitions(XmlBeanFactory.java:199) at com.interface21.beans.factory.xml.XmlBeanFactory.<init>(XmlBeanFactory.java:149) at com.interface21.context.support.AbstractXmlApplicationContext.refreshBeanFactory(AbstractXmlApplicationContext.java:40) at com.interface21.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:207) at com.interface21.web.context.support.XmlWebApplicationContext.setServletContext(XmlWebApplicationContext.java:120) at com.interface21.web.context.ContextLoader.initContext(ContextLoader.java:56) at com.interface21.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:20) at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:3251) at org.apache.catalina.core.StandardContext.start(StandardContext.java:3524) at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1188) at org.apache.catalina.core.StandardHost.start(StandardHost.java:738) at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1188) at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:347) at org.apache.catalina.core.StandardService.start(StandardService.java:497) at org.apache.catalina.core.StandardServer.start(StandardServer.java:2191) at org.apache.catalina.startup.Catalina.start(Catalina.java:510) at org.apache.catalina.startup.Catalina.execute(Catalina.java:400) at org.apache.catalina.startup.Catalina.process(Catalina.java:180) 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.main(Bootstrap.java:203) Caused by: java.sql.SQLException: Unable to connect to any hosts due to exception: java.net.BindException: Address already in use at com.mysql.jdbc.Connection.createNewIO(Connection.java:1622) at com.mysql.jdbc.Connection.<init>(Connection.java:491) at com.mysql.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:346) at org.apache.commons.dbcp.DriverConnectionFactory.createConnection(DriverConnectionFactory.java:83) ... 43 more 2003-06-22 11:55:21 StandardContext[/webapps/petclinic]: Context startup failed due to previous errors 2003-06-22 11:55:21 StandardContext[/webapps/petclinic]: Stopping 2003-06-22 11:55:21 StandardContext[/webapps/petclinic]: Stopping filters 2003-06-22 11:55:21 StandardContext[/webapps/petclinic]: Processing standard container shutdown 2003-06-22 11:55:21 ContextConfig[/webapps/petclinic]: ContextConfig: Processing STOP 2003-06-22 11:55:21 StandardContext[/webapps/petclinic]: Sending application stop events 2003-06-22 11:55:21 StandardContext[/webapps/petclinic]: Releasing document base /home/tom/public_html/www.springframework.org/webapps/petclinic 2003-06-22 11:55:21 StandardContext[/webapps/petclinic]: Stopping complete > *To Thomas,* > > Can you install the demo download file along with a running version on > the Spring website, marking it as preliminary ? > > > *To All,* > > I am pleased to announce that I now have ready for download, a new > version of the Petclinic demo app > <http://www.globaldialog.com/%7Ekkrebs/files/petclinic1-1.0.zip>, > approx. 1.9MB. > Be sure to read the file, petclinic.txt which is attached and also is in > the project's websrc directory. This file contains notes regarding the > design, implementation, and usage. > > I am just getting started on the accompanying tutorial. I will post > bits and pieces of it as they become available for review. *Can I get > any volunteers to help with the reviewing ??? > * > I am also happy to say that Sourceforge seems to have worked out their > anonymous access problems so it is using a pretty up-to-date version of > Spring. > > I have it running temporarily on a small, private site. If you wish to > get the URL, send me an email. > > > *To Myself,* > > Time is running out before the symposium (and I leave for a week's > camping holiday in the great north woods of Wisconsin), > so I have to focus on the tutorial. > > Repeat after me: > I must stop designing, coding, tweaking. > I must stop designing, coding, tweaking. > I must stop designing, coding, tweaking. > ... :-) > > > > I very much welcome all comments, suggestions, ideas, criticisms, and etc. > > Ken > |
|
From: <tri...@tr...> - 2003-06-22 16:59:28
|
Ken,
I managed to get the petclinic working.
Added
<parameter>
<name>validationQuery</name>
<value>select sysdate()</value>
</parameter>
to the datasource configuration and it works fine.
http://www.springframework.org/webapps/petclinic/welcome.htm
Thomas
|
|
From: Ken K. <kk...@kk...> - 2003-06-22 17:30:19
|
Thomas, I guess any valid query would work for this parameter. Leaving the value blank may be the problem. It might also work if the parameter is not defined at all as in my file. I've noticed that there is a difference as in the HSQL version, I have to leave the password parameter undefined, not blank, to use the default blank HSQL password.; a null String vs. an empty String. Regards, Ken tri...@tr... wrote: >Ken, > >I managed to get the petclinic working. > >Added > > <parameter> > <name>validationQuery</name> > <value>select sysdate()</value> > </parameter> > >to the datasource configuration and it works fine. > >http://www.springframework.org/webapps/petclinic/welcome.htm > >Thomas > > > > > |