Techie has posted 1 posts at DZone. View Full User Profile

How to Make JBoss Seam Work with Eclipse (for Windows)

05.23.2008
| 36225 views |
  • submit to reddit

This is a step-by-step tutorial. I made this Tutorial, because I was not happy with the four project folders generated by JBoss Tools 2.0.0 when I select a new Seam EAR project. The work is a bit confusing. If I create a new Seam WAR project I only get two projects (one of them is a test project). I had a lot of trouble with the WAR project. I was not able to not get the EJB3 examples work with it. Never the less the folder structure is different from the Seam-gen generated projects. This tutorial works completely without JBoss Tool. You can use JBoss Tools anyway, it has nice functions do build a RichFaces JSF page, but keep in mind that new generated projects are difficult to handle, since you have to keep an overview of all four projects and the changes you made in each of them.

Download and extract the files

 

First of all you need to download a few things.

Eclipse for Java EE Developers (second entry)
http://www.eclipse.org/downloads/

Try to download the last GAs from the JBoss websites.

JBoss Seam 2.0.X (of course)
http://labs.jboss.com/jbossseam/download/index.html

And the JBoss Application Server 4.2.X
http://labs.jboss.com/jbossas/downloads/

And you will need a database, I used MySQL. Download the proper JDBC Driver
http://dev.mysql.com/downloads/connector/j/5.0.html

Extract these files where you like but keep in mind not to use blanks ” ” or special characters “áä”.
I used “C:\Development” as path. Create a new workspace folder here.

Now the folder should look like this:

folder

Download and install Database

Download the MySQL Database from this Page
http://dev.mysql.com/downloads/mysql/5.0.html

Next we need to get our database up and running.

Run the setup and make a “typical” installation. At the end of the setup configure the MySQL server. Choose “Standard Configuration”. Do not change anything in the next screen. Now set root password for the DB. I used “mysql” at this point (very inventive, huh?). Go to the next screen and finish the configuration.


Setup JBoss Seam and create a new project

You need to create a new Seam project

Enter the Console, Start => Run an enter “cmd”
Enter “C:” and change the Directory to the JBoss Seam installation
“cd C:\Development\jboss-seam-2.0.X.GA”.

Now it is time to setup JBoss Seam.

Type: “seam setup”

Seam welcomes us but wants to know some things about our project.

Seam

Enter the project folder. That will be our workspace
“C:\Development\workspace”

Enter the Directory of the JBoss Application Server
“C:\Development\jboss-4.2.2.GA”

Give the Seam project a name.
“MyFirstSeamProj”

RichFaces is fine. Hit enter.

The BlueSky Theme is fine, too. Hit enter.

EAR, ok. Hit enter

Enter the package name of your session beans.
“com.mydomain.MyFirstSeamProj.session”

Enter the package name of your entity beans.
“com.mydomain.MyFirstSeamProj.entity”

The package for the test cases is ok. Enter.

I use MySQL, so I enter “mysql”.

Dialect is ok. Enter.

Enter the path to the JDBC driver. In this case it is
“C:\Development\mysql-connector-java-5.0.8\mysql-connector-java-5.0.8-bin.jar”

 

This is the driver class, hit enter.

 

Now it gets a bit tricky. Enter the connection URL to your Database.

I used the test database in my MySQL installation.
“jdbc:mysql://localhost:3306/test”
The username was “root” and the password “mysql”.

There is no DB catalog in this case. Enter.

There are no tables so far. Enter.

I want to keep my tables. Enter.

The setup is finished. That was a lot of work, so where is my project?
There is no project till now.

Enter “seam create-project”

There it is!

Seam finished

 

That’s enough console hacking for now.

Published at DZone with permission of its author, Techie Exchange.

(Note: Opinions expressed in this article and its replies are the opinions of their respective authors and not those of DZone, Inc.)

Comments

Alain Hoang replied on Sun, 2008/07/13 - 5:40pm

Great post...

 

Priyank Doshi replied on Wed, 2008/07/16 - 6:52pm

Hi ,

I followed your instruction and I am stuck at 1 place where you restart the server and  run ANT on "build.xml". and after that you give "succesffull".And when I checked on the "localhost:8080/MyFirstSeamProj" it gives error as localhost 404 but I checked my server is running. so what could be the possible error 

srinivas rao replied on Tue, 2009/03/10 - 1:00am

It was great post! I have frustrated to read a lot of blogs to build and run seam application. By using this post, I have build, run and deploy the application successfully. I have a query about database configuration. I am new to hibernate. I am using mysql as a database. When I have run registration application. 'users' table is created by default under the 'test' schema. When I registered new user, data updated into the 'users' table. I couldn’t find the query hbm files in the sem-gen application. So could you please brief more about application to database relationship and configurations Many Thanks, Rao.

Uma Maheswari Muthu replied on Tue, 2011/09/20 - 12:18am

