2008 East
DIAMOND SPONSOR:
Data Direct
Frontiers in Data Access: The Coming Wave in Data Services
PLATINUM SPONSORS:
Red Hat
The Opening of Virtualization
Intel
Virtualization – Path to Predictive Enterprise
Green Hills
IT Security in a Hostile World
JBoss / freedom oss
Practical SOA Approach
GOLD SPONSORS:
Software AG
The Art & Science of SOA: How Governance Enables Adoption
PlateSpin
Effective Planning for Virtual Infrastructure Growth
Fujitsu
Automated Business Process Discovery & Virtualization Service
Ceedo
Workspace Virtualization
Click For 2007 West
Event Webcasts

2008 East
PLATINUM SPONSORS:
Appcelerator
Think Fast: Accelerate AJAX Development with Appcelerator
GOLD SPONSORS:
DreamFace Interactive
The Ultimate Framework for Creating Personalized Web 2.0 Mashups
ICEsoft
AJAX and Social Computing for the Enterprise
Kaazing
Enterprise Comet: Real–Time, Real–Time, or Real–Time Web 2.0?
Nexaweb
Now Playing: Desktop Apps in the Browser!
Sun
jMaki as an AJAX Mashup Framework
POWER PANELS:
The Business Value
of RIAs
What Lies Beyond AJAX?
KEYNOTES:
Douglas Crockford
Can We Fix the Web?
Anthony Franco
2008: The Year of the RIA
Click For 2007 Event Webcasts
I received an email stating that AOL finally aband...
TOP THREE LINKS YOU MUST CLICK ON
Creating a Pet Store Application with JavaServer Faces, Spring, and Hibernate
JavaServer Faces (JSF) technology is a new user interface framework for J2EE applications. This article uses the familiar Pet Store application to demonstrate how to build a real-world Web application using JSF, the Spring Framework, and Hibernate.
Reader Feedback: Page 1 of 2

Hi there! Since my last post about working version of petstore, i've received a lot of letters with requests for it, so i felt like i'm working for technical support of petstore application :)) so i've shared archive with it on rapidshare.com. You can download archive with working files from here: http://rapidshare.com/files/152595290/mypetstore.rar. If you still getting errors, probably you're doing something wrong. I'm using Tomcat 5.5.26 and MySQL Server 4.1 and have no errors at all. Try to complete all installation steps from beginning. Wish you good luck!

P.S. Best wishes and great respect to author of this article.

to: Zakaria Chakih
if you provide me your email, i could send working project to you. or feel free to write me a letter to en3rgizer[at]mail[dot]ru

@ en3rgizer

Could you please give me your working mypetstore!?

Hallo,

I tryed to in install mypetstore as described above but i dosen't function. i get all time the failure:
[ServletException in:/layout.jsp] javax.servlet.jsp.JspException: javax.faces.el.PropertyNotFoundException: Can't instantiate class: 'Can't get value from value reference expression: '#{serviceLocatorBean}'.'.'
hat anyone an idea why??

hi,i've downloaded the program in zip file.when i try to run the war file it show the error below.what causes the error?i even try to put the common.pool jar but still not working.anyone know what's wrong?

16:37:04,369 INFO XmlBeanDefinitionReader:118 - Loading XML bean definitions from resource [/WEB-INF/applicationContext.xml] of ServletContext
16:37:04,431 ERROR ContextLoader:106 - Context initialization failed
org.springframework.beans.factory.BeanDefinitionStoreException: Error registering bean with name 'dataSource' defined in resource [/WEB-INF/applicationContext.xml] of ServletContext: Class that bean class [org.apache.commons.dbcp.BasicDataSource] depends on not found; nested exception is java.lang.NoClassDefFoundError: org/apache/commons/pool/impl/GenericObjectPool
java.lang.NoClassDefFoundError: org/apache/commons/pool/impl/GenericObjectPool

Source can be downloaded from here:
http://res.sys-con.com/story/46977/mypetstore.zip

I have faced the same problem about Tom Authera wrote on 1 Mar 2005 ( All works well until I press the Check-Out link. MySql throws a foreign-key constraint error. Here is the trace:
10:57:34,055 INFO HibernateTransactionManager:315 - Initiating transaction commit
10:57:34,086 WARN JDBCExceptionReporter:38 - SQL Error: 1216, SQLState: 23000
10:57:34,086 ERROR JDBCExceptionReporter:46 - null, message from server: "Cannot add or update a child row: a foreign key constraint fails"......)

After doing some reverse engineering on database 'mypetstore' with JBoss Tools I've found that generated mapping for Order.hbm.xml differents from original mapping from example. So I've changed few strings hibernate mapping Order.hbm.xml:

Before: set name="lineItems" cascade="all"

