Here is a list of issues I came across when working with Java EE (J2EE).
First of all, do not fall into a trap (as me) and do not follow
JBoss MDB Config WiKi,
it is related to EJB 2.x. The <configuration-name> is ignored by
org.jboss.ejb3.ddJBossDDObjectFactory
(called from
org.jboss.ejb3.Ejb3HandlerFactory.DDFactory(Ejb3Deployment di)
)
Use the ActivationConfigProperty "maxSession", default is 30:
@MessageDriven(activationConfig = { @ActivationConfigProperty( propertyName = "destinationType", propertyValue = "javax.jms.Queue"), @ActivationConfigProperty( propertyName = "destination", propertyValue = "queue/email"), @ActivationConfigProperty( propertyName = "maxSession", propertyValue = "1")}) public class MailerMDB implements MessageListener {
The following code may cause troubles to SQL engine, because the table name or column name clashes with SQL keyword.
@Entity // PostgreSQL doesn't like "create table User ..." public class User implements Serializable { // HSQL doesn't like "order" in SQL query public byte getOrder() { ... } }
There is no portable solution, the following code may not work, it depend on database provider. Isn't this case for database abstraction?
@Entity @Table(name="\"User\"") // PostgreSQL OK, HSQL bug public class User implements Serializable { @Column(name="`order`")// PostgreSQL bug, HSQL OK public byte getOrder() { ... } }
JBoss 4.0.5.GA is distributeds with HSQL database. Unfortunately the shipped version is quite old (which version?) and has many bugs. The HSQL 1.8.x works fine with JBoss, must place the jar in server/default/lib folder.
The HSQL is tiny SQL engine written in pure Java and it has severe limitations and default settings, that may not be good for your application testing. For instance, prior to 1.7.2, all table column type definitions with a column size, precision or scale qualifier were accepted and ignored. The 1.7.2 default settings still ignores sizes.
jdbc:hsqldb:mem:localhost;sql.enforce_strict_size=trueFor hsql database in JBoss the hsqldb-ds.xml must be changed (specifying property in connection string doesn't work). It is a hack but should work, see HypersonicDatabase.java. As an alternative, use <new-connection-sql>:
<mbean code="org.jboss.jdbc.HypersonicDatabase" name="jboss:service=Hypersonic"> ... <attribute name="Database">default;sql.enforce_strict_size=true</attribute> </mbean>
I have always troubles to setup tomcat (conatiner) logging correctly. The default installation of Tomcat 5.0.28 on Gentoo doesn't log, catalina.out says:
log4j:WARN No appenders could be found for logger (org.apache.catalina.startup.Embedded). log4j:WARN Please initialize the log4j system properly.
Here is a checklist for succesfull logging: