How to list all constraints in Oracle database

You can list all constraints and tables to which they are linked via this SQL statement:

 

Watch out for bad logging: Apache Commons Logging

If you (or your team) use Apache Commons Logging as a logging framework, you may encounter an incorrect way how you log your exceptions (regardless of the logging level – WARN, ERROR, …). It looks like this:

Logging with one parameter has this method signature: Main purpose of this method is to log a […]

Messages are NOT processed even if workers are available

We’ve application which synchronizes customers data at certain time intervals. For that we’re using JMS (HornetQ) with Java EE MDB’s (workers) as these synchronizations are asynchronous and running in the background. One JMS message contains one customer ID. When JMS message is picked up by MDB instance (worker) from queue then it starts syncing data […]

How to run ClamAV as Windows Service

ClamAV (Clam AntiVirus) is a free, cross-platform and open-source antivirus software toolkit which can detect many types of malicious software. When you’re building Java application which needs antivirus then ClamAV is a really good choice. You can send a byte array via API and check it for viruses. For a long time, we operated ClamAV […]

How-to: Obtain Thread Dump and Heap Dump on JBoss/WildFly

Sometimes you need to analyze unexpected behavior on application server. Out of memory, EJB pool exhaustion or deadlock are one of many problems with which you can often met. And not always the server log will help you. When log is empty, but application shows signs of errors (is slow or maybe even stuck) you […]

How to migrate table, index and LOB column to another tablespace

Recently we had to migrate multiple tables, indexes and lob columns from one tablespace to another. We have prepared scripts to generate necessary ALTER statements. First script is for tables:

If <destination_tablespace> is replaced with ‘NEW_TABLESPACE’, <original_tablespace> with ‘OLD_TABLESPACE’ and <owner> is ‘APP’ then executing this script will generate:

In another word this […]

Synchronizing @Schedule method which runs on multiple JBoss servers

Recently we’ve faced a problem of how to synchronize a method with the @Schedule annotation (java.ejb.Schedule) which runs on multiple JBoss servers. Method with this annotation is used as the timeout callback method. It’s simply a method that’s invoked when a timer fires. An analogy is an alarm clock that starts ringing at a certain […]

Injecting EJBs from JAR to WAR using CDI

Recently I faced a problem of how to use @Inject annotation in one of the CDI Beans. Our project has a following structure: Business logic: JAR which packs EJB, JPA Entity Classes, … User interface: WAR which packs CDI Beans, images, XHTMLs, … Technically what I call JAR is actually EJB-JAR, because it packs EJBs, but […]