Archive for category tech

Moving CVS repository

Recently had to move CVS repository to a new server, while I’m no CVS expert but in the land of the blind! Yadda, yadda, yadda… so down to me. A couple of googles later and with a sesnse of impending soom I did the following:

1. Stop the CVS service and Lock Service

2. Copy CVS Repo folder(s) to the new server

3. Install CVS on the new server – did full installation

4. Replicate the settings of the old server.

5. Add the folder as Repo location

I was able to add the repo location ok, but couldn’t connect :( and when I tried adding a new folder to the repo I got the following error:

cvs init: connect to 127.0.0.1(127.0.0.1):2403 failed: No connection could be made because the target machine actively refused it. cvs [init aborted]: Couldn’t connect to lock server

So the server couldn’t connect to it’s own lockserver? Hmm… maybe the LockServer service wasn’t running or firewall interference? I checked both of these but all good. I thought let’s try stopping the lock server service, that worked! which is weird and the error seemed to say wasn’t running. Anywho I tried the telnet command again and got the CVSLock 2.0 Ready message so all seemed ok :)

TIP: When on the server, you can check the lock server using telnet try doing a “telnet localhost 2403″ and see what you get.  It should respond with “CVSLock 2.0 Ready” if it’s working properly.

Note: I should say I was moving both new and old server were Windows 2003, the versions of CVSNT were the same and the new server had the same name as the old one.

Tags: , , ,

Useful UML Visio Templates

Stummbled accross these Visio templates quite useful! and free

The UML stencil for Microsoft Visio supports all symbols of the UML 2.2, specified in OMG UML Superstructure Specification, formal/2009-02-02, as well as all previous versions, UML 2.1, UML 2.0, UML 1.5, UML 1.4, UML 1.3 and UML 1.1.

http://www.softwarestencils.com/uml/index.html#Visio2003

Tags: ,

my hero!

my Hero

my Hero

Just a quickie blog post… my new HTC hero arrived today, yay!

Blown away by how within a few minutes of tapping in my google id I fully sync’d was contacts, calender, and email.

It’s my first touch screen and in portrait mode found the tapping a text message a little awkward. Landscape mode is fine.

Got it from Mobile Phones Direct – who supply the phones unlocked. They do some decent deals on 12m contract + free car kit. Plus in white which isn’t  avail on the network i’m on, Nice!

Tags: , , ,

Using Commons-Logging 1.1 with Log4j on WebSphere 6.0

Log4j does seem to work out of the box with Websphere 6 so I cobbled together some tips and advice from the web and wrote this mini guide. It was a couple of years but hopefully be useful to someone.

WebSphere uses commons-logging and so it’s in the root classloader. In addition, WebSphere 6.0 ships a commons-logging.properties with the following properties set:

org.apache.commons.logging.LogFactory=org.apache.commons.logging.impl.LogFactoryImpl

org.apache.commons.logging.Log=org.apache.commons.logging.impl.Jdk14Logger
Therefore by default the application will use JDK logging and not log4j. The solution is to ensure that the right classloader mode is set and the application has an appropriate commons-logging.properties and use the official released version 1.1 of commons-loggin api:

Set application classloader mode as PARENT_LAST. This can be changed in eclispes EAR file deployment descriptor menu. This tells websphere to load the parent files last giving the application files priority. (the parent being the websphere root)

Also, create a new commons-logging.properties to the application classpath with the following entries:

priority=1
org.apache.commons.logging.LogFactory=org.apache.commons.logging.impl.LogFactoryImpl
The priority flag was introduced in Commons Logging 1.1 to allow an ordering based on priority. To ensure that an application’s commons-logging.properties will take precedence over WebSphere’s file, a priority of greater that 0.0 must be set.  I changed mine to 5 (just to be sure ;) ).

So basically the  commons-logging.properties overrides the one packaged in websphere and returns it to the default logging system which is log4j.

