how to run Activemq program in java - activemq

i have install activemq 5.5.1 in my c:\programFiles\activemq\...
and from the command prompt i have installed it and set enviroment variable.
and i have also run it. and it is also running on local host.
i have write a java program in my eclipse editor.
and i have added Activiemq library in project form that path.
programm:
http://developers-blog.org/blog/default/2008/10/28/A-simple-ActiveMQ-example
but i am also confuse What the use of that c:\programFiles\activemq... installation how i use it.
I want to only to create my first Activiemq program through java.
plz help

The installation of ActiveMQ gives you everything you need to run the broker standalone by just running the activemq.bat under the bin directory. It's just a nice way of packaging the application as opposed to just giving you some jar files.
If you want to run the broker inside a Java program you just need to include the jars for the broker and you won't need to use the installation directory again.

Related

log4j2 for MULE 3 CE patch update

I need some information of log4j2 for updating our central versions of Mule CE 3.9.0 and Mule CE 3.9.5 (CE=Community Edition).
What is the best way to protect them and does downloading only jar files from Apache site https://dlcdn.apache.org/logging/log4j/2.12.3/ be useful to patch Mule CE 3.9?
Regards
As a summary you only need to find the vulnerable jars in the mule-server and in the mule flows deployed in the apps folder.
A Java project is a set of java class and libraries with complex dependencies relationship, but easy to replace one of them (manually or automated with maven), so no matter how or where log4j is being used, we just need replace the jar file.
mule community server 3.9.0
In this version, with this command find . -type f -iname "*log4j*" we will get the log4j jars:
As we can see, the version prior to the 2.14.x
log4j-jul-2.8.2.jar
log4j-jcl-2.8.2.jar
log4j-slf4j-impl-2.8.2.jar
log4j-core-2.8.2.jar
log4j-api-2.8.2.jar
log4j-1.2-api-2.8.2.jar
But according to the official maven repository, this version is affected too :(
Just the 2.17.0 is safe to use
Source: https://mvnrepository.com/artifact/org.apache.logging.log4j/log4j-core
If this change breaks your mule, just delete the specific vulnerable class:
zip -q -d
log4j-core-*.jar org/apache/logging/log4j/core/lookup/JndiLookup.class
Source: https://www.docker.com/blog/apache-log4j-2-cve-2021-44228/
mule flow or mule app
This is not the server, is the app developed by programmers, packaged as .zip and deployed to the mule apps folder in the server.
In this layer, the app can ignore completely the server configurations and has its own jar versions.
If you don't use maven (rare), you need to search and replace the jar, app by app, similar to the server with find command but in the specific app folder:
/opt/mule_server/apps/my-mule-app
If you use maven, you could find if the jar is used with the pom.xml previewer of Eclipse Ide or with command mvn dependency:tree. Check this:
https://stackoverflow.com/a/68916675/3957754
Remember: If you not use directly this jar, you need to check if mule esb server uses it.
Here some tips from manual to automated pipelines:
mule esb monolithic with manual deployment
In this case you need to fix the server and your apps.
for the server, backup, stop, search the jar on lib folder and replace it with the 2.17 (after vulnerability fix) and start. Test if everything is working
for the mule apps, the process is the same: stop the mule server, go to your mule apps and one by one, search the jar and replace it. Start the mule server and test if everything is working
git repository , maven and one mule app by server
In this case, you don't have a big server with a big mule containing a lot of mule apps/flows. You have one light server for just one mule app.
Just search the dependency in your pom with maven and replace it.
Push your changes and in the next deploy( manual or automated) your mule app will be fixed.
Also note that this approach fix the app, not the server.
git, docker
If you are using docker, the things are easy. Just search the Dockerfile (usually in a git repository). In this file there are a lot of sentences, since the java installation until the star of mule server.
Choose the exact line between the download of mule and the start of server and put a sentence which replace the jar file
Next deploy will pick you new image version and that's all.
automated flow(devops)
Here you are using maven, gi, docker and some ci server. You just need:
update the git repository of your mule app (maven)
update the git repository of your docker image
deploy your fix using the ci server.
With this, you will not need human access to the production servers to fix your java application ( mule)

Adding .jar Files in Visual Studio Code

First and foremost, I really appreciate your help. I am trying to build an application by using an external library Apachi Poi. I know I need to add jar files to the project; however, I don't know how I should do that plus I have been searching on the Internet for a solution, but I could not find one even I checked this. My OS is Linux and I am running 1.33.1 version of VSCode.
[UPDATE]: I have fixed my problem. What I basically did was to install maven command to my
Linux machine and now I am using mvn command along with pom.xml to add my .jar files to
the project.

Gradle + JRebel + rebel-remote.xml without JRebel IDE Plugin

Can you use standalone + JRebel remote?
I have my IDE on Box A
I have my App on Box B
I want to be able to make gradle build on Box A and automatically have B hot deploy that.
If Possible I'd like all this needs to work without The intelliJ plugin because it's broken and produces the wrong paths to lib locations in our complex gradle project.
No.
Synchronization with remote servers can only done via JRebel IDE plugin.
If you have any troubles with the IDE plugin or the Gradle plugin, please contact support at support#zeroturnaround.com
It's not possible to use JRebel remoting without the IDE plugin as the remote server does licensing checks during a sync transaction and classes simply copied to the remote .cache folder will be rejected otherwise.
However you can still setup a manual remoting setup. For example you can create a "virtual" workspace on BoxB where classes/jars/wars are copied after the build. In this scenario disable the remoting plugin and use standard rebel.xml-s which map to the workspace on BoxB.
When doing changes, simply copy the files from BoxA to BoxB e.g. using rsync and they will be reloaded as usual. However note that in this setup you must provide the server on BoxB with a valid license.

How to generate 64-bit version of sikuli JAR?

I am working on developing test automation code in selenium, I want to use 'sikuli' inside my code to handle windows and Flash objects in my web application,
I'm using 64-bit JVM, but there is no 64-bit version of Sikuli available, this is resulting in an error while running the code,
"Can't load IA 32-bit .dll on a AMD 64-bit platform"
I could not find a 64-bit sikuli Jar on internet, but I found that Sikuli source code is hosted on GitHub, could someone help me understand if I can use that source code and compile it into a jar of 64 bit version?
I'm not sure if this is possible or not.
If you install Sikuli 1.0.1 you have the option to install 6 packages with it as well. I would recommend installing the first 5. Then you will have all the things you are ever going to use.
If you also work on different sytems other then Windows, the 6th packages is also advisable.
I have installed all 6.
Finally got this working, here is what I did,
Download the sikuli set-up Jar from
"https://launchpad.net/sikuli/sikulix/1.0.1/+download/sikuli-setup.jar"
Save this jar in a folder 'SikuliSetup',now create a sub directory
'Downloads' which will come into picture later.
Run the above Jar, this will generate two files under the above
directory.
Now run the 'runSetup.bat' file generated from above setup. This
will start the setup, now select the 4th and 6th option in the
'sikulisetup' pop-up and click on 'setup Now'.
The above step will fail for most people due to default security
issues.
If the above step fails then you need to download an offline
version of this jar from this URL
"https://launchpadlibrarian.net/156273987/Sukuli-1.0.1-Offline-Setup-Java-option3-option4.zip".
UnZip the above file and copy the '1.0.1-3.jar' file to 'Downloads'
directory created under the 'SikuliSetup' directory previously.
Now run the 'runSetup.bat' file again, this will generate a new
jar file 'sikuli-java' and its dependent libraries under 'lib'
folder.
That's it, now copy this jar 'sikuli-java.jar' to your java build
path in eclipse.
Now Java will use this sikuli libraries without any issues.
Once after you setup the jar file under build path, restart the
system and login again.

Glassfish v2 asadmin "deploy" jar files

Is there a way in glassfish v2 asadmin utility to copy jar files into the server lib or the domain's lib? I want to do a remote deployment using hudson on a different box so i have a script that executes a bunch of asadmin commands.
asadmin deploy moves your deployable code to the autodeploy directory making glassfish aware of its existence to deploy. I believe copying a simple library out there won't net any effect without proper deployment descriptors. In any event I don't think the asadmin deploy would have access to your domain/lib or server/lib directory but rather only your application directory structure itself.
To do what you are trying to achieve, it sounds more like writing a simple ant script.