Posted on December 23rd, 2009 in Code | 1 Comment »
1) sudo apt-get install apache2 tomcat6 libapache2-mod-jk
2) sudo vim /etc/apache2/workers.properties
and type/past in:
# Define 1 real worker using ajp13
worker.list=worker1
# Set properties for worker1 (ajp13)
worker.worker1.type=ajp13
worker.worker1.host=localhost
worker.worker1.port=8009
3) sudo vim /etc/apache2/apache2.conf
and type/past in:
# Load mod_jk module
# Update this path to match your modules location
LoadModule jk_module /usr/lib/apache2/modules/mod_jk.so
# Declare the module for (remove this line on Apache 2.x)
#AddModule mod_jk.c
# Where to find workers.properties
# Update this path to match your conf directory location (put workers.properties next to httpd.conf)
JkWorkersFile /etc/apache2/workers.properties
# Where to put jk shared memory
# Update this path to match your local state directory or logs directory
JkShmFile /var/log/apache2/mod_jk.shm
# Where to put jk logs
# Update this path to match your logs directory location (put mod_jk.log next to access_log)
JkLogFile /var/log/apache2/mod_jk.log
# Set the jk log level [debug/error/info]
JkLogLevel info
# Select the timestamp log format
JkLogStampFormat “[%a %b %d %H:%M:%S %Y] ”
6) sudo vim /etc/apache2/sites-enabled/000-default
Delete “DocumentRoot /var/www”
And type in
JkMount / worker1
JkMount /* worker1
note, you can use JkUnMount to define directories you want apache to serve
7) Enable port 8009 on tomcat
sudo vim /etc/tomcat6/server.xml
remove the “” that is a line below
restart tomcat
sudo /etc/init.d/tomcat6 restart
9) restart apache
sudo /etc/init.d/apache2 restart
10) wget localhost
You should see the default tomcat page
Courtesy of: http://rcpeters.blogspot.com/2009/05/installing-apache2-and-tomcat6-on.html
Posted on November 3rd, 2009 in Code | 2 Comments »
It’s easy to create a clustered instance of ActiveMQ and have your clients connect via multicast. This gives you the ability to create ActiveMQ instances all over the place, have them autodiscover each other and failover seamlessly and automatically. Here’s the ActiveMQ configuration.
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:amq="http://activemq.apache.org/schema/core"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
http://activemq.apache.org/schema/core http://activemq.apache.org/schema/core/activemq-core.xsd
http://activemq.apache.org/camel/schema/spring http://activemq.apache.org/camel/schema/spring/camel-spring.xsd">
<bean class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer" />
<broker xmlns="http://activemq.apache.org/schema/core" brokerName="MyBroker" dataDirectory="${activemq.base}/data">
<destinations>
<queue physicalName="MyQueue" />
</destinations>
<transportConnectors>
<transportConnector name="openwire" uri="tcp://localhost:0" discoveryUri="multicast://default"/>
</transportConnectors>
<networkConnectors>
<networkConnector uri="multicast://default"/>
</networkConnectors>
<persistenceAdapter>
<memoryPersistenceAdapter/>
</persistenceAdapter>
</broker>
<jetty xmlns="http://mortbay.com/schemas/jetty/1.0">
<connectors>
<nioConnector port="8161"/>
</connectors>
<handlers>
<webAppContext contextPath="/admin" resourceBase="${activemq.base}/webapps/admin" logUrlOnStart="true"/>
</handlers>
</jetty>
</beans>
And here is the Spring code for the client.
<bean id="jmsConnectionFactory" class="org.apache.activemq.ActiveMQConnectionFactory">
<property name="brokerURL">
<value>discovery:(multicast://default)</value>
</property>
</bean>
<bean id="destination" class="org.apache.activemq.command.ActiveMQQueue">
<constructor-arg index="0">
<value>MyQueue</value>
</constructor-arg>
</bean>
<bean id="jmsTemplate" class="org.springframework.jms.core.JmsTemplate">
<property name="connectionFactory">
<bean class="org.springframework.jms.connection.SingleConnectionFactory">
<property name="targetConnectionFactory" ref="jmsConnectionFactory" />
</bean>
</property>
</bean>
If you will notice, the ActiveMQ client uses the discovery mechanisms for finding the queue, which allows it to connect to any piece of hardware without actually having to know physical locations. You can replace your multicast://default (which happens to be multicast://239.255.2.3:6155) with whatever multicast address you would like. You could even DNS-it-up and have a url look like multicast://MyBroker.mydomain.com:6166.
Enjoy.
http://activemq.apache.org/multicast-transport-reference.html
Sounds like a band from the 70’s, huh? Here’s a quick picture for part of a presentation I am putting together for my colleagues.

Here’s a basic drawing describing a minimum development environment for any company. The “servers” can be consolidated to a certain point, especially if you are using virtualization software.
Also, the source control, continuous integration and maven repository manager can realistically all run on a single server. You MIGHT be able to get away with running the actual builds on the box but might run into some performance issues, particularly if you are running a big build and simultaneously checking in a bunch of source code.
Running with the coworkers.
http://www.laputan.org/mud/
My personal favorite is “Keep It Working”.
Must read for people who “prototype”.
Posted on February 21st, 2009 in Code | No Comments »
Posted on February 16th, 2009 in Code | No Comments »
Posted on February 13th, 2009 in ETRM | No Comments »
http://www.ferc.gov/market-oversight/mkt-electric/overview.asp
Good sight for overall statistics and information on each of the power markets in the US.