xPetStore is a lightweight version of Sun PetStore that shows how to use leading opensource frameworks/tools to build J2EE 1.3 WODRA ( Write Once, Deploy and Run ) everywhere. Ant, xDoclet, Struts, SiteMesh and JunitEE are used in the application.
xPetStore has been successfully deployed and tested on JBoss 3.0.4+ and WebLogic 6.1+, as well as the databases SapDB, PostgreSQL, MySQL, hsqldb, PointBase and MSSQL.
You can download it at:
http://sourceforge.net/projects/xpetstore.
Homepage:
http://xpetstore.sourceforge.net/.
-
Version 2.2 of xPetStore Released (27 messages)
- Posted by: Herve Tchepannou
- Posted on: January 20 2003 00:00 EST
Threaded Messages (27)
- Really cool by Javed Mandary on January 20 2003 12:26 EST
- A boon for the pet store industry! by Cameron Purdy on January 20 2003 12:26 EST
- Re: A boon for the pet store industry by Herve Tchepannou on January 20 2003 15:09 EST
-
Re: A boon for the pet store industry by bad mASH on January 20 2003 05:29 EST
-
How do I get the database working? by Alan Wong on January 20 2003 06:38 EST
-
Re: How do I get the database working? by Herve Tchepannou on January 20 2003 07:11 EST
-
Re: How do I get the database working? by Alan Wong on January 20 2003 07:39 EST
- Re: How do I get the database working? by Herve Tchepannou on January 20 2003 08:19 EST
- Re: How do I get the database working? by Zoran Savic on January 27 2003 04:52 EST
-
Re: How do I get the database working? by Alan Wong on January 20 2003 07:39 EST
-
Re: How do I get the database working? by Herve Tchepannou on January 20 2003 07:11 EST
-
How do I get the database working? by Alan Wong on January 20 2003 06:38 EST
-
Great Job by Clinton Begin on January 20 2003 07:40 EST
-
Great Job by Herve Tchepannou on January 21 2003 02:58 EST
- RE: Great Job by Clinton Begin on January 21 2003 07:25 EST
-
Great Job by Herve Tchepannou on January 21 2003 02:58 EST
-
Re: A boon for the pet store industry by Chris James on January 21 2003 04:57 EST
- Re: A boon for the pet store industry by Herve Tchepannou on January 21 2003 07:22 EST
-
Re: A boon for the pet store industry by bad mASH on January 20 2003 05:29 EST
- Re: A boon for the pet store industry by Herve Tchepannou on January 20 2003 15:09 EST
- Excellent work ! by kierone edwards on January 20 2003 20:43 EST
- Hello from the XDoclet team by Aslak Hellesøy on January 20 2003 21:53 EST
- Works in jboss-3.0.5_tomcat-4.1.18 but not in jboss-3.0.5 by Jacob Kjome on January 25 2003 13:42 EST
- Works in jboss-3.0.5_tomcat-4.1.18 but not in jboss-3.0.5 by Herve Tchepannou on January 26 2003 17:42 EST
-
JBoss also doen't work as stated in the document by Hari Pandalai on January 26 2003 07:39 EST
- JBoss also doen't work as stated in the document by Raj Venkataraman on January 26 2003 10:08 EST
- JBoss also doen't work as stated in the document by Herve Tchepannou on January 27 2003 08:45 EST
- JBoss also doen't work as stated in the document by Herve Tchepannou on January 27 2003 08:49 EST
-
JBoss also doen't work as stated in the document by Hari Pandalai on January 26 2003 07:39 EST
- Works in jboss-3.0.5_tomcat-4.1.18 but not in jboss-3.0.5 by Herve Tchepannou on January 26 2003 17:42 EST
- Can not deploy xpetstore.jar to jboss-3.0.6-Tomcat4.1.18 by x by on February 09 2003 07:43 EST
- Can not deploy xpetstore.jar to jboss-3.0.6-Tomcat4.1.18 by x by on February 09 2003 09:20 EST
- Lack of ejbcreate methods for 1 to many CMR beans by Javed Mandary on February 15 2003 00:46 EST
- Problem with Database linkage by Jim Brady on June 12 2003 10:47 EDT
- Presto PetStore by julio moscon on August 21 2003 14:21 EDT
-
Really cool[ Go to top ]
- Posted by: Javed Mandary
- Posted on: January 20 2003 12:26 EST
- in response to Herve Tchepannou
Just wanna say that Herve is really cool to have converted Petstore to Xpetstore making use of tools which are free and accessiblet to all such as ant and xdoclet. Great work! -
A boon for the pet store industry![ Go to top ]
- Posted by: Cameron Purdy
- Posted on: January 20 2003 12:26 EST
- in response to Herve Tchepannou
If I owned an actual pet store, I'd have so many freely available choices for running my Internet systems that it would be overwhelming! This is obviously a boon for the animal sales industry ;-)
Your overview doc looks pretty impressive. A couple of quick questions, if you do not mind:
- How does it perform?
- How does it compare (code, complexity, architecture, performance) to the other implementations? Particular to the iBatis implementation?
- What are your opinions on the performance bottlenecks in the various implementations?
- How would you architect the pet-store to make it simpler or more modular? Would that imply more code in the result?
Thanks!
Peace,
Cameron Purdy
Tangosol, Inc.
Coherence: Easily share live data across a cluster! -
Re: A boon for the pet store industry[ Go to top ]
- Posted by: Herve Tchepannou
- Posted on: January 20 2003 15:09 EST
- in response to Cameron Purdy
[- How does it perform? ]
I haven't made any performance test. But, it works very well on my devellopement machine (AMD 1.7G, JBoss3+Tomcat + Jikes).
xPetStore was created for educational purpose, not as a performance guideline.
I think that the perf is decent and there is room for improvement.
[- How does it compare (code, complexity, architecture, performance) to the other implementations? Particular to the iBatis implementation?]
xDoclet reduction drastically the complexity of the app by generating almost 60% of the code (~75% at EJB layer).
To number of LOC:
xPetStore: 4250, BUT 2000 are generated by xDoclet
iBatis jPetStore ~ 3100
MS PetStore ~ 3000
Sun Petstore ~14000
But, don't forget that the architechture are different.
xPetStore has a middle tier (Session as MDB), while iBatis and MS version has none
Using Sitemesh at the web layer really simplify jsp pages.
Its a much more elegan solution that struts Tiles
[- How would you architect the pet-store to make it simpler or more modular? Would that imply more code in the result?
]
Replace entity beans with POJO, use a persistence framework like Hibernate, OJB, JDO etc. This will reduce highly the complexity of the app.
Get rid of SSB for managing the Cart state. -
Re: A boon for the pet store industry[ Go to top ]
- Posted by: bad mASH
- Posted on: January 20 2003 17:29 EST
- in response to Herve Tchepannou
Herve ,
Marvellous Job!! Kudos! If you publish a book on this , I will buy a dozen for my team --- its better than any classroom training on using oss components!
-dd -
How do I get the database working?[ Go to top ]
- Posted by: Alan Wong
- Posted on: January 20 2003 18:38 EST
- in response to bad mASH
When I try to deploy the application on JBoss, it gives me a SQLException saying unknown database 'xpetstore'.
I'm using MySQL and I know I haven't created a database for this app yet. But, isn't there suppose to be sql script to run the DDL to create the database? How do I know which tables to create??
Thanks,
Alan -
Re: How do I get the database working?[ Go to top ]
- Posted by: Herve Tchepannou
- Posted on: January 20 2003 19:11 EST
- in response to Alan Wong
Please read the documentation at:
http://xpetstore.sourceforge.net/x357.html -
Re: How do I get the database working?[ Go to top ]
- Posted by: Alan Wong
- Posted on: January 20 2003 19:39 EST
- in response to Herve Tchepannou
Yes, I read and followed those instructions. But, the Ant Build script assumes that the database and tables are already existing. I went in and manually created the xpetstore database in MySql, but now it's complaining that the t_counter table does not exist. Is there suppose to be a script that creates the db and tables??
Thanks,
Alan -
Re: How do I get the database working?[ Go to top ]
- Posted by: Herve Tchepannou
- Posted on: January 20 2003 20:19 EST
- in response to Alan Wong
The T_Counter is used to generate unique ID.
create table t_counter( name varchar(255), value integer ); -
Re: How do I get the database working?[ Go to top ]
- Posted by: Zoran Savic
- Posted on: January 27 2003 04:52 EST
- in response to Alan Wong
I had a similar issue with MySql 3.23, and here is the solution of my problem.
In the class xpetstore.domain.catalog.ejb.ItemEJB one can find the following doclet:
/**
* @ejb.persistence
* column-name="description"
* jdbc-type="VARCHAR"
* sql-type="varchar(256)"
*/
Based on that definition, xDocLet generates the following lines in the file ...gen\META-INF\jbosscmp-jdbc.xml
<cmp-field>
<field-name>description</field-name>
<column-name>description</column-name>
<jdbc-type>VARCHAR</jdbc-type>
<sql-type>varchar(256)</sql-type>
</cmp-field>
and the varchar of size 256 is actually the problem for MySql 3.23, since maximum of 255 is allowed. Due to this error, during deployment, creation of table T_ITEM has failed.
After I've changed that value to 255 in the ItemEJB and generated code again ('build make') everything was OK.
Btw it works also on Windows ME :)
Regards,
Zoran. -
Great Job[ Go to top ]
- Posted by: Clinton Begin
- Posted on: January 20 2003 19:40 EST
- in response to Herve Tchepannou
Excellent job Herve! I think more than anything Java has proven to be the most flexible platform with the most architectural options!
I just wanted to clarify a couple of points:
>> iBatis jPetStore ~ 3100
If you're comparing to the 2.0 editions of the PetStore (MS, TMC and iBATIS), then the line counts are actually as follows:
iBATIS JPetStore = 2215
MS PetStore = 2096
TMC = ....lots
Not that it matters much (a point I make in my white paper). ;-)
The biggest problem with all of these comparisons (LOC and otherwise) is the lack of a real, complete specification for the PetStore requirements/features. For exmaple, I noticed you included the emailer...something TMC, Microsoft and I did not do. Then there's the Web Service and the distributed transaction which I don't see in xPetStore.
>> But, don't forget that the architechture are different.
>> xPetStore has a middle tier (Session as MDB),
>> while iBatis and MS version has none
In the 2.0 version of the .Net Pet Shop, MS claims to have a business tier (albeit a heavily bastardized one).
In the iBATIS JPetStore 2.0 I included one as well (by request). However, it is a very simple POJO (as you suggested to do). Normally I have a more involved business logic tier that is often the "thickest" code in the application. But I found it difficult to find enough business logic in the Pet Store spec (a la TMC/Microsoft) to warrant a complex business layer. It's almost completely a CRUD app. So my business tier does little more than manage data (starting transactions, inserting records etc.). The validation is mostly form level validation in the presentation tier. I suppose it's somewhat of a minimalistic approach ("simplest solution first").
More information about JPetStore 2.0 is available here:
http://www.ibatis.com/jpetstore/jpetstore-2.html
The online demo for 2.0 is available too, but as of this moment it would seem that my IP Address has finally changed. Should be resolved in a couple hours when I get home.
Again, great job. I look forward to trying it out!
Cheers,
Clinton Begin
http://www.ibatis.com -
Great Job[ Go to top ]
- Posted by: Herve Tchepannou
- Posted on: January 21 2003 14:58 EST
- in response to Clinton Begin
[I think more than anything Java has proven to be the most flexible platform with the most architectural options]
You are right clinton, I was comparing with jPetStore v1.0,
which BTW, is also great (all my web-layer is inspired from jPetStore :-)).
[The biggest problem with all of these comparisons (LOC and otherwise) is the lack of a real, complete specification for the PetStore requirements/features]
I aggree 100% with that. Since there are no common specs, all PetStore app should not be compared bc they are differents. It's like comparing apple with oranges
I looked at jPetStore2.0 and jPetStore2.0.1, I saw that you have incoporated WebServices. I'm not familiar with WebServices, but it looks like JAXM offer a simple and portable way to write quickly webservices.
I think that for the next release, your code will help me again to add WebServices ;-) -
RE: Great Job[ Go to top ]
- Posted by: Clinton Begin
- Posted on: January 21 2003 19:25 EST
- in response to Herve Tchepannou
-------
I looked at jPetStore2.0 and jPetStore2.0.1, I saw that you have incoporated WebServices. I'm not familiar with WebServices, but it looks like JAXM offer a simple and portable way to write quickly webservices.
-------
Hehe...before JPetStore 2.0 I had never written a web service either. JAXM was so simple I actually wanted to return the book I bought.
The messiest part is the SOAP marshalling. But there are a number of good frameworks to help with that, JWS and Axle to name a few...
Have fun and keep up the great work!
Clinton Begin
www.ibatis.com -
Re: A boon for the pet store industry[ Go to top ]
- Posted by: Chris James
- Posted on: January 21 2003 04:57 EST
- in response to Herve Tchepannou
Just out of interest, how many lines of XDoclet code did you have to write to generate the 2000 lines of java?
Regards. -
Re: A boon for the pet store industry[ Go to top ]
- Posted by: Herve Tchepannou
- Posted on: January 21 2003 07:22 EST
- in response to Chris James
I haven't counted that, but its probably around 300 -
Excellent work ![ Go to top ]
- Posted by: kierone edwards
- Posted on: January 20 2003 20:43 EST
- in response to Herve Tchepannou
Hi,
I got this working on jboss 3.0.4 and was very impressed. I did find a few issues though ...
i) You need to copy 'all' and not 'default' folder if the distributable tag is being used in Jboss, otherwise I got a org.mortbay.j2ee.session.JGStore classNotFound.
ii) Somethings up with the UID generation during the submit order process, sometimes got a bean id already exists exception.
Other than that all the tests worked ! And of course the ant scripts can be further extended to perform all the actions that are detailed in the notes automatically. (One click install / test).
Excellent work thanks for providing this. -
Hello from the XDoclet team[ Go to top ]
- Posted by: Aslak Hellesøy
- Posted on: January 20 2003 21:53 EST
- in response to Herve Tchepannou
I think I can say (on behalf of the XDoclet team): Great work!
Perhaps you could reduce the LOC even further by generating the persistence layer with Middlegen? That way you'd only have to write the SQL create statements (and no CMP java code at all, since Middlegen generates it).
Cheers,
Aslak -
Works in jboss-3.0.5_tomcat-4.1.18 but not in jboss-3.0.5[ Go to top ]
- Posted by: Jacob Kjome
- Posted on: January 25 2003 13:42 EST
- in response to Herve Tchepannou
Can anyone verify that xpetstore-2.2 works in JBoss 3.0.5 with Tomcat-4.1.18 embedded but not in JBoss with Jetty? I always get a ClassCastException....
12:39:22,781 WARN [jbossweb] WARNING: Exception for /xpetstore
java.lang.ClassCastException
at org.mortbay.j2ee.session.StateAdaptor.checkState(StateAdaptor.java:395)
at org.mortbay.j2ee.session.StateAdaptor.getId(StateAdaptor.java:109)
at org.mortbay.jetty.servlet.ServletHttpRequest.getSession(ServletHttpRequest.java:495)
at com.opensymphony.module.sitemesh.filter.PageFilter.doFilter(Unknown Source)
at org.mortbay.jetty.servlet.WebApplicationHandler$Chain.doFilter(WebApplicationHandler.java:320)
at org.mortbay.jetty.servlet.WebApplicationHandler.dispatch(WebApplicationHandler.java:272)
at org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:553)
at org.mortbay.http.HttpContext.handle(HttpContext.java:1656)
at org.mortbay.jetty.servlet.WebApplicationContext.handle(WebApplicationContext.java:549)
at org.mortbay.http.HttpContext.handle(HttpContext.java:1606)
at org.mortbay.http.HttpServer.service(HttpServer.java:862)
at org.jboss.jetty.Jetty.service(Jetty.java:497)
at org.mortbay.http.HttpConnection.service(HttpConnection.java:752)
at org.mortbay.http.HttpConnection.handleNext(HttpConnection.java:916)
at org.mortbay.http.HttpConnection.handle(HttpConnection.java:769)
at org.mortbay.http.SocketListener.handleConnection(SocketListener.java:202)
at org.mortbay.util.ThreadedServer.handle(ThreadedServer.java:289)
at org.mortbay.util.ThreadPool$PoolThread.run(ThreadPool.java:455)
12:39:23,843 ERROR [SubscribingInterceptor] could not get AbstractReplicatedStore
Anyone know why this is? I followed exactly the same instructions ( http://xpetstore.sourceforge.net/x357.html ) for both JBoss 3.0.5 with Tomcat-4.1.18 embedded and the normal JBoss with JBossWeb (Jetty). Is this a bug in Jetty or a bug in the application which Tomcat deals better with?
Jake -
Works in jboss-3.0.5_tomcat-4.1.18 but not in jboss-3.0.5[ Go to top ]
- Posted by: Herve Tchepannou
- Posted on: January 26 2003 17:42 EST
- in response to Jacob Kjome
xPetStore doesn't work with JBoss-Jetty.
Everything works smootly on JBoss-Tomcat -
JBoss also doen't work as stated in the document[ Go to top ]
- Posted by: Hari Pandalai
- Posted on: January 26 2003 19:39 EST
- in response to Herve Tchepannou
I have great difficult in getting this to work. First of all no db scripts. Even when i create t_item table and populate it somewhere in the build it goes and deletes it despite commenting out in data.sql file. Could you give us some more insights into what all should we tweak to get this working in JBoss/Tomcat? -
JBoss also doen't work as stated in the document[ Go to top ]
- Posted by: Raj Venkataraman
- Posted on: January 26 2003 22:08 EST
- in response to Hari Pandalai
What db are you trying to use? i tried it with Hypersonic, followed the instructions and it just deployed smooth. Im now having trouble doing it with Oracle. I fixed the oracle-service.xml but have some issue with "Missing Keyword" error while Deploying.
2003-01-26 19:32:18,037 WARN [org.jboss.system.ServiceController] Problem starting service jboss.j2ee:jndiName=local/xpetstore.domain.catalog.Category,service=EJB
org.jboss.deployment.DeploymentException: Error while creating table; - nested throwable: (java.sql.SQLException: ORA-00905: missing keyword
)
Anyone tried deploying this with Oracle?
-Raj -
JBoss also doen't work as stated in the document[ Go to top ]
- Posted by: Herve Tchepannou
- Posted on: January 27 2003 08:45 EST
- in response to Hari Pandalai
here are the installation instructions for JBoss:
http://xpetstore.sourceforge.net/x357.html -
JBoss also doen't work as stated in the document[ Go to top ]
- Posted by: Herve Tchepannou
- Posted on: January 27 2003 08:49 EST
- in response to Hari Pandalai
I think that you have a problem of sequence of operation.
You should fill the database only after the application is deployed on JBoss, because JBoss automatically drop all the tables and recreate them.
After the application is deployed, you run 'build.sh db', which will execute the script 'data.sql' and fill all the tables. -
Can not deploy xpetstore.jar to jboss-3.0.6-Tomcat4.1.18[ Go to top ]
- Posted by: x by
- Posted on: February 09 2003 07:43 EST
- in response to Herve Tchepannou
When I deploy xpetstore.jar to jboss-3.0.6, I get many exceptions:
MBeans waiting for other MBeans:
[ObjectName: jboss.j2ee:jndiName=local/xpetstore.domain.signon.Account,service=E
JB
state: FAILED
I Depend On:
Depends On Me: java.lang.ClassNotFoundException: SELECT OBJECT(o) FROM Order AS
o WHERE o.customer.customerUId=?1xpetstore.domain.signon.interfaces.AccountLoca
lHome, ObjectName: jboss.j2ee:jndiName=local/xpetstore.domain.catalog.Product,se
rvice=EJB
state: FAILED
I Depend On:
Depends On Me: org.jboss.deployment.DeploymentException: local home class not f
ound: SELECT OBJECT(o) FROM Order AS o WHERE o.customer.customerUId=?1xpetstore.
domain.signon.interfaces.AccountLocalHome, ObjectName: jboss.j2ee:jndiName=local
/xpetstore.util.uidgen.Counter,service=EJB
state: FAILED
I Depend On:
Depends On Me: org.jboss.deployment.DeploymentException: local home class not f
ound: SELECT OBJECT(o) FROM Order AS o WHERE o.customer.customerUId=?1xpetstore.
domain.signon.interfaces.AccountLocalHome, ObjectName: jboss.j2ee:jndiName=local
/xpetstore.domain.order.Order,service=EJB
state: FAILED
I Depend On:
Depends On Me: org.jboss.deployment.DeploymentException: local home class not f
ound: SELECT OBJECT(o) FROM Order AS o WHERE o.customer.customerUId=?1xpetstore.
domain.signon.interfaces.AccountLocalHome, ObjectName: jboss.j2ee:jndiName=local
/xpetstore.domain.catalog.Item,service=EJB
state: FAILED
I Depend On:
Depends On Me: org.jboss.deployment.DeploymentException: local home class not f
ound: SELECT OBJECT(o) FROM Order AS o WHERE o.customer.customerUId=?1xpetstore.
domain.signon.interfaces.AccountLocalHome, ObjectName: jboss.j2ee:jndiName=local
/xpetstore.domain.catalog.Category,service=EJB
state: FAILED
I Depend On:
Depends On Me: org.jboss.deployment.DeploymentException: local home class not f
ound: SELECT OBJECT(o) FROM Order AS o WHERE o.customer.customerUId=?1xpetstore.
domain.signon.interfaces.AccountLocalHome, ObjectName: jboss.j2ee:jndiName=local
/xpetstore.domain.customer.Customer,service=EJB
state: FAILED
I Depend On:
Depends On Me: org.jboss.deployment.DeploymentException: local home class not f
ound: SELECT OBJECT(o) FROM Order AS o WHERE o.customer.customerUId=?1xpetstore.
domain.signon.interfaces.AccountLocalHome, ObjectName: jboss.j2ee:jndiName=local
/xpetstore.domain.order.OrderItem,service=EJB
state: FAILED
I Depend On:
Depends On Me: org.jboss.deployment.DeploymentException: local home class not f
ound: SELECT OBJECT(o) FROM Order AS o WHERE o.customer.customerUId=?1xpetstore.
domain.signon.interfaces.AccountLocalHome] -
Can not deploy xpetstore.jar to jboss-3.0.6-Tomcat4.1.18[ Go to top ]
- Posted by: x by
- Posted on: February 09 2003 09:20 EST
- in response to x by
After I add these lines into OrderEJB.java
* @ejb.ejb-ref
* ejb-name="Customer"
* view-type="local"
the application can be deploied successful and work fine. Is this the problem? -
Lack of ejbcreate methods for 1 to many CMR beans[ Go to top ]
- Posted by: Javed Mandary
- Posted on: February 15 2003 00:46 EST
- in response to Herve Tchepannou
Herver has shown us the ejbcreate methods of the customer and account beans but what happens between beans having relationships( 1 to many) such as the product and item bean. How to should the ejbcreate methods be written. Actually there are no ejbcreate methods for beans such as product and items because the xpetstore does no need to create and items, products or categories because ther are no "admin pages" for inserting these. could you give us insight how to code these herver? -
Problem with Database linkage[ Go to top ]
- Posted by: Jim Brady
- Posted on: June 12 2003 10:47 EDT
- in response to Herve Tchepannou
Hi Herve,
I was reading a thread between you and Brian McSweeney relating to a problem with xpetstoreDS under JBoss (in my case 3.0.7) and I have exactly the same problem and it is diriving me mad. Maybe you eventually found a solution to that problem and it is not on the noticeboards.
I checked on the jmx console and everything looks OK but when the beans first try to use xpetstoreDS they get the message that it is not bound. What is strange is that if I then run the build.bat db script it crashes saying it cannot find the first table in the SQL - so the separately configured db-name.properties with the same URL and JDBC module are working at getting connection to the database. Could it be a security problem (if so why - don't I see this in some log message)?
My problems are compounded a little by trying to use Cloudbase (while I am waiting for Oracle to be set up here) which I know has not been tested - but I am so close it is very frustrating.
As an aside, do you have the create tables as SQL so I can at least test that?
Jim Brady -
Presto PetStore[ Go to top ]
- Posted by: julio moscon
- Posted on: August 21 2003 14:21 EDT
- in response to Herve Tchepannou
Welcome to the simplest and by far the fastest pet store implementation.
See it running at http://www.prevayler.org/presto
Julio