This tutorial shows you how to configure JBoss 6 and your persistence.xml file in order to use JBoss’ embedded HSQL database in Server Mode. “Server Mode” means that HSQLDB will run as a server and will be able to accept connections, just like MySQL. All that is useful in case you use Eclipse and want to validate your project against the datasource.

1. Open $JBOSS_HOME/server/default/deploy/hsqldb-ds.xml

You have to modify the DefaultDS datasource. Some sections of hsqldb-ds.xml will have to be uncommented, and others will have to be commented. I’ll show you such sections as they should be after the alterations.
I’ll consider you want to use a database of your choice: MYPERSONALDB.

      <!-- For server mode db, allowing other processes to use hsqldb over tcp.
      This requires the org.jboss.jdbc.HypersonicDatabase mbean.
          <value-factory bean="ServiceBindingManager" method="getStringBinding">
      <!-- For in-process persistent db, saved when jboss stops.
      The org.jboss.jdbc.HypersonicDatabase mbean is required for proper db shutdown
      <!-- When using in-process (standalone) mode -->

      <!-- Uncomment when using hsqldb in server mode-->
   <!-- Uncomment if you want hsqldb accessed over tcp (server mode)-->
   <mbean code="org.jboss.jdbc.HypersonicDatabase" name="jboss:service=Hypersonic">
     <attribute name="Port">
        <value-factory bean="ServiceBindingManager" method="getIntBinding" parameter="jboss:service=Hypersonic"/>
     <attribute name="BindAddress">
        <value-factory bean="ServiceBindingManager" method="getStringBinding" parameter="jboss:service=Hypersonic"/>
     <attribute name="Silent">true</attribute>
     <attribute name="Database">MYPERSONALDB</attribute>
     <attribute name="Trace">false</attribute>
     <attribute name="No_system_exit">true</attribute>
   <!-- For hsqldb accessed from jboss only, in-process (standalone) mode -->
   <!--<mbean code="org.jboss.jdbc.HypersonicDatabase" name="jboss:service=Hypersonic,database=localDB">
     <attribute name="Database">localDB</attribute>
     <attribute name="InProcessMode">true</attribute>

2. Open $JBOSS_HOME/server/default/conf/bindingservice.beans/META-INF/bindings-jboss-beans.xml

You have to uncomment a section:

            <!-- ********************* deploy/hsqldb-ds.xml **************** -->

            <!-- Commented out as tcp/ip access to Hypersonic is not enabled by default -->

            <bean class="">
               <property name="serviceName">jboss:service=Hypersonic</property>
               <property name="port">1701</property>
               <property name="description">TCP/IP socket for remote connection to Hypersonic database</property>

3. Edit your persistence.xml properly:

<?xml version="1.0" encoding="UTF-8"?>
<persistence version="2.0"

	<persistence-unit name="MYPU" transaction-type="JTA">



		<!-- Add all your other mapped classes, for example: -->

			<property name="hibernate.archive.autodetecion" value="class, hbm" />
			<property name="hibernate.show_sql" value="true"/>
			<property name="hibernate.format_sql" value="true"/>
			<property name="" value="create-drop"/>
			<property name="hibernate.dialect" value="org.hibernate.dialect.HSQLDialect"/>
			<property name="hibernate.connection.username" value="sa"/>

			<!-- You must have this if you are using JTA and JBoss! -->
			<property name="hibernate.transaction.manager_lookup_class" value="org.hibernate.transaction.JBossTransactionManagerLookup"/>



When adding Spring Security, you may encounter the following error:

spring-security-web classes are not available. You need these to use <filter-chain-map>

Configuration problem: spring-security-web classes are not available. You need these to use <filter-chain-map>
Offending resource: file [/home/luca/workspace-3.6/LESSON/WebContent/WEB-INF/applicationContext-security.xml]

Solution: add the J2EE 1.4 Libraries (JBoss Tools) to the project’s build path.


If you have several @OneToMany associations with EAGER fetching, you’ll get the following exception:

MultipleBagFetchException: cannot simultaneously fetch multiple bags

A workaround consists of the following:



above the association definition.


JSTL tag Library

On February 2, 2011, in JSF, Jsp, by lucasterdev

To use the JSTL tag library, keep in mind this:

To use an EL-based JSTL library, you must declare the library using a taglib directive, similar to declaring a regular custom tag library:

<@ taglib prefix="c" uri="">

Similarly, to use a runtime-based JSTL tag library, you must declare the library using a taglib directive:

<@ taglib prefix="c_rt" uri="">


[Solved] Spring dependency injection not working

On February 1, 2011, in JSF, Spring, by lucasterdev

You made an application with JSF + Spring integration.
You deployed your application.
You got NullPointerException when an injected object’s method is called.

How to fix that:

Add the following piece of XML in faces-config.xml:


You’ll get the following warning:

Class org.springframework.web.jsf.el.SpringBeanFacesELResolver must extend the type javax.el.ELResolver

Ignore it.