Placeholder link to a great and very useful article on Oracle AQ JMS
Wednesday, 27 January 2010
Wednesday, 20 January 2010
Listing today's files in a directory without using find
Had an issue today where I needed to get the today's log files from a Unix directory but couldn't use find. Normally I could use the time function in find to do this as follows where . is the directory to search from (. is the current directory):
find . -mtime +0
However the only way I could get the date for the files was by using ls -al and then removing all the extra data to leave just the filename.
The following script takes an argument of the directory you want to list all the files with the current date:
#!/bin/shdie () {echo >&2 "$@"exit 1}[ "$#" -eq 1 ] || die "target directory argument required, $# provided"target=$1myvar=`date "+%h %d"`for file in `ls -al $target | grep "$myvar" | sed 's/[-drwx]* *[0-9] *[a-zA-Z0-9]* *[a-zA-Z0-9]* *[0-9]* *[a-zA-Z]* [0-9]* *[0-9]*:[0-9]* *\.*//'`; doecho $filedone
Monday, 2 November 2009
Testing my posterous account
I this message appears in twitter and on my blog then posterous has processed my email and put it both on my blog and on twitter
this is a test
Wednesday, 5 August 2009
How to fix the Glassfish Admin App
Recently we've been having intermittant issues with the GlassFish 2.1 (b.60e) Web Administration Console. The behaviour is that after successfully login you get a HTTP 500 error instead of the web app As follows (minus colours)
At first we were told it was a jar class but I was skeptical as the appserver should keep those isolated from one application to another, however there is something I overlooked that creeps across applications which is the System Properties which are across the JVM.
In the end the issue is down to how the TransformerFactory creates a new instance which uses system properties, more details follow:
HTTP Status 500 - type Exception report
message
descriptionThe server encountered an internal error () that prevented it from fulfilling this request.
exception
javax.servlet.ServletException: java.lang.reflect.InvocationTargetException while attempting to process a 'beforeCreate' event for 'sun_frameSet4'.
root cause
java.lang.RuntimeException: java.lang.reflect.InvocationTargetException while attempting to process a 'beforeCreate' event for 'sun_frameSet4'.
root cause
java.lang.reflect.InvocationTargetException
root cause
javax.xml.transform.TransformerFactoryConfigurationError: Provider org.apache.xalan.processor.TransformerFactoryImpl not found
note The full stack traces of the exception and its root causes are available in the Sun GlassFish Enterprise Server v2.1 logs.
Sun GlassFish Enterprise Server v2.1
At first we were told it was a jar class but I was skeptical as the appserver should keep those isolated from one application to another, however there is something I overlooked that creeps across applications which is the System Properties which are across the JVM.
In the end the issue is down to how the TransformerFactory creates a new instance which uses system properties, more details follow:
Issue:
The Admin app breaks displaying the http 500 error after a successful logon when the javax.xml.transform.TransformerFactory system property is set to a class that is not in its classpath.
Rationale:
This is due to the way that the TransformerFactory is implemented which the Admin app calls to get an XML parser.
To get an XML parser javax.xml.transform.TransformerFactory.newInstance()is called and this uses the following ordered lookup procedure to determine the TransformerFactory implementation class to load:
- Use the javax.xml.transform.TransformerFactory system property.
- Use the properties file "lib/jaxp.properties" in the JRE directory. This configuration file is in standard java.util.Properties format and contains the fully qualified name of the implementation class with the key being the system property defined above. The jaxp.properties file is read only once by the JAXP implementation and it's values are then cached for future use. If the file does not exist when the first attempt is made to read from it, no further attempts are made to check for its existence. It is not possible to change the value of any property in jaxp.properties after it has been read for the first time.
- Use the Services API (as detailed in the JAR specification), if available, to determine the classname. The Services API will look for a classname in the file META-INF/services/javax.xml.transform.TransformerFactory in jars available to the runtime.
- Platform default TransformerFactory instance.
see http://java.sun.com/j2se/1.5.0/docs/api/javax/xml/transform/TransformerFactory.html#newInstance()
System Setting are across the JVM and by default the javax.xml.transform.TransformerFactory system property is not set.
Fix:
Remove the javax.xml.transform.TransformerFactory system property and use one of the other methods to determine the TransformerFactory implementation class
Wednesday, 1 April 2009
Looping through a file search in unix
Little handy script in unix to get file details from a find result
#!/bin/sh# Find all the log files and loop through themfor file in `find $HOME -type f -name \*.log`; do# Get the file detailsls -al $filedone
Thursday, 19 March 2009
GlassFish ESB Netbeans Server Starting Issue
Been having a few issue while doing the OpenESB tutorials http://wiki.open-esb.java.net/Wiki.jsp?page=OpenESBIntroductionTutorial in that the GlashFish server doesn't connect up in Netbeans.
Symptoms:
On the Server's tab in NetBeans you right click start on GlashFish V2, it starts up in the Glassfish Log but you get a time out and the GUI displays the server as not started. You can also go to the Admin console on http://localhost:4848 and everything looks fine and dandy.
Solution or at least the solution I found:
I seem to have a wierd setup where I mapped localhost to a MS Loopback Adaptor address, however when you ping this in cmd you still get the IP loopback address of 127.0.0.1. I came to the conclusion that the server is taking the 127.0.0.1 IP and netbeans is resolving it to the MS Loopback address, so I change my host file c:\windows\system32\drivers\etc\hosts so that localhost is mapped back to the 127.0.01 IP loopback address. Hey presto it now seems to work fine.
Wednesday, 11 March 2009
Manually undeploying a Service Assembly in ServiceMix
Adding this entry mainly as a reference for myself.
The issue is that there is a a maven jbi plug-in deploy job but not an undeploy job which from a configuration management point of view is plain stupid. Anyway if you have a maven service mix project that you've deployed the service assembly using the maven command:
mvn jbi:projectDeployThen you're going to have fun undeploying it as apparently there is no undeploy task see http://www.nabble.com/How-to-undeploy-a-SA-in-serviceMix-td16736845.html or http://markmail.org/message/67pysr5olbq6wazt this can be done in ant (great another technology to use !) or manually by doing:
- Stop ServiceMix
- Go to
/data/smx/serviceassemblies & delete the service assembly folder - Restart ServiceMix
To do this in ant you use the command:
ant -f servicemix-ant-task.xml -Dsm.username=smx -Dsm.password=smx -Dsm.service.assembly.name=NAME_OF_THE_SA undeploy-service-assembly
Update:
Instead of using
mvn jbi:projectDeploy -DforceUpdate=true
Clear ServiceMix by stopping ServiceMix, deleting everything in the /data and restarting. Then just copy the jar from the /target/.jar to the /hotdeploy directory.
Appatently the force update redeploy's artifacts that don't need to be redeployed, see http://cwiki.apache.org/SM/discussion-forums.html#nabble-p21474293
Subscribe to:
Posts (Atom)