All posts by Ralf Schäftlein

Upgrading VMWare Server 1.0.6 to 2.0 beta 2

Seems to be an easy step to upgrade my local vmware server to the current version. VMWare server 2 changed the administration tool to a web interface like the one from the GSX or ESX server. First step is to uninstall the old vmware server and reboot. The download took a bit longer then before. Nearly 600mb comparing to 150mb for a 1.0.7 server install package for windows. You can change the ports of the administration web interface during installation. I leave this settings to default but changed that the server will not automatically started during windows boot. In the next screen is the possibility to change the default folder of vmware for images. I changed this to my existing folder of vmware server 1.0.6. Like before you have after installation a shortcut to the vmware server in the quicklaunch and on the desktop.

Firefox was a really a pain in the ass as browser for the web interface of beta 1 of vmware server 2. The download page now mention for Beta 2:

Firefox 3 as a supported browser for the management interface.

The icon open https://<hostname>:8333/ui/ as default url. Firefox 3 complains that the ssl certificate is self signed. You must click the link at the bottom to “add the exception” and the “add exception” button. The upcoming dialog request to get the certificate and let you after this download “confirm the security exception”.

Now the login screens ask for the credentials. Good question. The old native admin tool simply ask to login locally without any credentials. During installation where no user created or asked to define. Vmware use the local user database of windows as authentication provider. So define a new local user with admin rights or use a existing one to login.

My main vm image is a ubuntu server 8.04 with just a text console. Vmware use own linux modules for fast networking, folder sharing,… So i tried to upgrade my existing vmware-tools. Just start the vm and click the link to “install vmware tools”. It connects the virtual cdrom to readonly device with the install packages. Enter “mount /dev/cdrom /mnt/cdrom” inside the vm to copy install package to the tmp folder. You have to copy the *.tar.gz install package because ubuntu doesn’t work with RPMs like OpenSuse. The extracted folder contains the vmware-tools-install.pl script. Starting the install as root with ./vmware-tools-instal.pl or sudo ./vmware-tools-install.pl produce a error. VMware tools recognise the old kernel modules and stop the installation. The error message prints the name of the modules like vmxnet. So use “modprobe -v vmxnet” to get the path to the *.ko file. Delete it with rm and do this for all mentioned modules. Delete afterwards the old vmware settings by calling “rm -rf /etc/vmware*”. Now you can call the vmware-tools-install script to install successfully the kernel modules. Reboot the vm to use the new modules. Now you can see in the web interface e.g. the ip of the running vm.

Damn Small Screen

I switched recently on my home server from OpenSuse 10.3 to Ubuntu Hardy Heron 8.0.4. Main reason was the package management with zypper as backend. Each Distro use several Software Repositories with RPMs where you can search for new software to install on your machine. Normally between four to eight repo’s are configured independent which distro you use. OpenSuse become more and more a pain in my ass. Main reason was the more and more increasing time which yast needs to show me the available software packages. For a test drive is VMWare Server really nice. Just setup a new VM, install a distro inside and see if it fits your needs.

Under Ubuntu you must first decide if you want the desktop or server edition. On my notebook was the primary requirement to have a back end for application server like Archiva or Nexus. Both very comfortable maven proxies with a web frontend. So i decided to install the server edition. The server edition have no window manager and starts a linux just with a console login. So far so good. A little bit hidden is the possibility to change the default screen solution from 800×600 to a larger one. Scrolling log or config files is not that pretty under such conditions.

The solution is in the /etc/grub/menu.1st file. In the end of the file is a list of linux versions. Each runnable linux configuration has a title, root, kernel and initrd line. For a 1024×768 you can append to the kernel line

vga=0x317

according to this howto. Ubuntu has in the last weeks published a new service pack called 8.04.1. Normal updated are installed with a “apt-get update” followed by “apt-get upgrade” to install updates for installed packages. I saw messages about retained packages after the availibity of this new service pack. A “apt-get dist-upgrade” forces to install the retained packages including a new kernel. Remember the line with the kernel paramater in the grub menu file. The update updates this file as well. Grateful it notice my changes and ask me what to do. My first intention was to say ok overwrite my changes and i add that vga parameter as well. That works but it can be handled much smarter. Linux kernel updates can be happen more often.

The solution is to add the vga parameter to defoptions line instead of the kernel line. This line is normally uncommented with a leading # character. So add this line