After:
set name="lineItems" inverse="true"

And it started working!
Thanks a lot to autor for great work!

p.s. In previous post I've made a mistake when writing source (I'm not familiar with WIKI format:)))

Source can be downloaded from here:
http://res.sys-con.com/story/46977/mypetstore.zip

I have faced the same problem about Tom Authera wrote on 1 Mar 2005 ( All works well until I press the Check-Out link. MySql throws a foreign-key constraint error. Here is the trace:
10:57:34,055 INFO HibernateTransactionManager:315 - Initiating transaction commit
10:57:34,086 WARN JDBCExceptionReporter:38 - SQL Error: 1216, SQLState: 23000
10:57:34,086 ERROR JDBCExceptionReporter:46 - null, message from server: "Cannot add or update a child row: a foreign key constraint fails"......)

After doing some reverse engineering on database 'mypetstore' with JBoss Tools I've found that generated mapping for Order.hbm.xml differents from original mapping from example. So I've changed few strings hibernate mapping Order.hbm.xml:

Before:

<one-to-many class="LineItem"/>

After:

<one-to-many class="LineItem" />

And it started working!
Thanks a lot to autor for great work!

I would like to know the url to download the source code, b'cos the one given in this article doesn't work.

very very useful information

I am unable to locate the source from the url mentioned in the article. Is there a new location from which the source can be downloaded ?

If you try to run the sources shipped with the article be sure that your database tables and columns are named in proper case (at least under MySQL 4.1/Linux the case does matter).

Regardings libs: add commons-pool.jar from jakarta, and exlcude servlet.jar for building the war file.

... then it runs like a charme.
Very nice article, Thanks!
-- Niko

Derek,
Again first class article! In my view the integration of open source frameworks is a key concern going forward. You have succeeded in your aim to encourage investigation of these topic.
Paul

What does the author teach regarding decoupling presentation tier from business tier?
Just look at Listing 1.
At one line the author demonstrate how to call business method indirectly via ServiceLocator. It's OK.
But at the next line he breaks that principle and call business method directly. Why don't he use the same principle? It should be done like this:
this.getServiceLocator().getCartService().addItem(item);
And of course, the reference to Cart business object should be removed from CartBean.

Tutorial is great. I'm having 1 issue though. All works well until I press the Check-Out link. MySql throws a foreign-key constraint error. Here is the trace:
10:57:34,055 INFO HibernateTransactionManager:315 - Initiating transaction commit
10:57:34,086 WARN JDBCExceptionReporter:38 - SQL Error: 1216, SQLState: 23000
10:57:34,086 ERROR JDBCExceptionReporter:46 - null, message from server: "Cannot add or update a child row: a foreign key constraint fails"
10:57:34,086 WARN JDBCExceptionReporter:38 - SQL Error: 1216, SQLState: 23000
10:57:34,086 ERROR JDBCExceptionReporter:46 - null, message from server: "Cannot add or update a child row: a foreign key constraint fails"
10:57:34,102 ERROR JDBCExceptionReporter:38 - Could not execute JDBC batch update
java.sql.BatchUpdateException: null, message from server: "Cannot add or update a child row: a foreign key constraint fails"
at com.mysql.jdbc.PreparedStatement.executeBatch(PreparedStatement.java:1469)
at org.apache.commons.dbcp.DelegatingPreparedStatement.executeBatch(DelegatingPreparedStatement.java:231)
at net.sf.hibernate.impl.BatchingBatcher.doExecuteBatch(BatchingBatcher.java:54)
at net.sf.hibernate.impl.BatcherImpl.executeBatch(BatcherImpl.java:118)
at net.sf.hibernate.impl.SessionImpl.executeAll(SessionImpl.java:2311)
at net.sf.hibernate.impl.SessionImpl.execute(SessionImpl.java:2261)
at net.sf.hibernate.impl.SessionImpl.flush(SessionImpl.java:2187)
at net.sf.hibernate.transaction.JDBCTransaction.commit(JDBCTransaction.java:61)
at org.springframework.orm.hibernate.HibernateTransactionManager.doCommit(HibernateTransactionManager.java:386)
at org.springframework.transaction.support.AbstractPlatformTransactionManager.commit(AbstractPlatformTransactionManager.java:316)
at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:189)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:138)
at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:148)
at $Proxy2.saveOrder(Unknown Source)
at mypetstore.view.bean.OrderBean.createOrderAction(OrderBean.java:57)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at com.sun.faces.el.MethodBindingImpl.invoke(MethodBindingImpl.java:126)
at com.sun.faces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:72)
at javax.faces.component.UICommand.broadcast(UICommand.java:312)
at javax.faces.component.UIViewRoot.broadcastEvents(UIViewRoot.java:266)
at javax.faces.component.UIViewRoot.processApplication(UIViewRoot.java:380)
at com.sun.faces.lifecycle.InvokeApplicationPhase.execute(InvokeApplicationPhase.java:75)
at com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.java:200)
at com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:90)
at javax.faces.webapp.FacesServlet.service(FacesServlet.java:197)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
at mypetstore.view.util.SecurityFilter.doFilter(SecurityFilter.java:73)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:214)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:825)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:738)
at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:526)
at org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:80)
at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:684)
at java.lang.Thread.run(Thread.java:595)
10:57:34,102 ERROR SessionImpl:2269 - Could not synchronize database state with session
net.sf.hibernate.JDBCException: Could not execute JDBC batch update
at net.sf.hibernate.impl.BatcherImpl.executeBatch(BatcherImpl.java:125)
at net.sf.hibernate.impl.SessionImpl.executeAll(SessionImpl.java:2311)
at net.sf.hibernate.impl.SessionImpl.execute(SessionImpl.java:2261)

