1 2 3 Previous Next 31 Replies Latest reply: Sep 14, 2009 9:31 AM by 843833 RSS

    Running Petstore 2.0 with jboss

    843833
      Hi all,
      I could run petstore 2.0 with netbeans 5.5 and sun java application server 9.0.
      Can someone list out the changes that i need to make to petstore 2.0 so that i can run it using jboss. Kindly help.
        • 1. Re: Running Petstore 2.0 with jboss
          843833
          Hi,

          We have not tried it on JBoss. If someone gets it running on JBoss, let us know and maybe you can contribute the instructions to the blueprints petstore project so we can share that info with other users.

          hth,
          Sea
          • 2. Re: Running Petstore 2.0 with jboss
            843833
            Hi,
            Atleast vaguely give me some ideas on what changes need to be done. And also on how to start the database?
            • 3. Re: Running Petstore 2.0 with jboss
              843833
              Hi,
              And also on how to start the database?
              Not sure what you mean. To start the JavaDB that comes with the SDK download, you can just do "asadmin start-database", but I guess you know that since it is part of petstore installation on Java EE SDK. Not sure what exactly you mean but I will take sme guesses.

              You should be able to use any DB such as Java DB (bundled in SDK download) or MySQL with JBoss, just like you can use any DB with the Java EE SDK app server. Each DB has slightly different command to start it up, it is DB specific. Maybe you dont mean how to start the Java DB or how to start MySQL?

              Do you mean are there any changes to the database? For petstore, the ant command "ant setup" does the work to set up the DB, by registering the JDBC drivers & pools & resources etc with the SDK app server. You would need to do the same when using any application server, you would need to register some resources so app server can connect to the DB. I do not know exactly how to do that on JBoss, but you can see the setup we do for petstore by looking in petstore\setup\setup.xml file (This is the file called when you run ant setup with PS). This makes the App server aware of the DB and associated artcifacts for app server to work with DB for the app.

              Maybe you mean, how do you get the data into the DB. So lets say you are using JavaDB or MySQL as the DB. For petstore we have some DB scripts which create some tables and insert data into the DB and also deletes those tables on ant unsetup. These are just regular DB scripts. We call those during ant setup also. Those files are in petstore\setup\sql\javadb\ and are named petstore.sql and delete.sql and are standard DB scripts. These scripts are usually very similair among databases. I think MySQL might want the table names to be uppercase, but otherwise the same DB script should work on MySQL and JavaDB, maybe some small changes for another DB like Oracle. Somethimes each DB requires some slight difference but the petstore script is farily straight forward.

              Maybe that answers your DB question?

              hth,
              Sean
              • 4. Re: Running Petstore 2.0 with jboss
                843833
                Hi,
                Atleast vaguely give me some ideas on what changes
                need to be done.
                First, I am assuming JBoss is Java EE 5 compliant and has latest Java EE technologies, latest versions of JSF etc.

                Petstore is a web app, so just a war file. We do not use any EJBs. So should be slightly easier to port o another app server.

                You could also check out https://blueprints.dev.java.net/petstore/faq.html for an idea of some of the technologies used.

                Need to setup the data base stuff. I mentioned that in another posting.

                AFAIK we dont use any Sun specific APIs, just use the standard Java EE 5 APIs. Plus we use some other third-party libraries like Dojo toolkit but they are bundled and included in the war file. Should not be any problems there if app server is Java EE 5 compliant.

                Another thing that sometimes gets you is the use of any environment settings etc. Off the top of my head, one thing we do is set a proxy and host property (you set those in the build.properties file when you setup and deploy petstore). These properties are used if you are running behind a firewall. We pass them in through Servlet context and have them in web.xml, see the
                <context-param>
                <param-name>proxyHost</param-name>
                <param-value>@@proxy.host@@</param-value>
                </context-param>
                etc. These values are filled out with real values in ant script. I dnt think these properties will be a problem, but these are only external properties I can think of right now. Probably not a problem, but if you see a message in error log about proxy and host it could help troubleshoot.

                Basically, the PS is is just a war file so is not too complicated. Once you have DB setup, maybe just try to build and deploy it?

                hth,
                Sean
                • 5. Re: Running Petstore 2.0 with jboss
                  843833
                  Hi,

                  The only other environment specific thing
                  I can think of off the top of my head would be that we store the image files on the filesystem of the app server.

                  Mark, maybe you can suggest any hints to avoid a problem when deploying on another app server?

                  Usually it is just the environment specific things like this that casue problems and we only have a few. And maybe they wont casue any problem.
                  hth,
                  Sean
                  Hi,
                  Atleast vaguely give me some ideas on what changes
                  need to be done. And also on how to start the
                  database?
                  • 6. Re: Running Petstore 2.0 with jboss
                    843833
                    Hi Sean,

                    Thanks for ur suggestions... I hav made a start. I need to change app-server.properties, app-server-ant.xml, build.properties, setup.xml...

                    Regarding the database part , i meant how to use a different database than javaDB...i should hav been more clear. I'm planning to use MySQL.

                    Also in build.properties do we need to give a username and password textfile because jboss does not ask for username and password during installation?
                    • 7. Re: Running Petstore 2.0 with jboss
                      843833
                      Hi,
                      Also in build.properties do we need to give a
                      username and password textfile because jboss does not
                      ask for username and password during installation?
                      Yes, in the petstore build.properties there is a property avaee.server.passwordfile=c:/Sun/SDK/samples/bp-project/passwordfile
                      which refers to a file that has the password used at SDK installation. This is so ant commands to the SDK to deploy an app or to set up resources in the app server require a password.
                      # Edit this property to point to a file that
                      # contains the admin password for your app-server.
                      # The file should contain the password in the following line:
                      #
                      # AS_ADMIN_PASSWORD=adminadmin
                      #
                      # Notice that the password is adminadmin since this is
                      # the default password used by the glassfish app-server installation.
                      # For your purpose, use the password that you chose while installing
                      # the SDK
                      javaee.server.passwordfile=c:/Sun/SDK/samples/bp-project/passwordfile

                      but if JBoss does not require any security such as password to deploy an applicatioon or setup resources on the app server, then I guess you do not need the property, and you dont need to supply it on any of the commands to deploy the application or set it up.

                      hth,
                      Sean
                      • 8. Re: Running Petstore 2.0 with jboss
                        843833
                        Hi sean,

                        Do we need a patch file to run petstore 2.0 on jboss? I went through the set up for petstore 1.1.2 and petstore 1.3.1...it specifies about using a patch file.
                        • 9. Re: Running Petstore 2.0 with jboss
                          843833
                          Hi,

                          No you do not have a patch file for petstore 2.0. Pet store 2.0 is completely new code base so shares no code with previous petstores.

                          If you discover any things that need fixing in the code to port to another app server to make the app more portable, we can update the code and make it part of the petstore 2.0.

                          hth,
                          Sean
                          • 10. Re: Running Petstore 2.0 with jboss
                            843833
                            Hi all,

                            Sorry for newbie questions or wrong assuptions, but the last app server that I have configured is Tomcat, about 4 years ago.

                            I am also trying to run Petstore 2.0 with JBoss, and my current problem is that the app-server-ant.xml is completely based in the "asadmin" command, that if I'm not wrong is from Glassfish. So, how can I run it within JBoss context?

                            Since these posts are 8 months old, was anyone able to configure it? If so, has a step-by-step setup?

                            thanks in advance, any kind help appreciated...
                            • 11. Re: Running Petstore 2.0 with jboss
                              843833
                              I could successfully get Petstore running on JBoss 5 and MySQL5. is the Forum the only place to give the knowledge back. Or is there a wiki/mail id I can send the document
                              • 12. Re: Running Petstore 2.0 with jboss
                                843833
                                I checked the glassfish wiki and the blue prints project on java.net where it is mentioned, "tell us about it" but no link or mail id is given.
                                • 13. Re: Running Petstore 2.0 with jboss
                                  843833
                                  Hi Mani,

                                  Can you tell me how have you used Petstore 2.0 with JBoss 5.0 ???
                                  • 14. Re: Running Petstore 2.0 with jboss
                                    843833
                                    NOTE:This set of instructions span across multiple posts due to the 7500 max length restriction by the forum.

                                    I had to deploy petstore2.0 using JBoss and MySQL. The details that follow are for the petstore 2.0 EA version. I am not sure about the earlier versions. Sorry. The updates for MySQL can be obtained from http://wiki.glassfish.java.net/Wiki.jsp?page=Petstore_MySql.

                                    Some additional changes for MySQl are mentioned below (These are specific to Jboss). Some of the MySQl section would be repetetions.
                                    $petstore_root=Root folder of the project (default is javapetstore-2.0-ea5)

                                    File $petstore_root/bp-project/app-server-ant.xml
                                    The following changes
                                    1. <pathelement location="${javaee.home}/lib/javaee.jar"/>
                                    modified as <pathelement location="${javaee.home}/client/jboss-javaee.jar"/>

                                    2.The target create-jdbc-resource has been updated as
                                     
                                    <target name="create-jdbc-resource" depends="tools"
                                    description="creates jdbc resource">
                                    <available file="setup/jboss-ds.xml" property="jboss.ds.exists"/>
                                    <fail unless="jboss.ds.exists" message="Could not find setup/jboss-ds.xml"/>
                                    <copy file="setup/jboss-ds.xml" todir="${javaee.domaindir}/deploy"/>
                                    </target>
                                    3. the target delete-jdbc-resource has been updates as
                                    <target name="delete-jdbc-resource"
                                    description="deletes jdbc resource" depends="tools">
                                    <available file="${javaee.domaindir}/deploy/jboss-ds.xml" property="jboss-ds.exists"/>
                                    <fail unless="jboss-ds.exists" message="The property jdbc.resource.name must be set before invoking this target. Otherwise there is no JDBC resource to delete."/>
                                    <delete file="${javaee.domaindir}/deploy/jboss-ds.xml"/>
                                    </target>
                                    File $petstore_root/bp-project/app-server.properties
                                    1. added
                                    javaee.server.provider=jboss 
                                    2.
                                    javaee.home=C:/jboss-5.1.0.GA 
                                    3.
                                    javaee.jar=${javaee.home}/client/jbossall-client.jar 
                                    4.
                                    appserver.instance=default 
                                    5.
                                    javaee.domaindir=${javaee.home}/server/default 
                                    6. DB properties
                                    db.delimiter=;
                                    db.home=C:/Program Files/MySQL/MySQL Tools for 5.0/java
                                    db.root=${db.home}
                                    db.driver=com.mysql.jdbc.Driver
                                    db.datasource=com.mysql.jdbc.jdbc2.optional.MysqlDataSource
                                    db.port=3306
                                    db.sid=petstore
                                    db.user=root
                                    db.password=abcd
                                    db.jvmargs=-ms16m -mx32m
                                    db.url=jdbc:mysql://${javaee.server.name}:${db.port}/${db.sid}
                                    db.admin.url=jdbc:mysql://${javaee.server.name}:${db.port}/mysql (needed for create db target)
                                    db.vendorname=SQL92
                                    1 2 3 Previous Next