pom.xml

<?xml version="1.0" encoding="UTF-8"?>
<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">
	<modelVersion>4.0.0</modelVersion>

	<groupId>com.lucaster.jeewp</groupId>
	<artifactId>javaeeWebProject</artifactId>
	<version>0.0.1-SNAPSHOT</version>
	<packaging>war</packaging>
	<name>Java EE 6 webapp project</name>
	<description>A starter Java EE 6 webapp project for use on JBoss AS 7.1 / EAP 6, generated from the jboss-javaee6-webapp archetype</description>

	<properties>
		<!-- Explicitly declaring the source encoding eliminates the following
			message: -->
		<!-- [WARNING] Using platform encoding (UTF-8 actually) to copy filtered
			resources, i.e. build is platform dependent! -->
		<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
		<!-- Define the version of JBoss' Java EE 6 APIs and Tools we want to import. -->
		<jboss.bom.version>1.0.0.M7</jboss.bom.version>
		<!-- Alternatively, comment out the above line, and un-comment the line
			below to use version 1.0.0.M7-redhat-1 which is a release certified to work
			with JBoss EAP 6. It requires you have access to the JBoss EAP 6 maven repository. -->
		<!-- <jboss.bom.version>1.0.0.M7-redhat-1</jboss.bom.version>> -->
		<seam.version>3.1.0.Final</seam.version>
		<freemarker.version>2.3.9</freemarker.version>
		<org.apache.httpcomponents.version>4.2</org.apache.httpcomponents.version>
	</properties>

	<dependencyManagement>
		<dependencies>
			<!-- JBoss distributes a complete set of Java EE 6 APIs including a Bill
				of Materials (BOM). A BOM specifies the versions of a "stack" (or a collection)
				of artifacts. We use this here so that we always get the correct versions
				of artifacts. Here we use the jboss-javaee-6.0-with-tools stack (you can
				read this as the JBoss stack of the Java EE 6 APIs, with some extras tools
				for your project, such as Arquillian for testing) and the jboss-javaee-6.0-with-hibernate
				stack you can read this as the JBoss stack of the Java EE 6 APIs, with extras
				from the Hibernate family of projects) -->
			<dependency>
				<groupId>org.jboss.bom</groupId>
				<artifactId>jboss-javaee-6.0-with-tools</artifactId>
				<version>${jboss.bom.version}</version>
				<type>pom</type>
				<scope>import</scope>
			</dependency>
			<dependency>
				<groupId>org.jboss.bom</groupId>
				<artifactId>jboss-javaee-6.0-with-hibernate</artifactId>
				<version>${jboss.bom.version}</version>
				<type>pom</type>
				<scope>import</scope>
			</dependency>
			<dependency>
				<groupId>org.jboss.seam</groupId>
				<artifactId>seam-bom</artifactId>
				<version>${seam.version}</version>
				<type>pom</type>
				<scope>import</scope>
			</dependency>
		</dependencies>
	</dependencyManagement>

	<repositories>
		<!-- For PrimeFaces -->
		<repository>
			<id>prime-repo</id>
			<name>PrimeFaces Maven Repository</name>
			<url>http://repository.primefaces.org</url>
			<layout>default</layout>
		</repository>
		<!-- For Seam -->
		<repository>
			<id>jboss-public</id>
			<url>http://repository.jboss.org/nexus/content/groups/public-jboss/</url>
			<releases>
				<enabled>true</enabled>
			</releases>
			<snapshots>
				<enabled>false</enabled>
			</snapshots>
		</repository>
	</repositories>

	<dependencies>

		<!-- First declare the APIs we depend on and need for compilation. All
			of them are provided by JBoss AS 7 -->

		<!-- Import the CDI API, we use provided scope as the API is included in
			JBoss AS 7 -->
		<dependency>
			<groupId>javax.enterprise</groupId>
			<artifactId>cdi-api</artifactId>
			<scope>provided</scope>
		</dependency>

		<!-- Import the Common Annotations API (JSR-250), we use provided scope
			as the API is included in JBoss AS 7 -->
		<dependency>
			<groupId>org.jboss.spec.javax.annotation</groupId>
			<artifactId>jboss-annotations-api_1.1_spec</artifactId>
			<scope>provided</scope>
		</dependency>

		<!-- Import the JAX-RS API, we use provided scope as the API is included
			in JBoss AS 7 -->
		<dependency>
			<groupId>org.jboss.spec.javax.ws.rs</groupId>
			<artifactId>jboss-jaxrs-api_1.1_spec</artifactId>
			<scope>provided</scope>
		</dependency>

		<!-- Import the JPA API, we use provided scope as the API is included in
			JBoss AS 7 -->
		<dependency>
			<groupId>org.hibernate.javax.persistence</groupId>
			<artifactId>hibernate-jpa-2.0-api</artifactId>
			<scope>provided</scope>
		</dependency>

		<!-- Import the EJB API, we use provided scope as the API is included in
			JBoss AS 7 -->
		<dependency>
			<groupId>org.jboss.spec.javax.ejb</groupId>
			<artifactId>jboss-ejb-api_3.1_spec</artifactId>
			<scope>provided</scope>
		</dependency>

		<!-- JSR-303 (Bean Validation) Implementation -->
		<!-- Provides portable constraints such as @Email -->
		<!-- Hibernate Validator is shipped in JBoss AS 7 -->
		<dependency>
			<groupId>org.hibernate</groupId>
			<artifactId>hibernate-validator</artifactId>
			<scope>provided</scope>
			<exclusions>
				<exclusion>
					<groupId>org.slf4j</groupId>
					<artifactId>slf4j-api</artifactId>
				</exclusion>
			</exclusions>
		</dependency>

		<!-- Import the JSF API, we use provided scope as the API is included in
			JBoss AS 7 -->
		<dependency>
			<groupId>org.jboss.spec.javax.faces</groupId>
			<artifactId>jboss-jsf-api_2.1_spec</artifactId>
			<scope>provided</scope>
		</dependency>

		<!-- Now we declare any tools needed -->

		<!-- Annotation processor to generate the JPA 2.0 metamodel classes for
			typesafe criteria queries -->
		<dependency>
			<groupId>org.hibernate</groupId>
			<artifactId>hibernate-jpamodelgen</artifactId>
			<scope>provided</scope>
		</dependency>

		<!-- Annotation processor that raising compilation errors whenever constraint
			annotations are incorrectly used. -->
		<dependency>
			<groupId>org.hibernate</groupId>
			<artifactId>hibernate-validator-annotation-processor</artifactId>
			<scope>provided</scope>
		</dependency>

		<!-- Needed for running tests (you may also use TestNG) -->
		<dependency>
			<groupId>junit</groupId>
			<artifactId>junit</artifactId>
			<scope>test</scope>
		</dependency>

		<!-- Optional, but highly recommended -->
		<!-- Arquillian allows you to test enterprise code such as EJBs and Transactional(JTA)
			JPA from JUnit/TestNG -->
		<dependency>
			<groupId>org.jboss.arquillian.junit</groupId>
			<artifactId>arquillian-junit-container</artifactId>
			<scope>test</scope>
		</dependency>

		<dependency>
			<groupId>org.jboss.arquillian.protocol</groupId>
			<artifactId>arquillian-protocol-servlet</artifactId>
			<scope>test</scope>
		</dependency>

		<!-- PrimeFaces and PrimeFaces Mobile. PrimeFaces version is still 9.2
			for compatibility with Mobile 0.9.2 0.9.3 will be compatible with 3.3 -->
		<dependency>
			<groupId>org.primefaces</groupId>
			<artifactId>primefaces</artifactId>
			<version>3.2</version>
		</dependency>
		<dependency>
			<groupId>org.primefaces</groupId>
			<artifactId>primefaces-mobile</artifactId>
			<version>0.9.2</version>
		</dependency>

		<!-- Seam Solder module now includes also Seam Catch module, Seam Config module, Seam
			Solder Logging module and Seam Servlet module -->

		<dependency>
			<groupId>org.jboss.solder</groupId>
			<artifactId>solder-api</artifactId>
			<scope>runtime</scope>
		</dependency>
		<dependency>
			<groupId>org.jboss.solder</groupId>
			<artifactId>solder-impl</artifactId>
			<scope>runtime</scope>
		</dependency>

		<!-- Seam Persistence module -->

		<dependency>
			<groupId>org.jboss.seam.persistence</groupId>
			<artifactId>seam-persistence-api</artifactId>
		</dependency>
		<dependency>
			<groupId>org.jboss.seam.persistence</groupId>
			<artifactId>seam-persistence</artifactId>
			<scope>runtime</scope>
		</dependency>

		<!-- Seam Faces module and its dependencies -->

		<dependency>
			<groupId>org.jboss.seam.faces</groupId>
			<artifactId>seam-faces-api</artifactId>
		</dependency>
		<dependency>
			<groupId>org.jboss.seam.faces</groupId>
			<artifactId>seam-faces</artifactId>
			<scope>runtime</scope>
		</dependency>
		<dependency>
			<groupId>org.jboss.seam.international</groupId>
			<artifactId>seam-international-api</artifactId>
		</dependency>
		<dependency>
			<groupId>org.jboss.seam.international</groupId>
			<artifactId>seam-international</artifactId>
			<scope>runtime</scope>
		</dependency>
		<dependency>
			<groupId>joda-time</groupId>
			<artifactId>joda-time</artifactId>
		</dependency>
		<dependency>
			<groupId>com.ocpsoft</groupId>
			<artifactId>prettyfaces-jsf2</artifactId>
		</dependency>
		<dependency>
			<groupId>org.jboss.seam.persistence</groupId>
			<artifactId>seam-persistence-api</artifactId>
		</dependency>
		<dependency>
			<groupId>org.jboss.seam.persistence</groupId>
			<artifactId>seam-persistence</artifactId>
			<scope>runtime</scope>
		</dependency>
		<dependency>
			<groupId>org.jboss.seam.security</groupId>
			<artifactId>seam-security-api</artifactId>
		</dependency>
		<dependency>
			<groupId>org.jboss.seam.security</groupId>
			<artifactId>seam-security</artifactId>
			<scope>runtime</scope>
		</dependency>
		<dependency>
			<groupId>org.drools</groupId>
			<artifactId>drools-api</artifactId>
		</dependency>
		<dependency>
			<groupId>org.drools</groupId>
			<artifactId>drools-core</artifactId>
		</dependency>
		<dependency>
			<groupId>org.drools</groupId>
			<artifactId>drools-compiler</artifactId>
		</dependency>

		<!-- Seam Security module and its dependencies -->

		<dependency>
			<groupId>org.jboss.seam.security</groupId>
			<artifactId>seam-security-api</artifactId>
		</dependency>
		<dependency>
			<groupId>org.jboss.seam.security</groupId>
			<artifactId>seam-security</artifactId>
			<scope>runtime</scope>
		</dependency>
		<dependency>
			<groupId>org.jboss.seam.international</groupId>
			<artifactId>seam-international-api</artifactId>
		</dependency>
		<dependency>
			<groupId>org.jboss.seam.international</groupId>
			<artifactId>seam-international</artifactId>
			<scope>runtime</scope>
		</dependency>
		<dependency>
			<groupId>joda-time</groupId>
			<artifactId>joda-time</artifactId>
		</dependency>
		<dependency>
			<groupId>org.drools</groupId>
			<artifactId>drools-api</artifactId>
		</dependency>
		<dependency>
			<groupId>org.drools</groupId>
			<artifactId>drools-core</artifactId>
		</dependency>
		<dependency>
			<groupId>org.drools</groupId>
			<artifactId>drools-compiler</artifactId>
		</dependency>

		<!-- Seam Validation module -->

		<dependency>
			<groupId>org.jboss.seam.validation</groupId>
			<artifactId>seam-validation-api</artifactId>
		</dependency>
		<dependency>
			<groupId>org.jboss.seam.validation</groupId>
			<artifactId>seam-validation</artifactId>
			<scope>runtime</scope>
		</dependency>

		<!-- Seam Mail module and its dependencies -->

		<dependency>
			<groupId>org.jboss.seam.mail</groupId>
			<artifactId>seam-mail-api</artifactId>
		</dependency>
		<dependency>
			<groupId>org.jboss.seam.mail</groupId>
			<artifactId>seam-mail</artifactId>
			<scope>runtime</scope>
		</dependency>
		<dependency>
			<groupId>org.apache.velocity</groupId>
			<artifactId>velocity</artifactId>
		</dependency>
		<dependency>
			<groupId>freemarker</groupId>
			<artifactId>freemarker</artifactId>
			<version>${freemarker.version}</version>
		</dependency>

		<!-- Seam Remoting module and its dependentices (seam-remoting-api doesn't exist -->

		<dependency>
			<groupId>org.jboss.seam.remoting</groupId>
			<artifactId>seam-remoting</artifactId>
			<scope>runtime</scope>
		</dependency>
		<dependency>
			<groupId>org.jboss.seam.international</groupId>
			<artifactId>seam-international-api</artifactId>
		</dependency>
		<dependency>
			<groupId>org.jboss.seam.international</groupId>
			<artifactId>seam-international</artifactId>
			<scope>runtime</scope>
		</dependency>
		<dependency>
			<groupId>joda-time</groupId>
			<artifactId>joda-time</artifactId>
		</dependency>

		<!-- Seam Social module -->

		<dependency>
			<groupId>org.jboss.seam.social</groupId>
			<artifactId>seam-social-api</artifactId>
		</dependency>
		<dependency>
			<groupId>org.jboss.seam.social</groupId>
			<artifactId>seam-social</artifactId>
			<scope>runtime</scope>
		</dependency>
		<dependency>
			<groupId>org.jboss.seam.social</groupId>
			<artifactId>seam-social-facebook</artifactId>
			<version>${seam.version}</version>
		</dependency>
		<dependency>
			<groupId>org.jboss.seam.social</groupId>
			<artifactId>seam-social-linkedin</artifactId>
			<version>${seam.version}</version>
		</dependency>
		<dependency>
			<groupId>org.jboss.seam.social</groupId>
			<artifactId>seam-social-twitter</artifactId>
			<version>${seam.version}</version>
		</dependency>

		<!-- Seam JMS module (requires standalone-full.xml)-->

		<dependency>
			<groupId>org.jboss.seam.jms</groupId>
			<artifactId>seam-jms-api</artifactId>
		</dependency>
		<dependency>
			<groupId>org.jboss.seam.jms</groupId>
			<artifactId>seam-jms</artifactId>
			<scope>runtime</scope>
		</dependency>

		<!-- Seam JCR module -->

		<dependency>
			<groupId>org.jboss.seam.jcr</groupId>
			<artifactId>seam-jcr-api</artifactId>
		</dependency>
		<dependency>
			<groupId>org.jboss.seam.jcr</groupId>
			<artifactId>seam-jcr</artifactId>
			<scope>runtime</scope>
		</dependency>

		<!-- Seam Reports module -->

		<dependency>
			<groupId>org.jboss.seam.reports</groupId>
			<artifactId>seam-reports-api</artifactId>
		</dependency>
		<dependency>
			<groupId>org.jboss.seam.reports</groupId>
			<artifactId>seam-reports-jasper</artifactId>
			<scope>runtime</scope>
		</dependency>
		<dependency>
			<groupId>org.jboss.seam.reports</groupId>
			<artifactId>seam-reports-pentaho</artifactId>
			<scope>runtime</scope>
		</dependency>
		<dependency>
			<groupId>org.jboss.seam.reports</groupId>
			<artifactId>seam-reports-xdocreport</artifactId>
			<scope>runtime</scope>
		</dependency>

		<!-- Seam REST module -->
		<!-- To solve "Multiple TemplatingProviders found on classpath. Select the prefered one." add this to seam-beans.xml: -->
		<!--
		<beans xmlns:rest="urn:java:org.jboss.seam.rest:org.jboss.seam.rest.exceptions">
			<rest:SeamRestConfiguration preferedTemplatingProvider="org.jboss.seam.rest.templating.freemarker.FreeMarkerProvider"/>
		</beans>
		-->

		<dependency>
			<groupId>org.jboss.seam.rest</groupId>
			<artifactId>seam-rest-api</artifactId>
		</dependency>
		<dependency>
			<groupId>org.jboss.seam.rest</groupId>
			<artifactId>seam-rest</artifactId>
			<scope>runtime</scope>
		</dependency>
		<dependency>
			<groupId>org.apache.velocity</groupId>
			<artifactId>velocity</artifactId>
		</dependency>
		<dependency>
			<groupId>freemarker</groupId>
			<artifactId>freemarker</artifactId>
			<version>${freemarker.version}</version>
		</dependency>
		<dependency>
			<groupId>org.apache.httpcomponents</groupId>
			<artifactId>httpcore</artifactId>
			<version>${org.apache.httpcomponents.version}</version>
		</dependency>
		<dependency>
			<groupId>org.apache.httpcomponents</groupId>
			<artifactId>httpclient</artifactId>
			<version>${org.apache.httpcomponents.version}</version>
		</dependency>

	</dependencies>

	<build>
		<!-- Maven will append the version to the finalName (which is the name
			given to the generated war, and hence the context root) -->
		<finalName>${project.artifactId}</finalName>
		<plugins>
			<!-- Compiler plugin enforces Java 1.6 compatibility and activates annotation
				processors -->
			<plugin>
				<artifactId>maven-compiler-plugin</artifactId>
				<version>2.3.1</version>
				<configuration>
					<source>1.6</source>
					<target>1.6</target>
				</configuration>
			</plugin>
			<plugin>
				<artifactId>maven-war-plugin</artifactId>
				<version>2.1.1</version>
				<configuration>
					<!-- Java EE 6 doesn't require web.xml, Maven needs to catch up! -->
					<failOnMissingWebXml>false</failOnMissingWebXml>
				</configuration>
			</plugin>
			<!-- The JBoss AS plugin deploys your war to a local JBoss AS container -->
			<!-- To use, run: mvn package jboss-as:deploy -->
			<plugin>
				<groupId>org.jboss.as.plugins</groupId>
				<artifactId>jboss-as-maven-plugin</artifactId>
				<version>7.1.1.Final</version>
			</plugin>
		</plugins>
	</build>

	<profiles>
		<profile>
			<!-- The default profile skips all tests, though you can tune it to run
				just unit tests based on a custom pattern -->
			<!-- Seperate profiles are provided for running all tests, including Arquillian
				tests that execute in the specified container -->
			<id>default</id>
			<activation>
				<activeByDefault>true</activeByDefault>
			</activation>
			<build>
				<plugins>
					<plugin>
						<artifactId>maven-surefire-plugin</artifactId>
						<version>2.4.3</version>
						<configuration>
							<skip>true</skip>
						</configuration>
					</plugin>
				</plugins>
			</build>
		</profile>

		<profile>
			<!-- An optional Arquillian testing profile that executes tests in your
				JBoss AS instance -->
			<!-- This profile will start a new JBoss AS instance, and execute the
				test, shutting it down when done -->
			<!-- Run with: mvn clean test -Parq-jbossas-managed -->
			<id>arq-jbossas-managed</id>
			<dependencies>
				<dependency>
					<groupId>org.jboss.as</groupId>
					<artifactId>jboss-as-arquillian-container-managed</artifactId>
					<scope>test</scope>
				</dependency>
			</dependencies>
		</profile>

		<profile>
			<!-- An optional Arquillian testing profile that executes tests in a remote
				JBoss AS instance -->
			<!-- Run with: mvn clean test -Parq-jbossas-remote -->
			<id>arq-jbossas-remote</id>
			<dependencies>
				<dependency>
					<groupId>org.jboss.as</groupId>
					<artifactId>jboss-as-arquillian-container-remote</artifactId>
					<scope>test</scope>
				</dependency>
			</dependencies>
		</profile>

		<profile>
			<!-- When built in OpenShift the 'openshift' profile will be used when
				invoking mvn. -->
			<!-- Use this profile for any OpenShift specific customization your app
				will need. -->
			<!-- By default that is to put the resulting archive into the 'deployments'
				folder. -->
			<!-- http://maven.apache.org/guides/mini/guide-building-for-different-environments.html -->
			<id>openshift</id>
			<build>
				<plugins>
					<plugin>
						<artifactId>maven-war-plugin</artifactId>
						<version>2.1.1</version>
						<configuration>
							<outputDirectory>deployments</outputDirectory>
							<warName>ROOT</warName>
						</configuration>
					</plugin>
				</plugins>
			</build>
		</profile>

	</profiles>
</project>

seam-beans.xml

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
	xmlns:s="urn:java:ee"
	xsi:schemaLocation="

http://java.sun.com/xml/ns/javaee

http://docs.jboss.org/cdi/beans_1_0.xsd"

	xmlns:rest="urn:java:org.jboss.seam.rest:org.jboss.seam.rest.exceptions"
	xmlns:mail="urn:java:org.jboss.seam.mail.core">

	<!-- Requires Seam REST module dependencies to work -->
	<rest:SeamRestConfiguration preferedTemplatingProvider="org.jboss.seam.rest.templating.freemarker.FreeMarkerProvider"/>

	<!-- Requires Seam Mail module dependencies to work -->
	<mail:MailConfig serverHost="my-server.test.com"
		serverPort="25" username="abcdef" password="123456" >
		<s:modifies />
	</mail:MailConfig>

</beans>

If you have both Seam Mail and one or more among Seam Persistence, Seam Security, Seam Faces, building you project will give these errors:

Error
Sun Jun 03 15:06:14 CEST 2012
Errors running builder 'CDI (Context and Dependency Injection) Builder' on project 'javaeeWebProject'.

java.lang.NullPointerException
	at org.jboss.tools.cdi.seam.core.persistence.CDISeamPersistenceExtension.buildBeans(CDISeamPersistenceExtension.java:109)
	at org.jboss.tools.cdi.internal.core.impl.CDIProject.update(CDIProject.java:1121)
	at org.jboss.tools.cdi.internal.core.impl.definition.DefinitionContext.applyWorkingCopy(DefinitionContext.java:390)
	at org.jboss.tools.cdi.core.CDICoreBuilder.build(CDICoreBuilder.java:230)
	at org.eclipse.core.internal.events.BuildManager$2.run(BuildManager.java:728)
	at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42)
	at org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:199)
	at org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:239)
	at org.eclipse.core.internal.events.BuildManager$1.run(BuildManager.java:292)
	at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42)
	at org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:295)
	at org.eclipse.core.internal.events.BuildManager.basicBuildLoop(BuildManager.java:351)
	at org.eclipse.core.internal.events.BuildManager.build(BuildManager.java:374)
	at org.eclipse.core.internal.events.AutoBuildJob.doBuild(AutoBuildJob.java:143)
	at org.eclipse.core.internal.events.AutoBuildJob.run(AutoBuildJob.java:241)
	at org.eclipse.core.internal.jobs.Worker.run(Worker.java:54)