defoptions=vga=0x317

This 0x317 is the hex definition. Also possible is to write vga=719 with decimal notation.

dbunit and null values

For testing database based applications with more or less fixed schema dbunit is nice for creating test data. There are several ways of defining the data in xml and loading it into the db. With the FlatXmlDataSet it looks like

The first row defines the schema for dbunit with this format. When you have self referencing data with columns linked to the pk column it gets more complicated. Think of a growing company with locations all over the world. The hq will be the primary location and all other belong to their regional hq which belongs to the global hq. In the table is a column parent_location as fk to the id column. So the global hq has no parent and all other rows have parents. With the above sample data all rows has null as value in the parent column. DBUnit’s FlatXmlDataSet ignores all other column data in subsequential rows if they are not mentioned in the first row of a table. To avoid this behavior you must provide a dtd inline or external to define the columns:




]>

  
  
  

Now the first row has a null parent value and all others the value defined in the XML file.

plugins disappear…

Eclipse 3.3 runs with Java 1.4 but recommended is Java 5. Every customer is different for us. Not every time is Java 5 or the current Java 6 the JRE for development / production. These technical requirements are not fix for all time. So i adjust my laptop settings when i start to work for a new customer. Under Windows is the PATH environment variable responsible to define which JRE is executed when you run a java application like the eclipse ide or ANT. It contains the bin folder of the JDK/JRE. If not defined then the java.exe in %SYTEMROOT%\system32 (e.g. C:\windows\system32) check the windows registry:

HKEY_LOCAL_MACHINE\Software\JavaSoft\Java Runtime Environment -> CurrentVersion (e.g. value 1.6)

For a quick check i open a dos shell via entering “cmd” in the execute textfield of windows and type “java -version”:

java version “1.4.2_16”

Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.2_16-b05)

Java HotSpot(TM) Client VM (build 1.4.2_16-b05, mixed mode)

These recommendation for Java 5 as runtime are valid as well for the plugins. Eclipse plugins define in the META-INF/MANIFEST file which runtime is minimum required:

Bundle-RequiredExecutionEnvironment: J2SE-1.5

The plugin with such a definition will not be activated during start up if the workbench jre does not fit the requirement. So far so good. I start a new workspace. Changed the workspace path to a new folder during startup. Eclipse looks ok on the first look but after a while you miss some functions. Lucky if some error dialogs pops up. You see normally only in the error log exception stacktraces containing lines with

java.lang.UnsupportedClassVersionError: …

The good thing is that eclipse can be configured to work in such conditions. Eclipse has command line arguments to define the workbench jre. So you have under windows to create a new link on the desktop to the eclipse.exe. Under options of this link is the full path to the eclipse.exe. Just add after a white space e.g. the following corresponding to your environment and paths:

-vm C:\java\jdk1.6\bin\javaw.exe -vmargs -XX:MaxPermSize=128m -XX:PermSize=128m -Xmx768M -Xms768M -Dsun.lang.ClassLoader.allowArraySyntax=true

This defines the workbench vm (-vm), vm arguments (-vmargs) like memory settings (-XX…) and a system property (-Dkey=value) e.g. to work properly with the bea plugin.

With these changed settings eclipse can start all plugins as expected. Functions, perspectives,.. formerly hidden appear in the workbench. No Magic but a little bit more messages in the ide would be nice for users… In the preferences of eclipse can under Java -> Installed JRE the default JRE be defined. Each project can define under project properties -> Java compiler -> compiler compliance level e.g. 1.4. So run ant inside a dos box to compile with java 1.4 (as defined for windows), start eclipse with java 6 and compile the project inside eclipse with 1.4. Very flexible but you need to know where to put the screw driver on.

apache cxf 2.1 with spring 2, maven 2 and eclipse wtp

