December 22, 2014

SyntaxHighlighter

Supported styling.

https://github.com/rwz/SyntaxHighlighter/blob/master/demos/autoloader.html

Java EE 7 Maven Dependency

In my previous blog about Java EE 6 Maven Dependency a wrote about the crippled javaee-api maven dependency in maven central.

That is finally fixed in EE 7.

See also Essential Maven POM For JavaEE 7

December 21, 2014

Java EE 6 Maven Dependency

The EE 6 classes are available in maven central.

But when running unit test against them you receive the below error. Thats because they do not contain implementation classes, only api class.

So in practice, the dependecy is in real life unusable. Instead you must use api classes from specific vendors like JBoss.

Java EE 7 Deployment Descriptors

Deployment descriptors are like configuration files.

The below sites summaries all xml schemas defintions for all EE 7 deployment descriptors.

http://antoniogoncalves.org/2013/06/04/java-ee-7-deployment-descriptors/

Java EE 6 Interceptors 1.0 (JSR318)

Introduction

Interceptor was in EE 5 introduced in EJB 3.0, see EJB3 Interceptors javax.ejb.AroundInvoke. In EE 6 that was taken out and made generic into Interceptors (JSR318), package javax.interceptor.*.

You can call Interceptor in EE 6 in two way:

  • By annotating method or class with @javax.interceptor.Interceptors(MyInterceptor.class)
  • Create custom Annotation with Annotation @javax.interceptor.InterceptorBinding and annotate with that you method or class.

Example

Your custom Interceptor.

Interception in a POJO.

Interception in a Stateless Session Bean.

beans.xml located for war in WEB-INF/.

To use the Interceptor you must let weld create the intercepted class, otherwise will weld never knew about the interceptor and hence will the interceptor never work.

Example usage from a Servlet.

Limitation

You cannot use Interceptor directly in servlets, see https://java.net/projects/servlet-spec/lists/jsr340-experts/archive/2012-02/message/0.

Taking Snapshot in Ubuntu

When taking snapshot in Ubuntu you could always use the predefined keyboard shortcuts, see https://help.ubuntu.com/community/KeyboardShortcuts#Desktop_shortcuts

A better tool is to use the gnome-screenshot tool.

You can install via `sudo apt-get install gnome-screenshot`


How to Manage Properties Files in JBoss Module

From JBoss AS 7 and EAP 6 forth, classloading have changed and all jar dependencies are packaged and loaded as jboss modules.

Besides dependency jar in a module you also might need to be able to configure it for different server environment. The best way and maybe the natural way, is to make use of a java properties file.

This is a good practice, now you can RPM package your custom module. This is how Red Hat do with JBoss EAP 6. With RPM packing you have now the capability of versioning your module and to centrally install it from, e.g. Red Hat Satellite. And finally centrally configure the property file from, e.g. Satellite 6 via Puppet.

But there is classloading gotchas. You need to add <resource-root path="."/> to you module.xml.

See https://developer.jboss.org/wiki/HowToPutAnExternalFileInTheClasspath for longer description.

List JNDI Tree Entries with JBoss CLI

To list all JNDI entries with JBoss CLI.

First start JBoss CLI.

Then execute.

How to Deploy Sources and Javadoc Jar

When deploying a snapshot release or if you by some other reason want to generate sources or javadoc jar, you could always configure maven-source-plugin and maven-javadoc-plugin and hook them in maven life cycle.

But that is not necessary in maven uber pom is that already defined for release. You can reuse that by adding -DperformRelease=true

Different example of usage:

Local build with sources and javadoc jar generation

Deploy target. Use only with snapshot version. Then deploy means snapshot publishing to defined snapshot repository.

Overview EE and JBoss EE Compliance

Overview of EE evolution

The capabilities and what is supported out of the box in EE, is increasing from next version to next version. The drive behind the new feature are:

  • Common task are finally included in standard EE.
  • Better maven dependency management.
  • Better test support (FINALLY!), but in this area, more can be done.

[http://en.wikipedia.org/wiki/Java_EE_version_history]

Summary of JBoss AS, EAP and new Wildfly EE Compliance

EE 4 - JBoss AS 4.X, JBoss EAP 4 *

EE 5 - JBoss AS 5.1, JBoss EAP 5 *

EE 6 - JBoss AS 7.1, JBoss EAP 6 *

EE 7 - Wildfly 8.x, JBoss EAP 7 * (release date Q2-Q3? 2015)

*) The EAP is forked from AS/Wildfly version left to it, but with much more quality (tested, patched, security compliance testing, security patched), documentation and with support.

Reference