eclipse.buildId=unknown
java.version=1.6.0_31
java.vendor=Sun Microsystems Inc.
BootLoader constants: OS=win32, ARCH=x86, WS=win32, NL=en_GB
Framework arguments:  -product com.jboss.jbds.product.product
Command-line arguments:  -os win32 -ws win32 -arch x86 -product com.jboss.jbds.product.product

Error
Sun Jun 03 15:06:14 CEST 2012
Problems occurred when invoking code from plug-in: "org.eclipse.core.resources".

java.lang.NullPointerException
	at org.jboss.tools.cdi.seam.core.persistence.CDISeamPersistenceExtension.buildBeans(CDISeamPersistenceExtension.java:109)
	at org.jboss.tools.cdi.internal.core.impl.CDIProject.update(CDIProject.java:1121)
	at org.jboss.tools.cdi.internal.core.impl.definition.DefinitionContext.applyWorkingCopy(DefinitionContext.java:390)
	at org.jboss.tools.cdi.core.CDICoreBuilder.build(CDICoreBuilder.java:230)
	at org.eclipse.core.internal.events.BuildManager$2.run(BuildManager.java:728)
	at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42)
	at org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:199)
	at org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:239)
	at org.eclipse.core.internal.events.BuildManager$1.run(BuildManager.java:292)
	at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42)
	at org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:295)
	at org.eclipse.core.internal.events.BuildManager.basicBuildLoop(BuildManager.java:351)
	at org.eclipse.core.internal.events.BuildManager.build(BuildManager.java:374)
	at org.eclipse.core.internal.events.AutoBuildJob.doBuild(AutoBuildJob.java:143)
	at org.eclipse.core.internal.events.AutoBuildJob.run(AutoBuildJob.java:241)
	at org.eclipse.core.internal.jobs.Worker.run(Worker.java:54)