Apache CXF 2.1 is released. I know XFire since a long time as web service provider. CXF is a merger of XFire with celtix, which provided an enterprise service bus. The main reason for choosing XFire rather then Axis was the WS-I BP compatibility. It’s a better arguing with a commercial eai provider when your webservice is at least WS-I BP 1.0 conform. CXF is JAX-WS 2.1 compatible. You can enable Pojo services with standard annotations as web services. To try that new release out i created with eclipse web tools platform a new dynamic web project with tomcat 6 as web container. First step is to add the libs needed for CXF. Normally i would download by myself the libs and copy it in to Web-inf/lib folder. Disk space is not a problem but you can’t share such projects by mail because of the size needed for the libs. So i use maven 2 to define the needed libs. The pom.xml define the project and its dependencies. Place it in the root of the project:



	4.0.0
	de.schaeftlein.dev
	cxf-sample
	war
	
	
	0.0.1-SNAPSHOT
	
	
	
		
			org.apache.cxf
			cxf-rt-core
			2.1
		
		
			org.apache.cxf
			cxf-rt-frontend-simple
			2.1
		
		
			org.apache.cxf
			cxf-rt-frontend-jaxws
			2.1
		
		
			org.apache.cxf
			cxf-rt-databinding-aegis
			2.1
		
		
			org.apache.cxf
			cxf-rt-transports-local
			2.1
		
		
			org.apache.cxf
			cxf-rt-transports-http
			2.1
		
		
			org.apache.cxf
			cxf-rt-transports-http-jetty
			2.1
		
		
			org.apache.cxf
			cxf-rt-transports-jms
			2.1
		
		
			org.apache.cxf
			cxf-rt-management
			2.1
		
		
			org.apache.cxf
			cxf-common-utilities
			2.1
		
		
			org.mortbay.jetty
			jetty
			6.1.6
		
		
			junit
			junit
			3.8.2
			test
		
		
			org.springframework
			spring
			2.0.8
		
	
	
		
			
				maven-compiler-plugin
				
					1.6
					1.6
				
			
		
		war:install
	


So the libs are defined but nothing happened in eclipse. I use the M2 Eclipse plugin. Now i enable maven with right click on the project and choose from M2 the “Enable dependency management” entry. The plugin now download the libs into the local repository for all projects. In the eclipse build path you will find now a new library called “maven dependencies”. Eclipse WTP does not deploy out of the box this library. Inside the project configuration you will find a section called “j2ee module dependencies”. Just click the check box beside the “maven dependencies” library. Now all dependent libs are deployed as well. As controller act the CXFServlet and for spring need a listener to be defined both in the web.xml:



  cxf-sample
	
		contextConfigLocation
		WEB-INF/beans.xml
	

	
		
			org.springframework.web.context.ContextLoaderListener
		
	

	
		CXFServlet
		
			org.apache.cxf.transport.servlet.CXFServlet
		
		1
	

	
		CXFServlet
		/*
	

I use spring as main configuration tool. CXF depends on spring 2.0.8. The beans.xml imports the default cxf settings and defines the HelloWorld service:

The web service has a interface:

package demo.spring;

import javax.jws.WebService;

@WebService
public interface HelloWorld {
    String sayHi(String text);
}

and a implementation:

package demo.spring;

import javax.jws.WebService;

@WebService(endpointInterface = "demo.spring.HelloWorld")
public class HelloWorldImpl implements HelloWorld {

    public String sayHi(String text) {
        return "Hello " + text;
    }
}

If not set up a local server during creation of the project you need to go to the servers tab in eclipse. Define a new server with server type “Tomcat v6.0 Server”. If the adapter does not appear click on the link to “download additional server adapters”. Under “installed runtime” should be a tomcat 6 server. If not you have to add a new runtime. For tomcat 6 i recommend at least java 1.5 as jre. In the last step you can directly add the created project for cxf. Spring and CXF use commons logging for logging. So i provide in the classpath a simple log4j.xml to output everything interesting to std out:








	
		
			
		
	
	
		
	
	
		
		
	

Setup and implementation are now done. So i started the server inside eclipse. The console should contains lines from spring configuring cxf. To see a list of deployed web services just open a browser to http://localhost:8080/cxf-sample/services, where cxf-sample is the name of your eclipse project. You should see a list of links to the generated wsdl’s of the defined services. Copy the url to the HelloWorldImplPort in the clipboard. For testing i use the free tool soapui which will be started and installed by webstart. Choose under file the point “new wsdl project”. Give it a name and paste the url from the wsdl. Leave the tack for creating sample requests and choose ok. In the tree you see the project, the service, the operations and a request for each operation. Double Click on the only request for our service. Replace the ? with a value of your own inside the arg0 tag and hit the green run button:


   
   
      
         
         
         John Doe
      
   

You should see a response like that on right side of the request in a new window:


   
      
         Hello John Doe