IntelliJ use system proxy settings

  • Go to the IntelliJ installation folder and open the bin-directory
  • Add “-Djava.net.useSystemProxies=true” at the end of the idea64.vmoptions file (without 64 on a 32-bit system)
  • Restart IntelliJ and configure it to automatically configure proxy (Settings > Appearance & Behavior > System Settings > HTTP Proxy)

How to access BeanManager in a JEE application

There are different ways to get a reference to javax.enterprise.inject.spi.BeanManager in an JEE application:

  • @Inject private BeanManager beanManager;
  • private BeanManager bm = javax.enterprise.inject.spi.CDI.current().getBeanManager();

Especially the second one can be very handy if you hit a part that doesn’t support CDI already.

External ActiveMQ with Wildfly 9.0.1

Target of this post is to configure a vanilla Wildfly 9.0.1 to use an external vanilla ActiveMQ 5.12.0. These are the latest releases on 2015-09-18. I got it running with following steps:

  1. Download Wildfly 9.0.1 if you don’t have it already: http://download.jboss.org/wildfly/9.0.1.Final/wildfly-9.0.1.Final.zip
  2. Download ActiveMQ 5.12.0 if you don’t have it already: http://www.apache.org/dyn/closer.cgi?path=/activemq/5.12.0/apache-activemq-5.12.0-bin.zip
  3. Download ActiveMQ Resource Adapter if you don’t have it already: https://repository.apache.org/content/repositories/releases/org/apache/activemq/activemq-rar/5.9.1/activemq-rar-5.9.1.rar
  4. Extract all the downloaded files. You can place Wildfly and ActiveMQ wherever you want. The resource adapter should go to $WILDFLY/modules/org/apache/activemq/main. All files in apache-activemq-5.12.0-bin.zip should go to this folder.
  5. Edit $WILDFLY/modules/org/apache/activemq/main/META-INF/ra.xml and remove the part marked with <!– NOTE disable the following property if you do not wish to deploy an embedded broker –>
  6. Add the file $WILDFLY/modules/org/apache/activemq/main/module.xml with this content
  7. Edit $WILDFLY/standalone/configuration/standalone.xml and add the following parts:
    • Under urn:jboss:domain:ejb3:3.0 add
    • Under urn:jboss:domain:resource-adapters:3.0 add the resource adapter
  8. In your project you will need to activate javax.jms.api in your jboss-deployment-structure.xml file (placed in WEB-INF folder):
  9. Now you should be able to write your MDB like this
  10. You will find the ActiveMQ management gui under http://localhost:8161/admin/. The default credentials are admin/admin.

JBAS010153: Node identifier property is set to the default value

I got the following warning on startup of EAP 6.4.2:

WARN  [org.jboss.as.txn] (ServerService Thread Pool — 46) JBAS010153: Node identifier property is set to the default value. Please make sure it is unique.

To get rid of this you have to add a node-identifier attribute in the transactions subsystem. Here is my actual config after adding the attribute:

The default standalone.xml has no node-identifier=”SOME_ID” entry and that’s the reason for this warning.

hibernate.id.new_generator_mappings

“true or false. Setting which indicates whether or not the new IdentifierGenerator implementations are used for AUTO, TABLE and SEQUENCE. Default to false to keep backward compatibility.

Note
We recommend all new projects to use hibernate.id.new_generator_mappings=true as the new generators are more efficient and closer to the JPA 2 specification semantic. However they are not backward compatible with existing databases (if a sequence or a table is used for id generation).”

[Quelle: https://docs.jboss.org/hibernate/stable/annotations/reference/en/html/ch01.html]

Java 7 goes “end of public updates”

Java SE 7u79/80


Auto-update Notice & End of Public Updates for Oracle JDK 7

Coincident with the January 2015 CPU release users with the auto-update feature enabled will be migrated from Oracle JRE 7 to Oracle JRE 8. Also, please note this release will be the last Oracle JDK 7 publicly available update. For more information, and details on how to receive longer term support for Oracle JDK 7, please see the Oracle Java SE Support Roadmap.

[copied from oracle download page]

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.