Despite those, the build process will complete successfully and you’ll be able to deploy the app on JBoss AS 7.1.1.Final

 

You installed Tomcat v7 within eclipse using the “Add server” wizard and the  “download and install” button.

You tried to start Tomcat and got the following error:

“Could not load the Tomcat server configuration at /Servers/Tomcat v7.0 Server at localhost-config. The configuration may be corrupt or incomplete”

How to solve:

  1. Close Eclipse
  2. Copy all files from TOMCAT_7_HOME/conf to WORKSPACE_FOLDER/Servers/Tomcat v7.0 Server at localhost-config
  3. Start Eclipse
  4. Expand the Servers project, click on the Tomcat 7 project and hit F5
  5. Start Tomcat from Eclipse
 

HTML5

On March 31, 2012, in HTML5, by lucasterdev

How to know if a web site was made with HTML5?

If its background seems monochrome, but after looking more closely, it’s actually melange, like velvet or carpet: you’ll know that web site was made with HTML5.

Like this:

 

Install JavaFX in Ubuntu

On March 25, 2012, in Java FX, Ubuntu, by lucasterdev

http://docs.oracle.com/javafx/2.0/release_notes_linux/jfxpub-release_notes_linux.htm

http://www.oracle.com/technetwork/java/javafx/downloads/devpreview-1429449.html

