Posted on
December 25th, 2011
Today I spend some time deploying a simple Spring Roo application on JBoss AS 7. I faced lot of issues in making Spring Roo application run on JBoss AS7. This is a step by step guide from creating Spring Roo application using Roo shell to configuring different databases like h2 and MySQL and finally making them run on JBoss AS7. So lets get started. Please make sure that you have downloaded latest Spring Roo version 1.2 and JBoss AS 7 from their respective web sites.
- Created a simple Spring Roo web application by typing the commands shown below.
project --topLevelPackage com.shekhar.bookshop --projectName bookshop
jpa setup --database H2_IN_MEMORY --provider HIBERNATE --jndiDataSource java:jboss/datasources/ExampleDS
entity jpa --class ~.domain.Book
field string --fieldName title --notNull
field string --fieldName author --notNull
field number --type double --fieldName price --notNull
web mvc setup
web mvc all --package ~.web
perform package
q
- Make sure in the applicationContext.xml the jndi declaration look like as shown below
<jee:jndi-lookup id="dataSource" jndi-name="java:jboss/datasources/ExampleDS"/>
- Rename the bookshop-0.1.0.BUILD-SNAPSHOT.war to bookshop.war and copy it to <JBoss-AS7-HOME>/standalone/deployments folder and start the server using ./standalone.sh on *nix machines. Read more »
Posted on
July 7th, 2011
Last XKE me and Sameer started a sandpit to evaluate the capabilities of OpenShift and see how easy or difficult will be to deploy an existing or new Java applications on OpenShift . OpenShift is a multi-language(PHP, Ruby, Python, Java), multi-framework Platform as a Service provided by RedHat with the goal to help developers build application without thinking much about infrastructure .
It is available in three editions :
- Express : Express is a free PaaS for building and deploying Ruby, PHP, and Python applications. Express now supports Java as well. When this article was written Java was not supported.
- Flex : Flex is a Paas for building and deploying web applications written in Java, JavaEE 6, or PHP . Flex also allows you to manage, monitor, and auto-scale applications from web interface. You need Amazon EC2 account to use Flex.
- Power : Power as the name suggests is the most powerful edition of OpenShift and can run any application written in any language on it. Power gives you the ultimate flexibility and access at the operating system configuration level.
We decided to choose Flex edition as we wanted to deploy a standard Java Spring Hibernate MySQL application on OpenShift. Deploying an existing MySQL application on OpenShift was not straightforward so I am writing this blog to help other Java developers facing trouble deploying application on OpenShift. There was no documentation on how you can deploy a Java web application with MySQL as database.
In this blog will walk you step by step how you can deploy a Spring Hibernate MySQL application on OpenShift. The application server that we will be choosing for this application will be Tomcat. Flex support both JBoss and Tomcat server.
Read more »