I had the same issue with the jsp compilation. It happens to be a problem with tomcat losing the class path to java libraries. There is a open bug on some versions of 5.x Tomcat installations. removing and reinstall of Tomcat fixed this issue, after a day of frustrating trials and errors.

Cheers


Feedback Pages:


FEATURED WHITE PAPERS
YOUR FEEDBACK
erdem wrote: ...
erdem wrote: comments. I love this Sohbet & Chat site as it contains good materials Kameralı Sohbe...
Firstname Lastname wrote: A similar solution is to create a MySQL driver. That is, create a class derived from com.mysql.jdbc.NonRegisteringDriver. Create a static initializer block to register the class with java.sql.DriverManager, following the example in com.mysql.jdbc.Driver. Override the following functions: publ...
şehmuz çokyer wrote: Thank you very much for this useful article and the comments. I love this site as it contains good materials. ------------------------------------------ adtech...
Ha wrote: Hi, there are many ways beyond the portal framework itself to substantially increase the throughput up to 10x and to reduce the time that the browser needs to build the page. We have throughput numbers around 20 pages for a large portal on 1 CPU base. Feel free to read more on http://hhvo.wordpress...
HOT DISCUSSIONS
SUBSCRIBE TO THE WORLD'S MOST POWERFUL NEWSLETTERS

SYS-CON FEATURED WHITEPAPERS

JavaScript is pretty much everywhere you look these days, reaching far beyond your desktop browser. ...
The Java Community Process (JCP) Program Management Office has announced the final results of the 20...
If you think your network is safe from the new strains of content security threats, think again. Tod...
Tidal Software has announced Intersperse 8.0, a product that monitors J2EE and .NET applications and...
ILOG has announced ILOG JViews 8.5, the latest version of ILOG’s Java-based visualization suite, w...
Emulex has announced that it will offer Fibre Channel Host Bus Adapters (HBA) and Fibre Channel over...
The BlackBerryR Technical Webcast Series is designed to help BlackBerry administrators better manage...
The BlackBerry Technical Seminar is back this fall with breakthrough new sessions you won’t want t...
In an effort to head off its disappearance below the horizon, Sun is going to lay off 5,000-6,000 pe...
Working across all of Sun, Senior Vice President, Dave Douglas, has been appointed today to lead the...
In 45 jam-packed minutes that will include case studies and live technology demonstrations, the VP o...
Increasingly, a businesses competitive advantage is gained by processing large flows of raw data int...
When picturing the relationship between the enterprise and the Software-as-a-Service (SaaS) business...
The toxic virus of soft consumer spending has hit Best Buy forcing it to axe its earnings guidance f...
The open source community includes many early advocates of the recent wave of emerging SOA-related t...
Storage has been like a penitential chain around Sun’s neck and it’s left unspeakable gouges. Su...
InterSystems has announced that Ochsner Health System has selected the Progeny Anatomic Pathology (A...
SYS-CON's Cloud Computing Journal, founded in July 2008 as the world's first publication devoted exc...
The line between what is considered a cloud and what is paramount to hosting is a blurry line at the...
Over the course of the past few decades, the consumer media industry has evolved from a slow-moving ...
SPONSORED BY INFRAGISTICS
In every field of design one of the first things students do is learn from the work of others. They ...
There are many forces that influence technological evolution. After a decade of building enterprise ...
2008 is going to be an important year for Rich Internet Applications. Most organizations are deliver...
The OpenAjax Alliance is developing an Ajax industry wishlist for future browsers, using a dedicated...
Infragistics announced the availability of two Community Technology Preview (CTP) User Interface (UI...
The YUI development team has released version 2.5.2; you can download the new release from SourceFor...
ADS BY GOOGLE