http://www.webupd8.org/2011/09/how-to-install-oracle-java-7-jdk-in.html

 

sudo add-apt-repository ppa:webupd8team/java

sudo apt-get update

sudo apt-get install oracle-jdk7-installer

 

JSF extensions and JQuery versions

On February 11, 2012, in JSF, PrimeFaces, RichFaces, by lucasterdev

PrimeFaces 3.1 uses JQuery 1.7.1

PrimeFaces 3.0.1 uses JQuery 1.7.1

RichFaces 4.2.0.CR1 uses JQuery 1.7.1

RichFaces 4.1.0.Final uses JQuery 1.6.4

 

 

Resin

On February 11, 2012, in Eclipse, Resin, by lucasterdev

After installing Resin and the Resin Plugin for Eclipse, here’s what I get when I start the server:

/home/luca/Software/eclipse_indigo_32bit/workspace/Servers/Resin 4.0 at localhost-config/resin.xml:38: com.caucho.config.core.ResinImport.init(): Required file '/home/luca/Software/eclipse_indigo_32bit/workspace/Servers/Resin 4.0 at localhost-config/cluster-default.xml' can not be read for resin:import.
 at com.caucho.config.xml.XmlConfigContext.error(XmlConfigContext.java:1239)
 at com.caucho.config.xml.XmlConfigContext.configureChildNode(XmlConfigContext.java:471)
 at com.caucho.config.xml.XmlConfigContext.configureNode(XmlConfigContext.java:371)
 at com.caucho.config.xml.XmlConfigContext.configureBean(XmlConfigContext.java:285)
 at com.caucho.config.xml.XmlConfigContext.configure(XmlConfigContext.java:243)
 at com.caucho.config.Config.configure(Config.java:326)
 at com.caucho.config.Config.configure(Config.java:256)
 at com.caucho.server.resin.BootConfig.configureFile(BootConfig.java:131)
 at com.caucho.server.resin.Resin.configureFile(Resin.java:849)
 at com.caucho.server.resin.Resin.<init>(Resin.java:214)
 at com.caucho.server.resin.Resin.<init>(Resin.java:172)
 at com.caucho.server.resin.Resin.main(Resin.java:1232)