NOTE: You also have to replace the commons-logging-api.jar that comes supplied with websphere, because IBM use the API and which doesn’t contain the log4j logger implementation. :(

Replace

<Rational Instal DIR>\Rational\SDP\6.0\runtimes\base_v6\lib\commons-logging-api.jar
With the commons-logging-api.jar downloaded from http://jakarta.apache.org/site/downloads/downloads_commons-logging.cgi

You should also import include it in your go to project properties, java build path and import external jar. Ensure it’s imported above the websphere runtime library otherwise it’ll read the other one first. You can change the order of the imports in project prop > java build path > order and export.

LOG4J Config
To configure log4j you’ll need to create a log4j.propertuies file or a log4j.xml file. This can be located in the application classpath (same level as the ‘com’ directory). Ideally this should be located outside of the EAR/WAR file, where it can be easily editing whilst the application is running without the need to redeploy.

Note: When you build the project both log4j.properties and commons-logging.properties should be copied to the WebContent>Web-Inf>Classes

Checklist:

  • Created commons-logging.properties and log4j.properties in java classpath.
  • Change application classloader mode as PARENT_LAST
  • Import the commons-logging 1.1 jar file
  • Ensure imported jar in imported before Websphere runtime
  • Clean, Build and redeploy (also restart websphere)

More info:
http://wiki.apache.org/jakarta-commons/Logging/FrequentlyAskedQuestions
http://www.webagesolutions.com/knowledgebase/waskb/waskb004/index.html
http://www.mobilefish.com/developer/log4j/log4j_quickguide_examples.html

Book Review – Beginning Java EE 6 Platform with GlassFish 3


Book Review – Beginning Java EE 6 Platform with GlassFish 3: From Novice to Professional

Good for beginners.

This is a ideal book for someone starting Java Enterprise Edition (JEE), but also useful for those who want a brief overview of the ne features. It focuses on the changes in version 6 with examples in Glassfish. It also mentioned some of the significant changes in 5 and gives a good high level overview of the JEE platform in general. It also explains things like persistence layer, and ORM.

I’d recommend it to someone who’s new(ish) to java and whats to see what JEE/J2EE is all about. It’s not good as a reference book (but then it’s not pretending to be one.)

Tags: , ,

Gotta question? ask Stackoverflow.com

I’ve been a avid user of stackoverflow.com since I first heard of it a year or so ago. For the uninitialted it’s a place to ask development and programming related questions. The commuity is good and the idea of offering rep and badges to help others is great. Rep aint a new concept by any means but the way the stackoverflow team have implemented this simple idea is brill.

The new(ish) kid on the block is serverfault.com, which is aimed at sysadmins. A cool thing is you can link and import you profile from stackoverflow.

Also lats time I was on there i noticed the flair widget which allows you to embed your profile pic/rep/badge in any webpage.

Tags: , ,

Setting Proxy for java app

hi, was playing around trying to get a rest API call to work and keep getting connection and timeout issues. Released as I am doing a HTTP request it needed to be routed via the company proxy server, here’s how I set the proxy details.

System.setProperty(”http.proxySet”, “true”);
System.setProperty(”http.proxyHost”, “130.x.x.x”);
System.setProperty(”http.proxyPort”, “80″);
System.setProperty(”http.proxyUser”, “UsernameHere”);
System.setProperty(”http.Password”, “PAsswordHere”);

Note: This was just a proof of concept to test out consuming a rest webservice, I’m not advocating this as the best way to set the proxy details.

Tags: , ,

RTC: Authentication state already initialized

Last week I got the following error message when logging in to our Rational Team Concert server [v1.0.1].

“An internal error occurred during: “Logging into 130.1.xxx.xxx”.
java.lang.IllegalStateException: Authentication state already initialized.”

Snippet from the eclipse log [Workspace\.metadata\.log]
com.ibm.team.repository.client.internal.ServiceInterfaceProxy.invokeServiceCall(Unknown Source)
at com.ibm.team.repository.client.internal.ServiceInterfaceProxy.invoke(Unknown Source)
at $Proxy0.describe(Unknown Source)

This got me thinking about proxy server and proxy auth and figured out the problem is due to proxy server denying access due to incorrect password. The old password was cached in the General>network settings in Eclispe.

This highlighted another issue that the RTC server should be added to the “No Proxy for” list as need to go via proxy for internal network traffic.

Tags: , ,

Client side show/hide in using ibmfaces JSF components

This is a little note about showing and hiding a element(s)/control(s) from a client side event (without page refresh) using the ibm JavaServer Faces components.

The IBM documentation for the hx:behavior tag is here. But it doesn’t contain examples of how to use it and the describtion of the hx:behavior attributes is unclear in places.

behaviorAction is what you want to do (hide, show, invisible, visible etc)
targetAction requires the ID of the object you want to do the behaviorAction on.

<h:outputText style=“visibility:hidden;” id=“text7″ value=“Initially i’m hidden, “></h:outputText>
<h:outputText style=“visibility:hidden;” id=“text17″ value=“As am I! “></h:outputText>

<h:outputText styleClass=“outputText” id=“text6aa” value=“view hidden text,”>
<hx:behavior id=“behavior4″ event=“onclick” behaviorAction=“visible;visible” targetAction=“text7;text17″> </hx:behavior>

</h:outputText>

Also found that when you specify more than one targetAction you must also specify a behaviorAction for each (which is good if you want to do different behaviorActions to each target.

Note: offically hx:behavior tags aren’t supported in h:outputText, recommended to use outputlink tag.

Info from my Ibm devworks question post

Tags: , , ,

change firefox smart bar to default to google.co.uk not .com

I love new smart bar search in firefox 3 but bugged by the fact it defaults to searching google.com, so here’s what I did to make it use google.co.uk

  1. In firefox3 URL/Smart bar type: “about:config” [this brings up the adv config of firefox, don't cha know, click ok to void warrenty ;) ]
  2. Use the filter to find the property called “keyword.URL”, and change the google domain suffix from .com to co.uk, hey presto!

    keyword.URL=http://www.google.co.uk/search?ie=UTF-8&oe=UTF-8&sourceid=navclient&gfns=1&q=

all done!

Tags: , ,