Jboss load system properties from file - jboss

Can I make jboss load system properties from a file without writing any explicit code for it?

Yes you can.
In JbossAS versions prior to 7.x there is PropertiesService. It's dead simple to use. I am using it with JBoss 5.1.0.GA, and it works like a charm.
Unfortunatelly PropertiesService mbean is absent in JBossAS 7.x, but there are other ways as described in official admin guide.
Here is another solution. Post author claims it's possible to list your properties files in command line while starting server instance:
./standalone.sh --properties=1.properties --properties=2.properties
and their contents should be added to System Properties.

Related

Keycloak JBoss EAP7 Adapter in domain mode

I am using Keycloak4.8.3 with JBoss EAP 7.2.2. Therefore I installed the adapter keycloak-wildfly-adapter-dist-4.8.3 on JBoss
As to the documentation I executed the command line
$ ./bin/jboss-cli.sh --file=bin/adapter-elytron-install-offline.cli
But it only modifies the standalone.xml. This is ok for my local environment.
My customer is running in domain mode and therefore the changes have to exist in domain.xml. Is there a way to automate modifying the domain.xml? I want to avoid copying the changes manually.
First you might have to know which profile your JBoss is running with.
Then edit adapter-elytron-install-offline.cli, for every occurrence of /subsystem, prepend with /profile=<your-profile-name>
The use jboss-cli.bat along with the newly edited cli file to modify the domain mode configuration as you previously did.

How to run multiple JBoss EAP 6.3 instances as Windows services

We are migrating our JBoss EAP 4.3 infrastructure to EAP 6.3 (standalone).
We currently run several instances on each machine by having different server folders:
JBOSS_HOME\server\instance_1
...
JBOSS_HOME\server\instance_n
and a different set of startup scripts for each instance:
JBOSS_HOME\bin\run_instance_1.bat ; JBOSS_HOME\bin\service_instance_1.bat
...
JBOSS_HOME\bin\run_instance_n.bat ; JBOSS_HOME\bin\service_instance_n.bat
This way you can define SERVERNAME and SERVERIP for each instance from service_instance_X.bat.
The problem I'm facing is that I cannot seem to find a similar mechanism on EAP6.3. The closest I got was this command:
JBOSS_HOME\bin\standalone.bat -Djboss.bind.address=%SERVERIP% -Djboss.bind.address.management=%SERVERIP% -Djboss.server.base.dir
=%JBOSS_HOME%\%INSTANCENAME%
which does the job, but that does not help when running it as a service.
There is one promising option to prunsrv which is ++JvmOptions, where you can pass -D and -X options to JVM at service install time, but even when the install command runs successfully with the added options, it keeps starting up using JBOSS_HOME\standalone as jboss.server.base.dir.
Should I rather have custom service.bat, standalone.bat and standalone.conf.bat scripts? Looks like the best approach, but migrating or patching might become troublesome.
Any ideas would be welcome.
Sebastian
I had it working with the last option I mentioned: custom service_instancename.bat, standalone_instancename.bat and standalone_instancename.conf.bat.
But I had to edit several parts of the scripts. Definitely not ideal, but I see no other choice. If anyone came up with a better idea, please share.

Deploy portlets for Liferay 6.1.2 running on JBoss 7.2.0