Caused by: com.caucho.config.ConfigException: com.caucho.config.core.ResinImport.init(): Required file '/home/luca/Software/eclipse_indigo_32bit/workspace/Servers/Resin 4.0 at localhost-config/cluster-default.xml' can not be read for resin:import.
 at com.caucho.config.ConfigException.create(ConfigException.java:99)
 at com.caucho.config.ConfigException.create(ConfigException.java:130)
 at com.caucho.config.j2ee.PostConstructProgram.inject(PostConstructProgram.java:142)
 at com.caucho.config.type.InlineBeanType.init(InlineBeanType.java:457)
 at com.caucho.config.xml.XmlConfigContext.configureChildBean(XmlConfigContext.java:704)
 at com.caucho.config.xml.XmlConfigContext.configureBeanProperties(XmlConfigContext.java:685)
 at com.caucho.config.xml.XmlConfigContext.configureChildNode(XmlConfigContext.java:464)
 ... 10 more
Caused by: com.caucho.config.ConfigException: Required file '/home/luca/Software/eclipse_indigo_32bit/workspace/Servers/Resin 4.0 at localhost-config/cluster-default.xml' can not be read for resin:import.
 at com.caucho.config.core.ResinImport.init(ResinImport.java:115)
 at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
 at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
 at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
 at java.lang.reflect.Method.invoke(Method.java:616)
 at com.caucho.config.j2ee.PostConstructProgram.inject(PostConstructProgram.java:140)
 ... 14 more
