Jboss EAP: dumping configurations as scripts!

Today I found this nice tool to create configuration scripts for Jboss EAP from existing configurations.

$  git clone https://github.com/tfonteyn/profilecloner.git
$  cd profilecloner
$  export JBOSS_HOME=/opt/jboss/
$  mvn install
$  ln -s profilecloner.jar target/profile*jar
$  ./profilecloner.sh -f save-script-here.cli  –controller=$HOST –username=admin –password=secret /profile=full-ha antani-new-profile-name
$  cat save-script-here.cli

Enjoy!

Using custom CXF stack with JBoss EAP 6.x

Boss delivers a set of libraries as modules.

To use them you should reference them either in:

  • MANIFEST.MF
  • jboss-deployment-structure.xml

Those libraries can be publicly or privately exposed, as per https://access.redhat.com/articles/1122333.
The list includes:

  • CXF 2.7.x
  • RestEasy
  • JBossWs


To use your custom stack as a JAXWS/RS implementation, you should specify in the jboss-deployment-structure.xml to:

  1. exclude webservices/jaxrs subsystem
  2. exclude JEE support: JAXRS is part of JEE specs and is a dependency of JEE
  3. exclude RestEasy and CXF modules
  4. eventually include, one-by-one, all the JEE dependencies you are going to use in your stack (eg. servlet)

An example app using the Jersey stack is here.
https://access.redhat.com/solutions/676573

One-click remote deployment with jboss and eclipse via maven

Create a maven goal which deploy to a remote jboss eap 6.x instance is quite simple.

Just add the following to your pom.xml

    <plugins>
			<plugin>
				<groupId>org.jboss.as.plugins
				<artifactId>jboss-as-maven-plugin
				<version>7.6.Final
				<configuration>
					<username>admin
					<password>Admin#1234
					<hostname>192.168.0.10
					<port>19999
				</configuration>
			</plugin>
      </plugins>


Then create a maven run configuration in eclipse having:
– Base directory set to the variable ${project_path} (so that it applies to the current project)
– Goal: jboss-as:deploy

Impossibile salvare documenti Internet Explorer da un sito Web SSL o con Basic Auth

Nel corso dello sviluppo di una demo per un cliente siamo incappati in un errore stranissimo, quando si tentava di scaricare il file certificate.p12 appariva una finestra con l’errore “Impossibile aprire il sito Internet. Sito non disponibile o non trovato. Riprovare.” la cosa si verificava solo con l’uso di Internet Explorer (6 o 7)… naturalmente la webapp funzionava correttamente con Firefox, Safari, Opera ed anche col nuovissimo Chrome (maledetta Microsoft!!!!)

abbiamo iniziato una ricerca con google e siamo giunti alla pagina http://support.microsoft.com/kb/316431/it e http://support.microsoft.com/kb/222064 dove si parlava di un problema analogo ma non uguale, qui gli incriminati erano 2 header della response:

Pragma: no-cache
Cache-control: no-cache,max-age=0,must-revalidate

Il problema è che nel codice non erano impostati nè l’uno nè l’altro? abbiamo controllato però il pacchetto in response con tcpdump è gli header effettivamente erano presenti…. non restava che capire chi inseriva questi header… siamo giunti alla pagina http://wiki.jboss.org/wiki/DownloadSSLAndIE6 dove si capisce che è l’application server ad aggiungere tali tag, delle due soluzioni abbiamo adottato la piu semplice cioè quella di aggiungere nel codice

response.setHeader("Cache-Control", "cache, must-revalidate");
response.setHeader("Pragma", "public");

in questo modo l’application server (JBoss e Tomcat hanno lo stesso comportamento) non sovrascrive gli header ed è possibile scaricare il file anche da IE…. ;-)