It was a great blog for seam beginners.

I followed the steps provided here for registration example.

But I get the error as

It would be a great help, please help me to resolve this issue

 

org.jboss.seam.InstantiationException: Could not instantiate Seam component: register
    at org.jboss.seam.Component.newInstance(Component.java:2170)
    at org.jboss.seam.Component.getInstance(Component.java:2024)
    at org.jboss.seam.Component.getInstance(Component.java:1986)
    at org.jboss.seam.Component.getInstance(Component.java:1980)
    at org.jboss.seam.Namespace.getComponentInstance(Namespace.java:55)
    at org.jboss.seam.Namespace.getComponentInstance(Namespace.java:50)
    at org.jboss.seam.el.SeamELResolver.resolveBase(SeamELResolver.java:148)
    at org.jboss.seam.el.SeamELResolver.getValue(SeamELResolver.java:51)
    at javax.el.CompositeELResolver.getValue(CompositeELResolver.java:53)
    at com.sun.faces.el.FacesCompositeELResolver.getValue(FacesCompositeELResolver.java:72)
    at org.jboss.el.parser.AstIdentifier.getValue(AstIdentifier.java:44)
    at org.jboss.el.parser.AstValue.getTarget(AstValue.java:34)
    at org.jboss.el.parser.AstValue.invoke(AstValue.java:95)
    at org.jboss.el.MethodExpressionImpl.invoke(MethodExpressionImpl.java:276)
    at com.sun.facelets.el.TagMethodExpression.invoke(TagMethodExpression.java:68)
    at javax.faces.component.MethodBindingMethodExpressionAdapter.invoke(MethodBindingMethodExpressionAdapter.java:88)
    at com.sun.faces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:102)
    at javax.faces.component.UICommand.broadcast(UICommand.java:387)
    at org.ajax4jsf.component.AjaxViewRoot.processEvents(AjaxViewRoot.java:329)
    at org.ajax4jsf.component.AjaxViewRoot.broadcastEventsForPhase(AjaxViewRoot.java:304)
    at org.ajax4jsf.component.AjaxViewRoot.processPhase(AjaxViewRoot.java:261)
    at org.ajax4jsf.component.AjaxViewRoot.processApplication(AjaxViewRoot.java:474)
    at com.sun.faces.lifecycle.InvokeApplicationPhase.execute(InvokeApplicationPhase.java:82)
    at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:100)
    at com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:118)
    at javax.faces.webapp.FacesServlet.service(FacesServlet.java:265)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
    at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:83)
    at org.jboss.seam.web.IdentityFilter.doFilter(IdentityFilter.java:40)
    at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
    at org.jboss.seam.web.MultipartFilter.doFilter(MultipartFilter.java:90)
    at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
    at org.jboss.seam.web.ExceptionFilter.doFilter(ExceptionFilter.java:64)
    at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
    at org.jboss.seam.web.RedirectFilter.doFilter(RedirectFilter.java:45)
    at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
    at org.ajax4jsf.webapp.BaseXMLFilter.doXmlFilter(BaseXMLFilter.java:206)
    at org.ajax4jsf.webapp.BaseFilter.handleRequest(BaseFilter.java:290)
    at org.ajax4jsf.webapp.BaseFilter.processUploadsAndHandleRequest(BaseFilter.java:388)
    at org.ajax4jsf.webapp.BaseFilter.doFilter(BaseFilter.java:515)
    at org.jboss.seam.web.Ajax4jsfFilter.doFilter(Ajax4jsfFilter.java:56)
    at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
    at org.jboss.seam.web.LoggingFilter.doFilter(LoggingFilter.java:60)
    at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
    at org.jboss.seam.web.HotDeployFilter.doFilter(HotDeployFilter.java:53)
    at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
    at org.jboss.seam.servlet.SeamFilter.doFilter(SeamFilter.java:158)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
    at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:230)
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
    at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:182)
    at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:432)
    at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:84)
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
    at org.jboss.web.tomcat.service.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:157)
    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:262)
    at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
    at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
    at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:446)
    at java.lang.Thread.run(Unknown Source)
Caused by: javax.naming.NameNotFoundException: UmaSeam not bound
    at org.jnp.server.NamingServer.getBinding(NamingServer.java:529)
    at org.jnp.server.NamingServer.getBinding(NamingServer.java:537)
    at org.jnp.server.NamingServer.getObject(NamingServer.java:543)
    at org.jnp.server.NamingServer.lookup(NamingServer.java:267)
    at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:667)
    at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:627)
    at javax.naming.InitialContext.lookup(Unknown Source)
    at org.jboss.seam.Component.instantiateSessionBean(Component.java:1403)
    at org.jboss.seam.Component.instantiate(Component.java:1367)
    at org.jboss.seam.Component.newInstance(Component.java:2148)

 

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.