/home/luca/Software/eclipse_indigo_32bit/workspace/Servers/Resin 4.0 at localhost-config/resin.xml:38: com.caucho.config.core.ResinImport.init(): Required file '/home/luca/Software/eclipse_indigo_32bit/workspace/Servers/Resin 4.0 at localhost-config/cluster-default.xml' can not be read for resin:import.

Copy cluster-default.xml from RESIN_HOME/conf to ECLIPSE_HOME/Workspace/Servers/Resin 4.0 at localhost-config.

Now Resin starts bu I get this:


[12-02-11 15:34:17.373] {http://*:8080-15} Unable to find native library 'resin_os' for com.caucho.loader.ClassEntry. Resin expects to find this library in:
 (Unix) /home/luca/Software/resin-4.0.25/libexec/libresin_os.so
 On Unix, run ./configure --prefix=`pwd`; make; make install.

 The JVM exception was: java.lang.UnsatisfiedLinkError: no resin_os in java.library.path

The server starts though…

 

[Solved] Using TestNG offline fails

On February 5, 2012, in Testing, TestNG, by lucasterdev

When your run TestNG tests and you have no Internet connection, you may get the following exception:

TestNG] Running:
  /tmp/testng-eclipse--29095373/testng-customsuite.xml

ERROR [org.jboss.kernel.plugins.dependency.AbstractKernelController] Error installing to Parse: name=vfsfile:/home/luca/Software/eclipse_indigo_32bit/workspace/seam423ear-test/bin/ state=Not Installed mode=Manual requiredState=Parse
org.jboss.deployers.spi.DeploymentException: Error creating managed object for vfsfile:/home/luca/Software/eclipse_indigo_32bit/workspace/seam423ear-test/bin/
	at org.jboss.deployers.spi.DeploymentException.rethrowAsDeploymentException(DeploymentException.java:49)
	at org.jboss.deployers.spi.deployer.helpers.AbstractParsingDeployerWithOutput.createMetaData(AbstractParsingDeployerWithOutput.java:232)
	at org.jboss.deployers.spi.deployer.helpers.AbstractParsingDeployerWithOutput.createMetaData(AbstractParsingDeployerWithOutput.java:199)
	at org.jboss.deployers.spi.deployer.helpers.AbstractParsingDeployerWithOutput.deploy(AbstractParsingDeployerWithOutput.java:162)
	at org.jboss.deployers.plugins.deployers.DeployerWrapper.deploy(DeployerWrapper.java:169)
	at org.jboss.deployers.plugins.deployers.DeployersImpl.doInstallParentFirst(DeployersImpl.java:853)
	at org.jboss.deployers.plugins.deployers.DeployersImpl.install(DeployersImpl.java:794)
	at org.jboss.dependency.plugins.AbstractControllerContext.install(AbstractControllerContext.java:327)
	at org.jboss.dependency.plugins.AbstractController.install(AbstractController.java:1309)
	at org.jboss.dependency.plugins.AbstractController.incrementState(AbstractController.java:734)
	at org.jboss.dependency.plugins.AbstractController.resolveContexts(AbstractController.java:862)
	at org.jboss.dependency.plugins.AbstractController.resolveContexts(AbstractController.java:784)
	at org.jboss.dependency.plugins.AbstractController.change(AbstractController.java:622)
	at org.jboss.dependency.plugins.AbstractController.change(AbstractController.java:411)
	at org.jboss.deployers.plugins.deployers.DeployersImpl.process(DeployersImpl.java:498)
	at org.jboss.deployers.plugins.main.MainDeployerImpl.process(MainDeployerImpl.java:506)
	at org.jboss.embedded.DeploymentGroup.process(DeploymentGroup.java:127)
	at org.jboss.embedded.Bootstrap.deployResourceBases(Bootstrap.java:289)
	at org.jboss.seam.mock.EmbeddedBootstrap.startAndDeployResources(EmbeddedBootstrap.java:15)
	at org.jboss.seam.mock.AbstractSeamTest.startJbossEmbeddedIfNecessary(AbstractSeamTest.java:1034)
	at org.jboss.seam.mock.AbstractSeamTest.startSeam(AbstractSeamTest.java:925)
	at org.jboss.seam.mock.SeamTest.startSeam(SeamTest.java:69)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:616)
	at org.testng.internal.MethodInvocationHelper.invokeMethod(MethodInvocationHelper.java:80)
	at org.testng.internal.Invoker.invokeConfigurationMethod(Invoker.java:543)
	at org.testng.internal.Invoker.invokeConfigurations(Invoker.java:212)
	at org.testng.internal.Invoker.invokeConfigurations(Invoker.java:138)
	at org.testng.SuiteRunner.privateRun(SuiteRunner.java:277)
	at org.testng.SuiteRunner.run(SuiteRunner.java:240)
	at org.testng.SuiteRunnerWorker.runSuite(SuiteRunnerWorker.java:53)
	at org.testng.SuiteRunnerWorker.run(SuiteRunnerWorker.java:87)
	at org.testng.TestNG.runSuitesSequentially(TestNG.java:1142)
	at org.testng.TestNG.runSuitesLocally(TestNG.java:1067)
	at org.testng.TestNG.run(TestNG.java:979)
	at org.testng.remote.RemoteTestNG.run(RemoteTestNG.java:109)
	at org.testng.remote.RemoteTestNG.initAndRun(RemoteTestNG.java:202)
	at org.testng.remote.RemoteTestNG.main(RemoteTestNG.java:173)
