I have already configured jboss 4.2.3, but i need to use jboss-mq. Looked at the deplot dir of my default server instance and i didn't find jms dir in it. How can i know if this jboss comes with jboss-mq, and where i can find all needed files for my server instance.
I know that hornetmq comes with some install script that will configure jboss to work with hornet, is there some scripr for jboss-mq?
There should be a jms directory in server/default/deploy that contains jms-ra.rar and assorted .xml files, and when you start the server you can see the JMS resource adapter deploying in the logs, e.g.
INFO [Server] Release ID: JBoss [Trinity] 4.2.3.GA (build: SVNTag=JBoss_4_2_3_GA date=200807181417)
...logs snipped for brevity, then...
INFO [RARDeployment] Required license terms exist, view META-INF/ra.xml in .../deploy/jms/jms-ra.rar
along with associated default JMS objects defined in jms-ds.xml, jbossmq-destinations-service.xml etc., for example
INFO [ConnectionFactoryBindingService] Bound ConnectionManager 'jboss.jca:service=ConnectionFactoryBinding,name=JmsXA' to JNDI name 'java:JmsXA'
These files are present in the .zip I just unpacked to test, so if the directory is missing for you then there is something wrong with the install.
Related
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.
The problem is simple: i want to print all topics from apache kafka after installing kafka module on karaf. I need to get properties from cfg file which is located in jbossfuse/etc and create a KafkaConsumer object. I want to implement BundleActivator to be able to start method in the moment of installation module.
The question is: how can i get properties from the config file?
I found some solution here: some solution, they said " you can use ConfigAdimn service from OSGi spec. ". How can i use it? All examples with the code are welcome
Karaf uses Felix-FileInstall to read config files: http://felix.apache.org/documentation/subprojects/apache-felix-file-install.html
So if there is a file named kafka.cfg, it will pick it up and register a config with the ConfigAdmin-Service under the pid 'kafka'.
You can fetch the ConfigAdmin-Service and fetch the config using an Activator and read that config from there, but I strongly recommend to use DeclarativeServices or Blueprint instead to interact with the OSGi-Framework, both support injection of configuration if it is available.
Because otherwise you have to deal yourself with the following topics:
there is no ConfigAdmin (yet), maybe because your bundle starts earlier)
the ConfigAdmin changes (for example due to a package refresh or update)
the configuration is not yet registered (because felix has not read it yet)
the configuration gets updated (for example somone changes the file)
I'm using Jboss Fuse 6.3. I have created a fabric environment with 2 child container. I have assigned one test profile to one of the container. I'm trying to refresh my profile as I have to updated some of the bundles which are part of my test profile.
To do this I login to fabric console and executed fabric:profile-refresh test-profile
But when I see the bundle's header Bnd-LastModified then it seems not updated and referring the old one only.
I tried with fabric:watch * command as well but no luck.
Can anyone help here?
Short answer:
If your bundle is non-SNAPSHOT then there's no attempt to fetch "newer" released version. For maven each non-SNAPSHOT is immutable.
Longer answer:
If by I have to updated some of the bundles you mean mvn clean install new version to your ~/.m2/repository, then it should be picked up by Fuse - assuming that ~/.m2/repository is one of your default repositories - please check org.ops4j.pax.url.mvn PID, org.ops4j.pax.url.mvn.defaultRepositories property.
If however you want Fuse to download newer version of non-SNAPSHOT artifact from some remote repository (Nexus, Artifactory, ...), then a version in local repository is preferred. By default, in Fuse 6.3, this local repository is in $FUSE_HOME/data/repository. There's special option in org.ops4j.pax.url.mvn PID called org.ops4j.pax.url.mvn.updateReleases that allows you to set non canonical Maven behavior to actually update non-SNAPSHOTs.
In fabric mode (which you're using) it's a bit more complex.
There is fabric-agent configuration of maven resolver in io.fabric8.agent PID and org.ops4j.pax.url.mvn.* properties - their meaning is the same as org.ops4j.pax.url.mvn PID and org.ops4j.pax.url.mvn.* properties in standalone mode.
In order to verify how Maven resolution works, you can uncomment these log settings in karaf profile:
# help with identification of maven-related problems with fabric-maven
#log4j.logger.org.eclipse.aether = TRACE
#log4j.logger.org.apache.http.headers = DEBUG
#log4j.logger.io.fabric8.maven.util = TRACE
#log4j.logger.io.fabric8.maven.url = TRACE
#log4j.logger.io.fabric8.agent.download = DEBUG
Also please read my articles about pax-url-aether and Maven in general:
http://ggrzybek.blogspot.com/2016/07/using-maven-with-osgi-part-1.html
http://ggrzybek.blogspot.com/2016/07/using-maven-with-osgi-part-2.html
http://ggrzybek.blogspot.com/2016/10/using-maven-with-osgi-part-3.html
I have a WAR file with REST services. It deploys just fine on JBoss EAP 6.2 (corresponding to AS 7.something) in the standalone mode but it fails sometimes - but often - in the domain mode with a ClassNotFoundException for my subclass of the the JAX-RS Application class, even though it is in the war (well, it runs in standalone). Since it sometimes works, I suspect there is some concurrency issue that leads to JBoss trying to load the class before it can see it.
This is the error:
ERROR [org.jboss.msc.service.fail] (MSC service thread 1-1) MSC000001: Failed to start
service jboss.deployment.unit.myapp.POST_MODULE: org.jboss.msc.service.StartException in
service jboss.deployment.unit.myapp.POST_MODULE: JBAS018733: Failed to process phase POST_MODULE of deployment "myapp"
at org.jboss.as.server.deployment.DeploymentUnitPhaseService.start(DeploymentUnitPhaseService.java:127)
...
Caused by: org.jboss.as.server.deployment.DeploymentUnitProcessingException: JBAS011230: Could not load JAX-RS Application class
at org.jboss.as.jaxrs.deployment.JaxrsScanningProcessor.scan(JaxrsScanningProcessor.java:218)
at org.jboss.as.jaxrs.deployment.JaxrsScanningProcessor.deploy(JaxrsScanningProcessor.java:100)
at org.jboss.as.server.deployment.DeploymentUnitPhaseService.start(DeploymentUnitPhaseService.java:120)
[jboss-as-server-7.3.0.Final-redhat-14.jar:7.3.0.Final-redhat-14]
... 5 more
Caused by: java.lang.ClassNotFoundException: myapp.rs.RestApplication from [Module "deployment.myapp:main" from Service Module Loader]
at org.jboss.modules.ModuleClassLoader.findClass(ModuleClassLoader.java:197)
[jboss-modules.jar:1.3.0.Final-redhat-2]
...
at org.jboss.modules.ConcurrentClassLoader.loadClass(ConcurrentClassLoader.java:118) [jboss-modules.jar:1.3.0.Final-redhat-2]
at org.jboss.as.jaxrs.deployment.JaxrsScanningProcessor.scan(JaxrsScanningProcessor.java:214)
... 7 more
The class is there:
[jboss/domain]$ unzip -l data/content/6c/0ffc675ff1c2254540b6e8caffc0d2605ed549/content | grep RestApp
2262 02-13-14 09:05 WEB-INF/classes/myapp/rs/RestApplication.class
This is how I deployed it (my user != the user running jboss, if that makes a difference):
me$ /opt/jboss/bin/jboss-cli.sh -c --controller=0.0.0.0:49999 --user=admin --password=***
[domain#0.0.0.0:49999 /] deploy /vagrant/myapp.war --all-server-groups
The deployment fails in the same way when executed via the web Admin Console. The deployment to standalone is done by copying the .war to the standalone/deployments/ directory.
Any tips?
Config info
JBoss EAP 6.2
Rest Easy 3.0.6 (replacing the default 2.x module)
We have no JAX-RS stuff in web.xml aside of the resteasy.servlet.mapping.prefix context param; we use the resteasy-servlet-initializer library instead of manually configuring a servlet or similar thing in there
It seems I have fixed the problem by removing all resteasy/jaxrs/jboss libraries from the WAR file's WEB-INF/lib/.
I have noticed the war contained many libraries it should not, such as resteasy-jaxrs-3.0.6.Final.jar, jboss-jaxr-api_1.0_spec-1.0.0.Final.jar (which, BTW, conflicts with Rest Easy 3.0.6), javax.servlet-api-3.1.0.jar etc.
So I guess the classloader did not see/find the class because of classpath hell, the server and the webapp using different "instances" of the same libraries. (No idea why it worked under JBoss standalone; but standalone has the out-of-the-box configuration while domain has been adjusted a lot).
I have also sometimes included --runtime-name=myapp in the deployment command, which seems to be wrong, I should have used --runtime-name=myapp.war (including the ending).
Even though the Author had found an answer for himself, I think it might be useful to post my situation in case other people come accross this issue and the authors solution doesn't work for them.
I had a similar issue where a class was also not found when run under a Redhat JBoss AS cartridge inside Openshift, even though it seemed unreasonable, but later I figured out that the war I was expecting to be deployed wasn't deployed, instead a different one was deployed.
ERROR [org.apache.catalina.core.ContainerBase.[jboss.web].[default-host].[/].[HelloWorld]] (http--127.10.254.129-8080-1) Allocate exception for servlet HelloWorld: java.lang.ClassNotFoundException: com.company.app.HelloWorld from [Module "deployment.ROOT.war:main" from Service Module Loader]
at org.jboss.modules.ModuleClassLoader.findClass(ModuleClassLoader.java:190)
So if there are possibilities, I would run a search of all war files which are expected to have that class, unzip them and search inside the contents to see whether they contain the needed compiled class. I really suggest trying to search for all possible wars. Also look for possible YOUR_WAR.war.deployed it is most likely going to be in the same folder as the war that is currently deployed.
In my case I had these wars:
./app-root/runtime/repo/deployments/ROOT.war
./app-root/runtime/dependencies/jbossas_custom/deployments/ROOT.war.deployed
./app-root/runtime/dependencies/jbossas_custom/deployments/ROOT.war
I was expecting the real one to be in ./app-root/runtime/repo/deployments/ROOT.war because that's where maven was creating it, but seems JBoss would later have to copy it to ./app-root/runtime/dependencies/jbossas_custom/deployments/ROOT.war in my case it didn't do that itself, so therefore my updated war was never deployed, instead it always went to deploy the old one which was already in ./app-root/runtime/dependencies/jbossas_custom/deployments/ROOT.war
Hope this helps somebody to get on the right track.
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.