JEE

java.lang.ClassNotFoundException: javax.annotation.PostConstruct

When upgrading to the latest tools and libraries in a Spring Boot application with OpenAPI code generator in place the OpenAPI Kotlin generator introduced jakarta.annotation:jakarta.annotation-api. But with this in place the application refused to start with something like org.springframework.context.ApplicationContextException: Unable to start web server; nested exception is org.springframework.boot.web.server.WebServerException: Unable to start embedded Tomcat…Caused by: java.lang.IllegalStateException: […]

java.lang.ClassNotFoundException: javax.annotation.PostConstruct Read More »

JBoss show JDBC Queries

Sometimes it is necessary to see which queries are executed and what the parameters of these queries have been. To get this data from a JBoss 7+ you have to follow these steps: Enable JDBC-Spy on Datasource: /subsystem=datasources/data-source=ExampleDS/:write-attribute(name=spy,value=true) Or just add spy=”true” as attribute in standalone.xml. Then you have to enable the spy by adding a

JBoss show JDBC Queries Read More »

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). <settings> … <profiles> … <profile> <id>jboss-public-repository</id> <repositories> <repository> <id>jboss-public-repository-group</id> <name>JBoss Public Maven Repository Group</name> <url>https://repository.jboss.org/nexus/content/groups/public-jboss/</url> <layout>default</layout> <releases> <enabled>true</enabled> <updatePolicy>never</updatePolicy> </releases> <snapshots> <enabled>true</enabled> <updatePolicy>never</updatePolicy> </snapshots> </repository> </repositories> <pluginRepositories> <pluginRepository> <id>jboss-public-repository-group</id> <name>JBoss Public Maven Repository Group</name> <url>https://repository.jboss.org/nexus/content/groups/public-jboss/</url> <layout>default</layout> <releases>

JBoss Maven Repository Read More »

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

Encrypted Database Passwords in JBoss Read More »

Disable Deployment-Scanner in JBoss

Look for the deployment-scanner config in your standalone.xml and configure the scan interval to -1 to allow deployment onyl from shell or at startup. Here is the relevant part: <subsystem xmlns=”urn:jboss:domain:deployment-scanner:1.1″> <deployment-scanner path=”deployments” relative-to=”jboss.server.base.dir” scan-interval=”-1″/> </subsystem> Or with cli: /subsystem=deployment-scanner/scanner=default:write-attribute(name=scan-interval, value=-1)  

Disable Deployment-Scanner in JBoss Read More »

Remove X_POWERED_BY Header in JBoss EAP6

First you have to disable it in standalone.xml by adding jsp-configuration x-powered-by=”false”. Here the relevant part of my config: <subsystem xmlns=”urn:jboss:domain:web:1.5″ default-virtual-server=”default-host” native=”false”> <connector name=”http” protocol=”HTTP/1.1″ scheme=”http” socket-binding=”http”/> <virtual-server name=”default-host” enable-welcome-root=”false”> <alias name=”localhost”/> </virtual-server> <configuration> <jsp-configuration x-powered-by=”false”/> </configuration> </subsystem> Or with cli: /subsystem=web/configuration=jsp-configuration:write-attribute(name=x-powered-by,value=false) In a JSF application you have to add the following context param: <context-param>

Remove X_POWERED_BY Header in JBoss EAP6 Read More »

Make your webapplication log debug messages under jboss

I often catch myself writing info-messages because jboss is configured to info-mode by default. By adding the following few lines you can make your application use debug mode: <subsystem xmlns=”urn:jboss:domain:logging:2.0″> … <!– add begin –> <console-handler name=”DEBUGCONSOLE”> <level name=”DEBUG” /> <formatter> <pattern-formatter pattern=”%d{HH:mm:ss,SSS} %-5p [%c] (%F:%L) %s%E%n” /> </formatter> </console-handler> <logger category=”pm.mbo” use-parent-handlers=”false”> <level name=”DEBUG”

Make your webapplication log debug messages under jboss Read More »