Caused by: javax.xml.bind.UnmarshalException
 - with linked exception:
1
	at com.sun.xml.bind.v2.runtime.unmarshaller.UnmarshallerImpl.unmarshal0(UnmarshallerImpl.java:213)
	at com.sun.xml.bind.v2.runtime.unmarshaller.UnmarshallerImpl.unmarshal(UnmarshallerImpl.java:190)
	at com.sun.xml.bind.v2.runtime.unmarshaller.UnmarshallerImpl.unmarshal(UnmarshallerImpl.java:241)
	at org.jboss.resource.deployers.ManagedConnectionFactoryParserDeployer.parse(ManagedConnectionFactoryParserDeployer.java:121)
	at org.jboss.resource.deployers.ManagedConnectionFactoryParserDeployer.parse(ManagedConnectionFactoryParserDeployer.java:59)
	at org.jboss.deployers.vfs.spi.deployer.AbstractVFSParsingDeployer.parse(AbstractVFSParsingDeployer.java:112)
	at org.jboss.deployers.spi.deployer.helpers.AbstractParsingDeployerWithOutput.createMetaData(AbstractParsingDeployerWithOutput.java:225)
	... 38 more
Caused by: java.net.UnknownHostException: www.jboss.org
	at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:175)
	at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:384)
	at java.net.Socket.connect(Socket.java:546)
	at java.net.Socket.connect(Socket.java:495)
	at sun.net.NetworkClient.doConnect(NetworkClient.java:178)
	at sun.net.www.http.HttpClient.openServer(HttpClient.java:409)
	at sun.net.www.http.HttpClient.openServer(HttpClient.java:530)
	at sun.net.www.http.HttpClient.<init>(HttpClient.java:240)
	at sun.net.www.http.HttpClient.New(HttpClient.java:321)
	at sun.net.www.http.HttpClient.New(HttpClient.java:338)
	at sun.net.www.protocol.http.HttpURLConnection.getNewHttpClient(HttpURLConnection.java:935)
	at sun.net.www.protocol.http.HttpURLConnection.plainConnect(HttpURLConnection.java:876)
	at sun.net.www.protocol.http.HttpURLConnection.connect(HttpURLConnection.java:801)
	at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1139)
	at org.apache.xerces.impl.XMLEntityManager.setupCurrentEntity(Unknown Source)
	at org.apache.xerces.impl.XMLEntityManager.startEntity(Unknown Source)
	at org.apache.xerces.impl.XMLEntityManager.startDTDEntity(Unknown Source)
	at org.apache.xerces.impl.XMLDTDScannerImpl.setInputSource(Unknown Source)
	at org.apache.xerces.impl.XMLDocumentScannerImpl$DTDDispatcher.dispatch(Unknown Source)
	at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown Source)
	at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
	at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
	at org.apache.xerces.parsers.XMLParser.parse(Unknown Source)
	at org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown Source)
	at org.apache.xerces.jaxp.SAXParserImpl$JAXPSAXParser.parse(Unknown Source)
	at com.sun.xml.bind.v2.runtime.unmarshaller.UnmarshallerImpl.unmarshal0(UnmarshallerImpl.java:211)
	... 44 more
FAILED CONFIGURATION: @BeforeSuite startSeam
org.jboss.deployers.client.spi.IncompleteDeploymentException: Summary of incomplete deployments (SEE PREVIOUS ERRORS FOR DETAILS):

*** CONTEXTS MISSING DEPENDENCIES: Name -> Dependency{Required State:Actual State}

persistence.units:unitName=seam423ear
 -> <UNKNOWN>{Described:** UNRESOLVED Demands 'jboss.jca:name=seam423earDatasource,service=DataSourceBinding **}

*** CONTEXTS IN ERROR: Name -> Error

vfsfile:/home/luca/Software/eclipse_indigo_32bit/workspace/seam423ear-test/bin/ -> java.net.UnknownHostException: www.jboss.org

<UNKNOWN> -> ** UNRESOLVED Demands 'jboss.jca:name=seam423earDatasource,service=DataSourceBinding **

	at org.jboss.deployers.plugins.deployers.DeployersImpl.checkComplete(DeployersImpl.java:576)
	at org.jboss.deployers.plugins.main.MainDeployerImpl.checkComplete(MainDeployerImpl.java:559)
	at org.jboss.embedded.DeploymentGroup.process(DeploymentGroup.java:128)
	at org.jboss.embedded.Bootstrap.deployResourceBases(Bootstrap.java:289)
	at org.jboss.seam.mock.EmbeddedBootstrap.startAndDeployResources(EmbeddedBootstrap.java:15)
	at org.jboss.seam.mock.AbstractSeamTest.startJbossEmbeddedIfNecessary(AbstractSeamTest.java:1034)
	at org.jboss.seam.mock.AbstractSeamTest.startSeam(AbstractSeamTest.java:925)
	at org.jboss.seam.mock.SeamTest.startSeam(SeamTest.java:69)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:616)
	at org.testng.internal.MethodInvocationHelper.invokeMethod(MethodInvocationHelper.java:80)
	at org.testng.internal.Invoker.invokeConfigurationMethod(Invoker.java:543)
	at org.testng.internal.Invoker.invokeConfigurations(Invoker.java:212)
	at org.testng.internal.Invoker.invokeConfigurations(Invoker.java:138)
	at org.testng.SuiteRunner.privateRun(SuiteRunner.java:277)
	at org.testng.SuiteRunner.run(SuiteRunner.java:240)
	at org.testng.SuiteRunnerWorker.runSuite(SuiteRunnerWorker.java:53)
	at org.testng.SuiteRunnerWorker.run(SuiteRunnerWorker.java:87)
	at org.testng.TestNG.runSuitesSequentially(TestNG.java:1142)
	at org.testng.TestNG.runSuitesLocally(TestNG.java:1067)
	at org.testng.TestNG.run(TestNG.java:979)
	at org.testng.remote.RemoteTestNG.run(RemoteTestNG.java:109)
	at org.testng.remote.RemoteTestNG.initAndRun(RemoteTestNG.java:202)
	at org.testng.remote.RemoteTestNG.main(RemoteTestNG.java:173)