I was wondering if anyone could help me out. I recently installed Liferay 6.1.2 on our JBoss 7.2.0. No problems with setting up the environment. Documentation was really helpful. But now I'm not making any progress with deploying themes and portlets.
Control Panel > Server > Plugin Installations is not providing any upload functions. Only lists of portlets, themes ans templates respectivly and a hint that Liferay marketplace will take over some day.
Letting the JBoss take care of the deployments doesn't work either. This would be my favored solution, but portlet deployments failed because some liferay classes are missing. Tried to deploy a theme afterwards, which didn't result in errors, but this theme was not available for pages in Liferay. Is letting the JBoss take care of the deployments an option anyway? After all portlets cannot run outside of a portal-environment.
My last try so far was using an auto deploy directory. But since our JBoss is running in domain mode instead of standalone, it seems this is not an option. JBoss log states that the deployment-scanner subsystem can only be installed in standalone mode, not in domain mode.
Has anyone extirienced similar problems and can provide a solution or some helpful tips? Or maybe there is an other solution that I haven't tought of so far. Anyway, I looking forward to hearing from you ;-) Thanks in advance.
Regards
Sebastian
Liferay's "Hot Deploy" process ensures that plugins use the correct versions of Liferay libraries, matching the currently installed portal. If your server does not support hot-deployment, there's another, recommended way to inject these settings and libraries. Look at these properties:
#
# Set this to true to enable auto deploy of layout templates, portlets, and
# themes.
#
auto.deploy.enabled=true
#
# Set the directory to scan for layout templates, portlets, and themes to
# auto deploy.
#
auto.deploy.deploy.dir=${liferay.home}/deploy
#
# Set the directory where auto deployed WARs are copied to. The application
# server or servlet container must know to listen on that directory.
# Different containers have different hot deploy paths. For example, Tomcat
# listens on "${catalina.base}/webapps" whereas JBoss listens on
# "${jboss.home.dir}/deploy". Set a blank directory to automatically use the
# application server specific directory.
#
auto.deploy.dest.dir=
auto.deploy.default.dest.dir=../webapps
auto.deploy.geronimo.dest.dir=${org.apache.geronimo.home.dir}/deploy
auto.deploy.glassfish.dest.dir=${com.sun.aas.instanceRoot}/autodeploy
auto.deploy.jboss.dest.dir=${jboss.home.dir}/standalone/deployments
auto.deploy.jetty.dest.dir=${jetty.home}/webapps
auto.deploy.jonas.dest.dir=${jonas.base}/deploy
auto.deploy.resin.dest.dir=${resin.home}/webapps
auto.deploy.tomcat.dest.dir=${catalina.base}/webapps
auto.deploy.weblogic.dest.dir=${env.DOMAIN_HOME}/autodeploy
auto.deploy.websphere.dest.dir=${env.USER_INSTALL_ROOT}/wsadmin-deploy
You can override these in portal-ext.properties. Configure your JBoss to listen to any directory, here ${liferay.home}/deploy, and configure its dest dir to somewhere else: auto.deploy.jboss.dest.dir=${liferay.home}/for-installation-on-jboss. Then package the resulting content of the dest.dir as *.war or *.ear file and deploy this as usual on your JBoss server. This one will contain all settings and libraries required.
Make sure that ${liferay.home}/for-installation-on-jboss exists before you try to "deploy" to it.

Apache Felix not binding my configuration correctly - wrong inputstream version

I had a bundle deployed in an Apache Felix (Sling, in fact) host. The bundle contained some configurable elements, and its version was 2.0.
I have updated the bundle to v2.0.1 for some small code changes, and now the bundle will not pick up its configuration correctly - it remains at the defaults set in code rather than picking up the values configured in the Felix Web Console.
There is an error message in the log: "[Configuration Updater] org.apache.felix.scr Cannot use configuration pid=com.mypackage.MyClass for bundle inputstream:my-bundle-2.0.1.jar because it belongs to bundle inputstream:my-bundle-1.0.jar" which sounds like the cause of the issue.
However:
I can't edit the inputstream value through the web interface - only by stopping the server, editing the config file manually, and restarting. Surely when I update the bundle, the config should be updated too?
Although the inputstream specifies v1.0, the bundle did not have a problem when it was upgraded to v2.0. What's made the difference here?
I have done the same thing (though perhaps not exactly!) on two servers, and one server seems to have the config specify inputstream=v2.0 (and the bundle at v2.0.1) and it works fine. What caused inputstream version to update on this server? (Presumably the same as the answer to 2 - I imagine it'll depend exactly which steps in the process have been executed and in what order.)
Any advice gratefully received - I haven't been able to find any documentation that gives instructions or troubleshooting suggestions for administering bundles through the Felix Web Console.
If at all possible, I would simply stop and remove the bundle altogether and install it using Sling , e.g. with the maven-sling-plugin or dropping it in the /apps/myapp/install folder using WebDAV .
I find it easiest to be consistent this way and the installation is nicely automated and it handles bundle upgrades properly.

Declaring a JNDI variable in JBoss 4.0.5

I want to declare a new JNDI variable in the JBoss 4.0.5 server. Can someone please explain how this can be done?
waiting for your replies.
Thanks.
Found these two links that can help...
create a file called filename-service.xml under $CATALINA_BASE$/deploy directory with contents as indicated in these links
http://www.redhat.com/docs/manuals/jboss/jboss-eap-4.2/doc/Server_Configuration_Guide/Additional_Naming_MBeans-JNDI_Binding_Manager.html
check a jboss jira, JBPAPP-2809 for correction in xmlns:jndi
Have a look here and specifically here. You need to add an entry in the ejb-jar.xml file of your application.
I am facing this probelm too today. Looks like to add a simple jndi entry on the app server, in JBoss one will have to create a new file $CATALINA_BASE/conf/context.xml and invoke a MBean to add the variable and its value.
In server like websphere you can pass new values in jndi.properties, which jboss 5.0.0 upwards does not like.
Very Bad that there is absolutely NO DOCUMENTATION in jboss/docs that indicate anything on this topic.