JSF 2.2 ViewScoped

JSF 2.2 has the missing ViewScoped annotation working with CDI. Simply use @javax.faces.view.ViewScoped on your bean. Be careful NOT to mix up with @javax.faces.bean.ViewScoped.

Example view scoped class:

If you use the wrong annotation you will get weld errors when trying to inject an instance of the class.

JBoss Maven Repository

To use the jboss maven repository under https://repository.jboss.org/nexus/ you have to add a profile in your settings.xml (~/.m2 or $M2_HOME/conf).

[copied from https://developer.jboss.org/wiki/MavenGettingStarted-Users, 25.02.2015]

Of course you have to activate it.

Remove “Server” and “X-Powered-By” headers in wildfly 8.2.0

Just remove the following two lines

from your undertow config in standalone.xml. They are found under subsystem urn:jboss:domain:undertow:1.2 > server > host.

Don’t forget to reload/-start your application server after these changes.

Continue reading

SSL in Wildfly 8.2.0

Since wildfly uses undertow the configuration of SSL has changed. You can follow these steps to get SSL running:

  • Create a keystore with keys:

You need to replace “localhost” with your domain name.

NOTE: Your browser will complain that the connection is unsecure because we have no officially signed certificate. Look for a tutorial to create a keypair and a certificate sign request (csr) that you have to send to a certification authority (ca).

  • Configure the SslRealm:

  •  And add a listener:

Now you should be able to access your wildfly under https://localhost:8433/.

Widlfly 8.2.0 – JBAS010153: Node identifier is set to the default value

In the latest version of Wildfly (8.2.0) there is a warning looking like

To get rid of this you have to change the standalone.xml file.  Change this part

to look like this

Of course you can use any value as identifier and “wildfly1” is just an example. Make sure not to use more than 23 characters.

Encrypted Database Passwords in JBoss

JBoss provides a simple mechanism to encrypt database passwords with blowfish. So the standalone.xml does not include our database passwords in plaintext anymore.

First you have to encrypt your password with org.picketbox.datasource.security.SecureIdentityLoginModule. This class includes a main method so you can run it with a single argument which has to be your plaintext password. The result will look like this:

The class is included in jboss modules.

Then create a security-domain in your standalone.xml file:

Or with cli:


The last step is to replace the username+password part of your datasource with a security-domain element. This would look like this in its simplest way:

After theses changes start your application server.

ATTENTION! The passphrase that is used for the Blowfish algorithm is hardcoded in the login module. To make this secure you have to change the password in that component. Change the source and recompile or create an extension and overwrite all necessary parts and add it as a new module.

Disable Stacktrace in Response of JBoss

To disable the source body in a stacktrace you have to add the following configuration to your web subsystem in standalone.xml:

Or with cli:


Disable/Enable JSP Regeneration

To disable JSP regeneration (which is by default off in EAP6) simple add the following  to your web subsystem:

Or with cli:

Simply replace false with true to enable it.