SKIPPED CONFIGURATION: @BeforeClass setupClass
SKIPPED CONFIGURATION: @BeforeMethod begin
SKIPPED CONFIGURATION: @AfterMethod end
SKIPPED CONFIGURATION: @AfterClass cleanupClass
SKIPPED: someTest

===============================================
    Default test
    Tests run: 1, Failures: 0, Skips: 1
    Configuration Failures: 1, Skips: 4
===============================================

===============================================
Default suite
Total tests run: 1, Failures: 0, Skips: 1
Configuration Failures: 1, Skips: 5
===============================================

[TestNG] Time taken by org.testng.reporters.JUnitReportReporter@13c468a: 4 ms
[TestNG] Time taken by org.testng.reporters.EmailableReporter@1807ca8: 5 ms
[TestNG] Time taken by org.testng.reporters.XMLReporter@12ad19e: 17 ms
[TestNG] Time taken by [TestListenerAdapter] Passed:0 Failed:0 Skipped:0]: 4 ms
[TestNG] Time taken by org.testng.reporters.SuiteHTMLReporter@1bd7848: 8 ms

It happens because TestNG tries to validate the *-ds.xml files against their DTDs.

To solve this issue, you have to remove or comment out the DTD declaration from the *-ds.xml files in your project, including the ones in the /bin folder. You can see the /bin folder Eclipse’s Navigator view.

 

TestNG does not work with JDK 6. TestNG works only with JDK 5. So, if you have JDK 6 installed on your system, you need to apply a little shrewdness.

I will assume that you already have JBoss Tools and the TestNG Eclipse plugin installed. If you need a tutorial on that, let me know and I’ll write one. I will also assume you are deploying in JBoss AS 5.

Here’s how to create a TestNG-ready Seam 2 project in Eclipse that works with JDK6:

  1. Create a new Seam 2 Project in Eclipse with the JBoss Tools wizard.
  2. If you project is gonna have EJBs, make sure you choose “EAR” as deployment at the end of the Wizard (but choose WAR at the Maven page).
  3. If you create a mavenized project, look for the warning “Classpath entry org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER will not be exported or published. Runtime ClassNotFoundExceptions may result.”; rich-click on it, Quick Fix, Finish.
  4. Now you have the Seam 2 project and a Seam 2 test project
  5. In the test project, create a simple test class. For example:
  6. package test;
    
    import org.jboss.seam.mock.SeamTest;
    import org.testng.annotations.Test;
    
    public class Tests extends SeamTest {
    
    	@Test
    	public void myFirstTest() {
    		assert true;
    	}
    }
    
  7. Right-click on the test class and select Run As –> TestNG Test
  8. If you have JDK 6, the test will fail with a daunting stack trace, and it’s ok. It fails because TestNG does not work with JDK 6, but only with JDK 5. But now, eclipse created a run configuration for us that we can fix.
  9. Now right-click again on the test class and select Run As –> Run Configurations
  10. In “Run configurations” window, scroll down and find TesNG –> NameOfYourTestClass
  11. Select the “(x)=Arguments” tab
  12. In the “VM Arguments” field past the following: -Dsun.lang.ClassLoader.allowArraySyntax=true
  13. Click “Apply” then “Close”
  14. Right-click again on your test class and select Run As –> TestNG Test. Now the test will run.
  15. Repeat steps 6 to 12 for every test class you create. Make sure you remember to do so!
  16. Happy testing!
 
 

Activate HTTPS on JBoss AS 7

On January 14, 2012, in HTTPS, JBoss, JBoss AS 7, by lucasterdev

Open a terminal and type the following command:

keytool -genkey -keystore filename.keystore -storepass mypassword -keypass mypassword -keyalg RSA -validity 180 -alias somealias -dname "cn=Name Surname,o=MyCompany,c=US"

(change the command parameters properly ;) )

The command will create a self-signed certificate, stored in the .keystore file.

Copy the .keystore file to JBOSS_AS_7_HOME/standalone/configuration

Open JBOSS_AS_7_HOME/standalone/configuration/standalone.xml

Look for the following element:

<subsystem xmlns="urn:jboss:domain:web:1.0" default-virtual-server="default-host">
    <connector name="http" protocol="HTTP/1.1" socket-binding="http" scheme="http"/>
    <virtual-server name="default-host" enable-welcome-root="true">
        <alias name="localhost"/>
        <alias name="example.com"/>
    </virtual-server>
</subsystem>

Change it to make it look like this:

<subsystem xmlns="urn:jboss:domain:web:1.0" default-virtual-server="default-host">
	<connector name="http" protocol="HTTP/1.1" socket-binding="http" scheme="http"/>
	<connector name="https" protocol="HTTP/1.1" socket-binding="https" scheme="https" secure="true">
		<ssl key-alias="somealias" password="mypassword" certificate-key-file="../standalone/configuration/filename.keystore" cipher-suite="ALL" protocol="TLS"/>
	</connector>
	<virtual-server name="default-host" enable-welcome-root="true">
		<alias name="localhost"/>
		<alias name="example.com"/>
	</virtual-server>
</subsystem>

Restart JBoss AS 7.

Notice the following lines in the console output/log:

17:45:21,689 INFO  [org.apache.coyote.http11.Http11Protocol] (MSC service thread 1-4) Starting Coyote HTTP/1.1 on http--127.0.0.1-8080
17:45:22,138 INFO  [org.apache.coyote.http11.Http11Protocol] (MSC service thread 1-3) Starting Coyote HTTP/1.1 on http--127.0.0.1-8443

HTTPS will be running on port 8443 by default.

To change the HTTPS port, look for the socket-binding-group element in standalone.xml