3 Replies Latest reply on Mar 7, 2007 4:33 PM by Tony Herstell

    Eclipse, JBoss & exploded deployment

    adsf adsf Newbie

      Hello,

      I'm spent the whole day trying to figure out how to convince the Exadel Studio to deploy ear, war, ... to my JBoss AS in an _exploded_ format (just like seam-gens ant script does).

      I don't care if I use Exadel, JBoss IDE or just plain Eclipse with WTP but I would like to use Eclipse _without_ seams ant script and I found several threads here but none showed a solution - although it seems that many of you are using it this way.

      So could someone *please* give me a hint how to configure Eclipse to deploy my ear & war in an exploded format to a certain directory!

      Thanks a lot in advance!

        • 1. Re: Eclipse, JBoss & exploded deployment
          adsf adsf Newbie

          Thanks to symbolic links I have it working now but I have one more question:

          According to http://wiki.jboss.org/wiki/Wiki.jsp?page=DeployTipsAndBuildSampleScripts (the "Exploded EAR, JAR, SAR, WAR Deployment (Option 1)" approach) it would work if I put my .ear and my .war in the _same_ directory (*not* .war inside .ear) and it should work but my JBoss is always looking _inside_ the .ear directory.

          So is the wiki entry wrong or does this really work?

          • 2. Re: Eclipse, JBoss & exploded deployment
            Marcus Adair Newbie

            In my experience so far, you need to have a real ear directory of some name, under which your various wars and jars will be deployed by the native Eclipse builder. Additionally, you need to put this under a deploy directory, so that you can tell JBoss to poll that directory for deployable modules. It's not beautiful, but it works, without needing to message with Eclipse's link dirs, and everything can be checked in for a team to use as is without special local setup.

            So, for instance, in your project base path, you could create a "deploy/" directory, and under that put "projectname.ear/" directory. Inside that create the ear's deploy/projectname.ear/META-INF directory and any relevant files.

            Then in the java build path dialog for the project, on the source tab, check the box for "Allow output folders for source folders". Then go through each of your sub-archives' src and resource dirs in that tab, and set their "Output folder" to each one's appropriate, exploded-style, directory under the previously created projectname.ear location.

            If my extremely unclear instructions make any sense, you should now have Eclipse auto-building into an exploded ear, and all that remains is that your configure JBoss to poll that directory. So for instance you should have something like:

            /deploy/
             /projectname.ear/
             /META-INF/
             /projectname.jar/
             /projectname.war/
            


            If anyone has a better way to do this, that also fulfills all the reasonable goals, such as team-compatibility without extra local configuration, hacks, and other messiness, I'd be very interested. This has worked great for me for sometime though.



            • 3. Re: Eclipse, JBoss & exploded deployment
              Tony Herstell Master

              This work for MyEclipse.

              Create an ear project
              Create a jar project
              Create a war project

              Add in jars to the Ear area first

              Where your Jar and War needs a jar thats in the ear create a reference to a jar in another project (the EAR).. you should only have 1 copy of a jar in the whole project.



              Edit you ear project properties to tell it NOT to update the application.xml as its not seam compatible!

              use MyElcipse menu on the ear and tell it deploy exploded to your JBoss server.

              click run on the JBoss Server.

              bingo... and your console in MyEclipse will show JBoss running up...

              Any changes to xhtml/code will be instantly visible (No deploy restart of the server).

              Never touch Ant (unless MyEclispe does under the hood)!!

              I am going to upload an example of a MyEclipse project but am waiting for a stable IceFaces. email me if you want a copy of what I have got so far so you can nosy around it.



              In case it helps...

              my application.xml looks like:

              <application>
               <display-name>risingstars</display-name>
              
               <module>
               <web>
               <web-uri>risingstars_war.war</web-uri>
               <context-root>/risingstars</context-root>
               </web>
               </module>
              
               <module>
               <ejb>risingstars_jar.jar</ejb>
               </module>
              
               <!-- Seam -->
              
               <module>
               <java>jboss-seam.jar</java>
               </module>
              
               <!-- Icefaces -->
               <module>
               <java>icefaces.jar</java>
               </module>
              
               <module>
               <java>icefaces-comps.jar</java>
               </module>
              
               <module>
               <java>el-api.jar</java>
               </module>
              
               <module>
               <java>el-ri.jar</java>
               </module>
              
               <module>
               <java>icefaces-facelets.jar</java>
               </module>
              
               <module>
               <java>commons-fileupload.jar</java>
               </module>
              
               <!-- Seam - Rules (Security and jBPM) -->
              
               <module>
               <java>drools-compiler-3.0.5.jar</java>
               </module>
              
               <module>
               <java>drools-core-3.0.5.jar</java>
               </module>
              
               <module>
               <java>commons-jci-core-1.0-406301.jar</java>
               </module>
              
               <module>
               <java>commons-jci-janino-2.4.3.jar</java>
               </module>
              
               <module>
               <java>commons-lang-2.1.jar</java>
               </module>
              
               <module>
               <java>janino-2.4.3.jar</java>
               </module>
              
               <module>
               <java>stringtemplate-2.3b6.jar</java>
               </module>
              
               <module>
               <java>antlr-2.7.6.jar</java>
               </module>
              
               <module>
               <java>antlr-3.0ea8.jar</java>
               </module>
              
              </application>
              


              components.xml
              <components xmlns="http://jboss.com/products/seam/components"
               xmlns:core="http://jboss.com/products/seam/core"
               xmlns:security="http://jboss.com/products/seam/security"
               xmlns:drools="http://jboss.com/products/seam/drools"
               xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
               xsi:schemaLocation="http://jboss.com/products/seam/core http://jboss.com/products/seam/core-1.1.xsd
               http://jboss.com/products/seam/components http://jboss.com/products/seam/components-1.1.xsd
               http://jboss.com/products/seam/security http://jboss.com/products/seam/security-1.1.xsd
               http://jboss.com/products/seam/drools http://jboss.com/products/seam/drools-1.1.xsd">
              
               <component name="org.jboss.seam.core.init">
               <property name="debug">true</property>
               <property name="myFacesLifecycleBug">false</property>
               <property name="jndiPattern">
               risingstars/#{ejbName}/local
               </property>
               </component>
              
               <!-- 120 second conversation timeout -->
               <component name="org.jboss.seam.core.manager">
               <property name="conversationTimeout">120000</property>
               </component>
              
               <component class="org.jboss.seam.core.Ejb" installed="false" />
              
               <!-- Security -->
               <security:identity
               authenticate-method="#{authenticationController.authenticate}" />
              
               <drools:rule-base name="securityRules">
               <drools:rule-files>
               <value>/META-INF/security-rules.drl</value>
               </drools:rule-files>
               </drools:rule-base>
              
               <factory name="basePath"
               value="#{facesContext.externalContext.request.scheme}://#{facesContext.externalContext.request.serverName}:#{facesContext.externalContext.request.serverPort}#{facesContext.externalContext.request.contextPath}/" />
              
              </components>
              
              


              web.xml
              <?xml version="1.0" encoding="UTF-8"?>
              
              <web-app version="2.5"
               xmlns="http://java.sun.com/xml/ns/javaee"
               xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
               xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">
              
              <!-- TODO
               <context-param>
               <param-name>javax.faces.CONFIG_FILES</param-name>
               <param-value>/WEB-INF/navigation.xml</param-value>
               </context-param>
              -->
              
               <!-- Seam -->
              
               <listener>
               <listener-class>org.jboss.seam.servlet.SeamListener</listener-class>
               </listener>
              
               <!-- Propagate conversations across redirects -->
              <!--
               <filter>
               <filter-name>Seam Redirect Filter</filter-name>
               <filter-class>org.jboss.seam.servlet.SeamRedirectFilter</filter-class>
               </filter>
              
               <filter-mapping>
               <filter-name>Seam Redirect Filter</filter-name>
               <url-pattern>*.seam</url-pattern>
               </filter-mapping>
              -->
               <filter>
               <filter-name>Seam Exception Filter</filter-name>
               <filter-class>org.jboss.seam.servlet.SeamExceptionFilter</filter-class>
               </filter>
              
               <filter-mapping>
               <filter-name>Seam Exception Filter</filter-name>
               <url-pattern>*.seam</url-pattern>
               </filter-mapping>
              
               <!-- JSF -->
              
               <context-param>
               <param-name>javax.faces.STATE_SAVING_METHOD</param-name>
               <param-value>client</param-value>
               </context-param>
              
               <context-param>
               <param-name>javax.faces.DEFAULT_SUFFIX</param-name>
               <param-value>.xhtml</param-value>
               </context-param>
              
               <context-param>
               <param-name>facelets.DEVELOPMENT</param-name>
               <param-value>true</param-value>
               </context-param>
              
               <context-param>
               <param-name>com.icesoft.faces.actionURLSuffix</param-name>
               <param-value>.seam</param-value>
               </context-param>
              
               <context-param>
               <param-name>com.icesoft.faces.synchronousUpdate</param-name>
               <param-value>true</param-value>
               </context-param>
              
               <servlet>
               <servlet-name>Faces Servlet</servlet-name>
               <servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
               <load-on-startup>1</load-on-startup>
               </servlet>
              
               <!-- Added as trail from http://support.icesoft.com/jive/servlet/KbServlet/download/623-102-847/SeamKBArticle.txt
               <context-param>
               <param-name>com.icesoft.faces.doJSFStateManagement</param-name>
               <param-value>true</param-value>
               </context-param>
               -->
              
               <!-- Faces Servlet Mapping -->
              <!--
               <servlet-mapping>
               <servlet-name>Faces Servlet</servlet-name>
               <url-pattern>*.seam</url-pattern>
               </servlet-mapping>
              
              -->
              
               <servlet>
               <servlet-name>Blocking Servlet</servlet-name>
               <servlet-class>com.icesoft.faces.webapp.xmlhttp.BlockingServlet</servlet-class>
               <load-on-startup> 1 </load-on-startup>
               </servlet>
              
               <servlet>
               <servlet-name>Persistent Faces Servlet</servlet-name>
               <servlet-class>com.icesoft.faces.webapp.xmlhttp.PersistentFacesServlet</servlet-class>
               <load-on-startup>1</load-on-startup>
               </servlet>
              
               <servlet-mapping>
               <servlet-name>Persistent Faces Servlet</servlet-name>
               <url-pattern>/xmlhttp/*</url-pattern>
               </servlet-mapping>
              
               <servlet-mapping>
               <servlet-name>Persistent Faces Servlet</servlet-name>
               <url-pattern>/xmlhttp/*</url-pattern>
               </servlet-mapping>
              
               <servlet-mapping>
               <servlet-name>Persistent Faces Servlet</servlet-name>
               <url-pattern>*.iface</url-pattern>
               </servlet-mapping>
              
               <!-- Blocking Servlet Mapping -->
               <servlet-mapping>
               <servlet-name>Blocking Servlet</servlet-name>
               <url-pattern>/block/*</url-pattern>
               </servlet-mapping>
              
               <!-- Faces Servlet Mapping -->
               <servlet-mapping>
               <servlet-name>Persistent Faces Servlet</servlet-name>
               <url-pattern>*.seam</url-pattern>
               </servlet-mapping>
              
               <!-- Content Servlet -->
              
               <servlet>
               <servlet-name>Content Servlet</servlet-name>
               <servlet-class>nz.co.risingstars.content.ContentServlet</servlet-class>
               </servlet>
              
               <servlet-mapping>
               <servlet-name>Content Servlet</servlet-name>
               <url-pattern>/content/*</url-pattern>
               </servlet-mapping>
              
               <filter>
               <filter-name>Seam Servlet Filter</filter-name>
               <filter-class>org.jboss.seam.servlet.SeamServletFilter</filter-class>
               </filter>
              
               <filter-mapping>
               <filter-name>Seam Servlet Filter</filter-name>
               <url-pattern>/content/*</url-pattern>
               </filter-mapping>
              
               <!-- file upload Servlet -->
               <servlet>
               <servlet-name>uploadServlet</servlet-name>
               <servlet-class>com.icesoft.faces.component.inputfile.FileUploadServlet</servlet-class>
               <load-on-startup> 1 </load-on-startup>
               </servlet>
              
               <servlet-mapping>
               <servlet-name>uploadServlet</servlet-name>
               <url-pattern>/uploadHtml</url-pattern>
               </servlet-mapping>
              
               <!-- MyFaces -->
               <listener>
               <listener-class>org.apache.myfaces.webapp.StartupServletContextListener</listener-class>
               </listener>
              
               <!-- JSF RI -->
               <!--
               <listener>
               <listener-class>com.sun.faces.config.ConfigureListener</listener-class>
               </listener>
               -->
              
               <session-config>
               <session-timeout>15</session-timeout>
               </session-config>
              
              </web-app>
              
              



              pages.xml
              <!DOCTYPE pages PUBLIC
               "-//JBoss/Seam Pages Configuration DTD 1.2//EN"
               "http://jboss.com/products/seam/pages-1.2.dtd">
              
              <pages no-conversation-view-id="/mainmenu.xhtml">
               <page view-id="/userCRUD.xhtml" timeout="300000">
               Reason: #{cRUDUserController.mode} User ( #{user.username} )
               </page>
               <page view-id="/userConfirm.xhtml" timeout="300000">
               Reason: Confirm #{cRUDUserController.mode} User
               (#{user.username} )
               </page>
               <page view-id="/userRegistration.xhtml" timeout="300000">
               Reason: Registration of new User
               </page>
              
               <page view-id="/organisationCRUD.xhtml" timeout="300000">
               Reason: #{cRUDOrganisationController.mode} Organisation (
               #{organisation.name} )
               </page>
               <page view-id="/organisationConfirm.xhtml" timeout="300000">
               Reason: Confirm #{cRUDOrganisationController.mode} Organisation
               (#{organisation.name} )
               </page>
              
               <page view-id="/upload.xhtml" timeout="300000">
               Reason: Upload Image
               </page>
              
               <!-- Security -->
              
               <page view-id="/userRegistration.xhtml">
               <restrict>#{!identity.loggedIn}</restrict>
               </page>
              
               <page view-id="/userFind.xhtml">
               <restrict>#{identity.loggedIn}</restrict>
               </page>
               <page view-id="/userCRUD.xhtml">
               <restrict>#{identity.loggedIn}</restrict>
               </page>
               <page view-id="/userConfirm.xhtml">
               <restrict>#{identity.loggedIn}</restrict>
               </page>
              
               <page view-id="/organisationFind.xhtml">
               <restrict>#{identity.loggedIn}</restrict>
               </page>
               <page view-id="/organisationCRUD.xhtml">
               <restrict>#{identity.loggedIn}</restrict>
               </page>
               <page view-id="/organisationConfirm.xhtml">
               <restrict>#{identity.loggedIn}</restrict>
               </page>
              
               <page view-id="/upload.xhtml">
               <restrict>#{identity.loggedIn}</restrict>
               </page>
              
               <exception class="org.jboss.seam.security.NotLoggedInException">
               <end-conversation />
               <redirect view-id="/securityError.xhtml">
               <message>#{messages.security_not_logged_in}</message>
               </redirect>
               </exception>
              
               <exception class="org.jboss.seam.security.AuthorizationException">
               <end-conversation />
               <redirect view-id="/securityError.xhtml">
               <message>#{messages.security_permission}</message>
               </redirect>
               </exception>
              
              </pages>