running seam from within eclipse

6
Running your Seam application from within Eclipse Author: Coen Damen To run your application from within Eclipse 3.3.2, without having to build and separately deploy it. Follow these steps. Pre-conditions: - your application is a Seam maven2 project - you are using Eclipse 3.3.2 - you are using JBoss AS 4.2.2 (1) Download Tomcat 6 http://tomcat.apache.org/download-60.cgi  (2) Download JBoss Embedded http://sourceforge.net/project/showfiles.php?group_id=22866&package_id=228977  (3) Unzip Tomcat 6 (4) Install embedded jboss into Tomcat (the same steps as in the Seam documents) The process for installing Embedded JBoss into Tomcat 6 is quite simple. First, you should copy the Embedded JBoss JARs and configuration files into Tomcat. Copy all files and directories under the Embedded JBoss bootstrap and lib directories, except for the jndi.properties file, into the Tomcat lib directory. Remove the annotations-api.jar file from the Tomcat lib directory. Next, two configuration files need to be updated to add Embedded JBoss-specific functionality. Add the Embedded JBoss listener EmbeddedJBossBootstrapListener to conf/server.xml . It must appear after all other listeners in the file: <Server port="8005" shutdown="SHUTDOWN"> <!-- Comment these entries out to disable JMX MBeans support used for the administration w eb application --> <Listener className="org.apache.catalina.core.AprLifecycleListener" /> <Listener className="org.apache.catalina.mbeans.ServerLifecycleListener" /> <Listener className="org.apache.catalina.mbeans.GlobalResourcesLifecycleListener" /> <Listener className="org.apache.catalina.storeconfig.StoreConfigLifecycleListener" />  <!-- Add this listener -->  <Listener className="org.jboss.embedded.tomcat.EmbeddedJBossBootstrapListener" />  WAR file scanning should be enabled by adding the WebinfScanner listener to conf/context.xml:

Upload: hekuran23

Post on 10-Apr-2018

222 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Running Seam From Within Eclipse

8/8/2019 Running Seam From Within Eclipse

http://slidepdf.com/reader/full/running-seam-from-within-eclipse 1/6

Running your Seam application from within EclipseAuthor: Coen Damen

To run your application from within Eclipse 3.3.2, without having to build and separately deploy it.Follow these steps.

Pre-conditions:- your application is a Seam maven2 project- you are using Eclipse 3.3.2- you are using JBoss AS 4.2.2

(1) Download Tomcat 6

http://tomcat.apache.org/download-60.cgi

(2) Download JBoss Embeddedhttp://sourceforge.net/project/showfiles.php?group_id=22866&package_id=228977

(3) Unzip Tomcat 6

(4) Install embedded jboss into Tomcat (the same steps as in the Seam documents)

The process for installing Embedded JBoss into Tomcat 6 is quite simple. First, you shouldcopy the Embedded JBoss JARs and configuration files into Tomcat.

Copy all files and directories under the Embedded JBoss bootstrap and lib directories,except for the jndi.properties file, into the Tomcat lib directory.

Remove the annotations-api.jar file from the Tomcat lib directory.

Next, two configuration files need to be updated to add Embedded JBoss-specificfunctionality.

Add the Embedded JBoss listener EmbeddedJBossBootstrapListener toconf/server.xml . It must appear after all other listeners in the file:

<Server port="8005" shutdown="SHUTDOWN"><!--

Comment these entries out to disable JMX MBeans support used for the administration web application -->

<Listener className="org.apache.catalina.core.AprLifecycleListener" />

<Listener className="org.apache.catalina.mbeans.ServerLifecycleListener" />

<Listener className="org.apache.catalina.mbeans.GlobalResourcesLifecycleListener" />

<Listener className="org.apache.catalina.storeconfig.StoreConfigLifecycleListener" />

<!-- Add this listener -->

<Listener className="org.jboss.embedded.tomcat.EmbeddedJBossBootstrapListener" />

WAR file scanning should be enabled by adding the WebinfScanner listener toconf/context.xml :

Page 2: Running Seam From Within Eclipse

8/8/2019 Running Seam From Within Eclipse

http://slidepdf.com/reader/full/running-seam-from-within-eclipse 2/6

<Context>

<!-- Default set of monitored resources -->

<WatchedResource>WEB-INF/web.xml</WatchedResource>

<!-- Uncomment this to disable session persistence across Tomcat restarts -->

<!--<Manager pathname="" />-->

<!-- Add this listener -->

<Listener className="org.jboss.embedded.tomcat.WebinfScanner" />

</Context>

(5) Now startup Tomcat to see if it works fine by running the apache-tomcat-6.0.18\bin\startup.bat

If you see any errors, check if you have done the above procedures correctly

(6) Generate an EAR file of your project using the “mvn clean install ” target. The EAR file will becopied to your JBoss deploy directory.

(7) Copy all jars from the myapplication.ear and myapplication.ear\lib into the tomcat\libdirectory

(8) Copy all jars from the myapplication.ear\ myapplication.war\WEB-INF\lib into the tomcat\libdirectory

(9) Copy boss-4.2.2.GA\server\default\deploy\jboss-web.deployer\jsf-libs\ jsf-impl.jar into thetomcat\lib directory

(10) Copy boss-4.2.2.GA\server\default\deploy\jboss-web.deployer\jsf-libs\ jsf-api.jar into thetomcat\lib directory

(11) Add the EJB project as a reference to the WAR project (see picture)

Page 3: Running Seam From Within Eclipse

8/8/2019 Running Seam From Within Eclipse

http://slidepdf.com/reader/full/running-seam-from-within-eclipse 3/6

(12) Set the build order of your projects

(13) Create a runtime target pointing to the Tomcat location

Page 4: Running Seam From Within Eclipse

8/8/2019 Running Seam From Within Eclipse

http://slidepdf.com/reader/full/running-seam-from-within-eclipse 4/6

And follow the instruction

(14) Add the WAR and referenced EJB to the server config.

Go to the servers pane and select the Tomcat server. Right click on i t and select “add andremove projects”

Page 5: Running Seam From Within Eclipse

8/8/2019 Running Seam From Within Eclipse

http://slidepdf.com/reader/full/running-seam-from-within-eclipse 5/6

(15) Copy the context.xml from your TOMCAT\conf directory to the runtime server target. Seepicture.

Add the following lines to the context.xml file (within the <context> tags):

<Resource name ="myDatasource" auth ="Container"

type ="javax.sql.DataSource"driverClassName ="oracle.jdbc.OracleDriver" url ="jdbc:oracle:thin:@localhost:1521:XE" username ="UMBRELLA" password ="YOUR_PW" maxActive ="20" maxIdle ="10" maxWait ="-1" />

(16) Change the jndi-pattern in the components.xml of the WAR project and change

<core:init debug ="true" jndi-pattern ="myapplication/#{ejbName}/local" />

To

<core:init debug ="true" jndi-pattern ="#{ejbName}/local" />

Note that if you are deploying back to Jboss, you need to reset this tag.

(17) Copy the myapplication-dev-ds.xml from the EAR project into the apache-tomcat-6.0.18\lib\deploy directory

(18) Now you are ready to start the application.

You can start up the server and then go to the url. Or you can select the index/home page

and select run on server from the context menu.

Page 6: Running Seam From Within Eclipse

8/8/2019 Running Seam From Within Eclipse

http://slidepdf.com/reader/full/running-seam-from-within-eclipse 6/6