Tagged: jboss Toggle Comment Threads | Keyboard Shortcuts

  • hardikmehta 12:15 pm on April 30, 2010 Permalink | Reply
    Tags: , jboss, , , ,   

    Mavenising seam projects [ part 2 ]. 

    This part will continue the discussion started in part 1 [1].

    We now come to the model and action modules which are of type ejb. Particularly in this example (Open18) they are just seam components i.e. pojos  annotated with @Name, but they could also have been ejbs.

    Bellow is the pom.xml for model module. It contains all the entities (JPA)  and some helper classes. It shows jboss-seam as provided dependency which will be provided by the ear module which packages the artifact which will be deployed. This modules takes all the hibernate dependencies from the parent project.

    <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
      <parent>
        <groupId>com.hardik.seaminaction</groupId>
        <artifactId>Open18</artifactId>
        <version>1.0-SNAPSHOT</version>
      </parent>
      <modelVersion>4.0.0</modelVersion>
      <groupId>com.hardik.seaminaction</groupId>
      <artifactId>model</artifactId>
      <packaging>ejb</packaging>
      <version>1.0-SNAPSHOT</version>
      <name>model</name>
      <url>http://maven.apache.org</url>
      <dependencies>
          <dependency>
                <groupId>org.jboss.seam</groupId>
                <artifactId>jboss-seam</artifactId>
                <version>2.2.0.GA</version>
                <type>ejb</type>
                <scope>provided</scope>
            </dependency>
      </dependencies>
      <build>
      	<plugins>
      		<plugin>
      			<groupId>org.apache.maven.plugins</groupId>
      			<artifactId>maven-ejb-plugin</artifactId>
      			<configuration>
      				<ejbVersion>3.0</ejbVersion>
      			</configuration>
      		</plugin>
      	</plugins>
      </build>
    </project>
    

    Here the action module which is also of type ejb. It contains all the action classes which are in turn pojos annotated with @Name. The JSF dependency which we see is for the JSF message classes.

    <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
      <parent>
        <groupId>com.hardik.seaminaction</groupId>
        <artifactId>Open18</artifactId>
        <version>1.0-SNAPSHOT</version>
      </parent>
      <modelVersion>4.0.0</modelVersion>
      <groupId>com.hardik.seaminaction</groupId>
      <artifactId>action</artifactId>
      <packaging>ejb</packaging>
      <version>1.0-SNAPSHOT</version>
      <name>action</name>
      <url>http://maven.apache.org</url>
      <dependencies>
          <dependency>
              <groupId>com.hardik.seaminaction</groupId>
              <artifactId>model</artifactId>
              <version>1.0-SNAPSHOT</version>
          </dependency>
    
          <dependency>
                <groupId>org.jboss.seam</groupId>
                <artifactId>jboss-seam</artifactId>
                <version>2.2.0.GA</version>
                <type>ejb</type>
                <scope>provided</scope>
            </dependency>
          <dependency>
                <groupId>javax.faces</groupId>
                <artifactId>jsf-api</artifactId>
                <version>1.2_02</version>
                <scope>provided</scope>
            </dependency>
    
      </dependencies>
      <build>
      	<plugins>
      		<plugin>
      			<groupId>org.apache.maven.plugins</groupId>
      			<artifactId>maven-ejb-plugin</artifactId>
      			<configuration>
      				<ejbVersion>3.0</ejbVersion>
      			</configuration>
      		</plugin>
      	</plugins>
      </build>
    </project>
    

    Links:

    1. Mavenising seam projects [ part 1 ].
     
  • hardikmehta 3:51 pm on March 7, 2010 Permalink | Reply
    Tags: cdi, , , jboss, jsr 299, jsr299, , , ,   

    Mavenising seam projects [ part 1 ]. 

    Seam [1] is a  very powerful framework for developing java EE web-based applications. It is the only java framework which glues all the tiers of a typical java EE web application together. It is no surprise that many seam features like using EJB 3.0  (for seam any pojo which is a seam component) directly as JSF backing beans, declarative scoping and conversation scope  has been included in the new Contexts and Dependency Injection for Java EE 6 (CDI) also known as JSR 299 [2].  JSR 299 combines best features of seam, Google Guice [3] and Spring [4]. Seam also has tons of other features which make it a very useful framework to learn for any Java developer. Seam by default uses ant. The seam-gen tool creates an ant project and itself is a wrapper to different ant targets.

    Maven on the other hand is emerging as the de-facto building tool for java. As I have already mentioned before, maven gives you a very good overview of your project and you are not lost in minor details. Those details are automatically taken care of. With seam projects, maven is especially useful because you know which dependencies are needed.

    When I started learning seam, by reading the very popular book Seam in Action by Dan Allan [5], I had already switched to maven for all my projects. I decided to mavenise the examples of the book. There are many such projects. The seam documentation also points to the seam-maven-refimpl project [6] which provides a nice template for any seam project. As I wanted to find out how the maven implementation a seam project differs from that of a standard java EE project first hand, I didn’t use the template provided by this project. I just started with a standard java EE project and started adding seam dependencies to it, until I had a working example.

    The implementation  can be found here. Please feel free to point out any mistakes or suggest improvements to th code.

    I have also tried to convert the first examples of the book Seam 2.x Web Development by David Salter [7]. These examples are very simple i.e. without persistence, richfaces etc, although they use state less session beans.

    Here I will discuss the Open18 example from the Seam In Action book in detail.

    Here is the pom file of the main parent project which is no different from an ordinary Java EE project. The only seam specific thing is the jboss repository entry at the end.

    <?xml version="1.0" encoding="UTF-8"?>
    xmlns="http://maven.apache.org/POM/4.0.0"
             xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
             xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
      <modelVersion>4.0.0</modelVersion>
      <groupId>com.hardik.seaminaction</groupId>
      <artifactId>Open18</artifactId>
      <packaging>pom</packaging>
      <version>1.0-SNAPSHOT</version>
      <name>Open18</name>
      <url>http://maven.apache.org</url>
      <modules>
      	<module>action</module>
      	<module>model</module>
        <module>war</module>
        <module>ear</module>
      </modules>
      <build>
      	<plugins>
      		<plugin>
      			<groupId>org.apache.maven.plugins</groupId>
      			<artifactId>maven-compiler-plugin</artifactId>
      			<configuration>
      				<source>1.6</source>
      				<target>1.6</target>
      			</configuration>
      		</plugin>
      	</plugins>
      </build>
      <dependencyManagement>
      	<dependencies>
      		<dependency>
      			<groupId>com.hardik.seaminaction</groupId>
      			<artifactId>ear</artifactId>
      			<version>1.0-SNAPSHOT</version>
      		</dependency>
      		<dependency>
      			<groupId>com.hardik.seaminaction</groupId>
      			<artifactId>war</artifactId>
      			<version>1.0-SNAPSHOT</version>
      		</dependency>
      		<dependency>
      			<groupId>com.hardik.seaminaction</groupId>
      			<artifactId>action</artifactId>
      			<version>1.0-SNAPSHOT</version>
      		</dependency>
            <dependency>
      			<groupId>com.hardik.seaminaction</groupId>
      			<artifactId>model</artifactId>
      			<version>1.0-SNAPSHOT</version>
            </dependency>
      	</dependencies>
      </dependencyManagement>
        <dependencies>
            <!-- hibernate dependencies with provided scope -->
        </dependencies>
    
       <repositories>
      	<repository>
      		<id>jboss</id>
      		JBoss Repository
            <url>http://repository.jboss.org/maven2/</url>
      	</repository>
      </repositories>
    </project>
    

    Links:

    1. Seam
    2. Contexts and Dependency Injection in Java EE 6 (JSR 299)
    3. Google Guice
    4. Spring framework
    5. Seam in action
    6. Seam maven reference implementation
    7. Seam 2.x Web Development

     
  • hardikmehta 2:50 pm on April 4, 2009 Permalink | Reply
    Tags: , , , jboss, Programming   

    Eclipse: Timeout configuration of server (jboss) 

    I configured JBOSS 5 Application Server with  Eclipse 3.4. The configuration was successful. When I tried to start it though, the start up failed with the error  message that it had timed out, the timeout was set to 50 seconds. It is amazing that JBOSS takes more than a minute to start up.

    After some searching, I came to know that in Eclipse 3.4 the server timeouts can be configured per individual servers. Opening the server with double clicking in the server view, will list the timeout option and can be set in seconds. Here the screen-shot.

    eclipse_server_timeout1

     
    • Farkas Gabor 11:21 am on July 15, 2009 Permalink | Reply

      omg, thanx a lot for the screenshot, i spent months searching for this setting. The thing I never thought of was that I have to *doubleclick* the server in the servers view. I was searching for this window everywhere else …
      btw, jboss starting up for more than a minute is not that odd, as compared to WAS or Weblogic. Many times hibernate schema creation or update also adds up to this time.
      In some weird cases I even needed to debug my application startup, which I could not do during jboss startup due to this timeout …
      cheers

      • hardikmehta 12:28 pm on July 15, 2009 Permalink | Reply

        Yes, the page is so obscure, it is hard to think about double click. I wrote this post for future reference. Corrected the post with the double click info.

        Thanks for the explanation about jboss startup.

    • Dragon 12:56 pm on September 3, 2009 Permalink | Reply

      That is increadible !!! Double Click !!! I spent 4 hours only to find this…

      • Arif 1:08 pm on March 4, 2010 Permalink | Reply

        I had to spend a day to find out that u just have to double click the server. This is actually very unintuitive cause these kind of property settings should be available via popup when u right click the server.

        I must say that I have found Netbeans much user friendly and intuitive as compared to Eclipse. Every other organization (like Redhat, IBM etc) are trying to change Eclipse in its own way RedHat has its own version of eclipse called “Jboss Developer Studio” and obviously RedHat wants to sell it (for 99$) thats why Jboss Tools dont work properly in eclipse.

        Eclipse sucks!!! Netbeans Rules!!!

    • Zohaib 11:27 am on November 23, 2012 Permalink | Reply

      Thanx ……..

c
Compose new post
j
Next post/Next comment
k
Previous post/Previous comment
r
Reply
e
Edit
o
Show/Hide comments
t
Go to top
l
Go to login
h
Show/Hide help
shift + esc
Cancel
%d bloggers like this: