Pages

آخر التدوينات

Starting multiple JBoss A-MQ JVMs on the same machine

So I haven’t been blogging as much recently — just been really busy. But my New Year’s resolution is to blog a little more sharing some things I come across frequently, even if it’s simple stuff that might help some people out.
So for this entry, I’ll show a quick way to start up multiple JBoss A-MQ instances on a single machine. The reason why this question comes up is because JBoss A-MQ includes a little more “enterprise” ready features out of the box than plain old community ActiveMQJBoss A-MQ is a production-ready, hardened, version of ActiveMQ, and it’s packaged inside Apache Karaf with some other features like theHawtIO console (and more).


What happens when people are trying to simulate more complex deployment scenarios in a lab or development environment, they may not have access to multiple VMs or machines to try out a full real-world deployment. So they may want to install multiple brokers on a single box. This is pretty straight forward, and all you have to do is make sure the default ports don’t conflict. NOTE: this is not intended to be a production deployment!!! Don’t deploy this way to production!!
You can get pretty wacky and customize each additional A-MQ/Karaf JVM with the Karaf admin commands but if you want to just get something working and want to understand where the port conflicts can be, check this out:

Download JBoss A-MQ

Go to the Red Hat support portal (or JBoss.org) and download the copy of JBoss A-MQ you want to use. Note, the bits are the same from whichever website you download from, but you need a valid subscription to use in any shared environments (anything excluding your development laptop).
For this exercise, we’re using JBoss A-MQ 6.1 (filename jboss-a-mq-6.1.0.redhat-379.zip)

Install into two locations

If we want to have two separate JBoss A-MQ brokers, let’s start by unpacking into two separate locations:
1~> unzip jboss-a-mq-6.1.0.redhat-379.zip -d amq01
2~> unzip jboss-a-mq-6.1.0.redhat-379.zip -d amq02
Now in each installation path (eg, ./amq01/jboss-a-mq-6.1.0.redhat-379), which we’ll call the broker’s BASE directory, find the files in the $BASE/etc folder with the name users.properties. Uncomment the last line in that file so we have an admin user.

Change ports

Last step we need to do is change the ports in the installation for amq02 so they don’t conflict.
There are three files we’ll need to touch, which are the config PIDs for the services that run in the container.
  • 1etc/org.apache.karaf.management.cfg
In this file, edit the following properties:
1rmiRegistryPort = 1098  #default is 1099
2rmiServerPort = 44445   #default is 44444
Note, those are the changed values. You can change them to whatever you want.
  • 1etc/org.apache.karaf.shell.cfg
In this file, edit the following properties:
1sshPort = 8102  #default is 8101
  • 1etc/system.properties
And lastly, in this file, edit:
1org.osgi.service.http.port=8182   #default is 8181
2activemq.port = 61617   #default is 61616
3activemq.jmx.url=service:jmx:rmi:///jndi/rmi://localhost:1098/karaf-${karaf.name}

Start up your brokers

Go and start up your brokers with $BASE/bin/amq script, and you should have two running brokers, without collisions on ports.


source:
http://www.javacodegeeks.com/2015/01/starting-multiple-jboss-a-mq-jvms-on-the-same-machine.html

Java: How to fix your biggest Internet security risk




The weekly -- sometimes daily -- security scares that occur with the Java programming language are starting to remind me of the old whack-a-mole arcade game.
Researchers or hackers discover a major flaw in Java. Java's developer, Oracle, whacks it with a patch. Another mole pops up. Oracle whacks it with a patch. Many experts say Oracle is losing this game, or isn’t trying very hard to win. And computer users are paying the price. 
When a vulnerable version of Java is active in a Web browser, visiting a compromised website is all it takes for crooks to sneak malware on to your computer. In most cases, you won't even know the site is compromised until it's too late.
Here's how to stay safe: Stop using Java -- or stay on top of the upgrades and use Java a lot more guardedly.
I'm going to help you do just that.
But first: What the heck is Java, and why is it capable of scalding your computer?
First developed back in 1995, Java became ubiquitous almost overnight because it allowed programmers to write one program and use it on Windows, Apple OS X and other operating systems.
Today, Internet browsers use Java for interactive Web content, such as popular online games. Computers use it to run useful programs such as the free Office alternative LibreOffice, and Adobe Creative Suite. And Java is pre-installed on most new systems. It's estimated that Java is running on 850 million computers around the world.
It's no wonder Java is a major target for hackers. It doesn't help that users frequently don't know it's installed and run outdated versions.
Java's security holes woke up Apple users last year when more than 600,000 Macs became infected with the Flashback malware that targeted Java.
Since then, moles have kept popping up through other holes. In response to the most recent exploit, the Department of Homeland Security a couple of weeks ago recommended that all Internet users disable Java in their browsers.
Apple and Mozilla have turned off Java plug-ins automatically in the latest editions of the browsers Safari and Firefox, respectively. But it doesn’t hurt to double-check that Java is turned off.
Fortunately, the latest version of Java has a one-click button just for that purpose. That's handy because disabling it manually was a hassle, especially in Internet Explorer.
First, make sure you have the most recent version of Java from Oracle's site. The latest release as of this writing is Version 7 Update 11.
To bring up Java's new security settings, go to Start>Computer and type "Javacpl.exe" in the search bar.
If it doesn't appear, you may have to find it manually. Go to Start>Computer and open your Local Disk (C:). Go to Program Files (x86)>Java>jre7>bin and scroll down until you see "javacpl.exe". On 32-bit computers, the file is in Program Files>Java>jre7>bin.
Run javacpl.exe to load Java's control panel and select the Security tab. Uncheck the box that says "Enable Java content in the browser." Then restart any browsers you have running.
Mac users can find the setting by going to System Preferences and clicking on the Java icon -- it looks like a steaming cup of coffee.
This will disable Java in your browser, but still let you use it for desktop programs.
Warning: If you do head into your browser settings to check that Java is disabled, you might see something called JavaScript. Don’t disable JavaScript! It's a different animal and has no security issues.
Although it's safer to run Java for a desktop program, it's best to get it off your machine if you don't need it.
In Windows, go to Start>Control Panel and click the Uninstall a program link. Find Java on the list of programs -- you might see multiple installations of Java 6 and 7 -- and uninstall any versions you see.
In OS X 10.7 and 10.8, go to Macintosh HD/Library/Java/JavaVirtualMachines/ and remove the 1.7.0.jdk file. Older versions of OS X might be running Java 6.
Even if you're keeping Java, you want to make sure you only have the latest version installed. Older versions leave your system vulnerable. Follow the steps above to remove the older versions.
If you need Java for a website or two that you know are absolutely trustworthy, you can enable Java briefly using the security control panel and then disable it again. Just make sure you stay on the trustworthy site 
while Java is enabled.


Read more:
http://www.foxnews.com/tech/2013/01/26/java-how-to-fix-your-biggest-internet-security-risk/