Using Vaadin Eclipse Plugin under Win7 x64

  1. Download and extract Eclipse x32
  2. Download and extract jboss 7.1
  3. Download and install Java JDK x32
  4. Open eclipse.ini and set path to jvm.dll

    -vm
    C:/Program Files (x86)/Java/jdk1.7.0_21/jre/bin/server/jvm.dll

  5. Download and install xulrunner from sourceforge
  6. Start Eclipse
  7. Go to help menu -> install new software
  8. Enter “ http://vaadin.com/eclipse” in “work with” field and hit enter
  9. Click checkbox beside vaadin
  10. Click next button to start installation
  11. Restart eclipse
  12. Open server view
  13. Right click and new => server
  14. click on “Download Additional server adapters”
  15. Choose jboss as and install
  16. Restart eclipse
  17. Open server view
  18. Right click and new => server
  19. Choose jboss as 7.1
  20. Hit next
  21. Choose extracted jboss dir from step 2 as home directory
  22. hit finish
  23. In the project explorer hit right mouse menu and choose new project
  24. Choose vaadin 7 project
  25. Enter Project Name and hit finish
  26. Open right mouse menu “add and remove” on the jboss inside server view
  27. add new project with add button and hit finish
  28. start server
  29. right mouse click on the project and choose “run as” => “run on server”
  30. Choose jboss and hit finish
  31. browser will shown with your first vaadin app
  32. hit “click me” button to see if all works

Visual Designer is available if you create a “Vaadin composite” in your project.
Make sure the new file is open in the “vaadin editor”. Switch to the design tab.

Configure logging in Solr

After the base installation of solr under tomcat 7 is now the step to configure seperate logging for solr. Fist step is to create a directory for the log file:

mkdir /var/log/solr
chown tomcat7:adm /var/log/solr

Now delete the following files in the extracted war lib folder (/usr/share/solr/war/WEB-INF/lib)

  • jcl-over-slf4j-1.6.4.jar
  • log4j-over-slf4j-1.6.4 .jar
  • slf4j-api-1.6.4.jar
  • slf4j-jdk14-1.6.4.jar

Copy the following files into this folder

  • slf4j-api-1.6.5.jar
  • slf4j-log4j12-1.6.5.jar
  • log4j-1.2.16.jar

Create a classes folder inside the WEB-INF folder

mkdir /usr/share/solr/war/WEB-INF/classes

Create a log4j.properties in this folder with the following sample content

log4j.rootLogger=WARN, solrLog
log4j.appender.solrLog=org.apache.log4j.DailyRollingFileAppender
log4j.appender.solrLog.File=/var/log/solr/solr.log
log4j.appender.solrLog.Append=true
log4j.appender.solrLog.Encoding=UTF-8
log4j.appender.solrLog.DatePattern=’-‘yyyy-MM-dd
log4j.appender.solrLog.layout=org.apache.log4j.PatternLayout
log4j.appender.solrLog.layout.ConversionPattern=%d [%t] %-5p %c – %m%n
log4j.logger.org.apache.solr=INFO

Change folder and file rights to give the tomcat instance user full access

chown -R tomcat7:adm /usr/share/solr/war

Restart tomcat

service tomcat7 restart

Now you will find a solr.log inside/var/log/solr/

Replacing web.xml with Java based Configuration for Servlet 3.x Webapplications

With the Servlet 3.x API as part of JEE 6 come with the possibility to configure a java web application by writing a java class instead of having a web.xml file inside the WEB-INF folder. My sample apache cxf project has a web.xml with a spring configuration listener and a cxf servlet mapping. I use jetty for integration tests inside maven builds and tomcat as application server for deployment and running the web application. The web service sample use Spring 3.1 and Apache CXF 2.6.2.

I migrated my old web project with just a few steps:

Maven Settings

Step 1: Integrate latest Spring Web API

The Spring 3.1 web project contains the SpringServletContainerInitializer class which will be automatically invoked by a servlet 3.x container:

	
		2.6.2
		3.1.2.RELEASE
	
		
			javax
			javaee-api
			6.0
			provided
		
		
			org.apache.cxf
			cxf-rt-frontend-jaxws
			${cxf.version}
		
		
			org.apache.cxf
			cxf-rt-transports-http
			${cxf.version}
		

		
		
			org.apache.cxf
			cxf-rt-transports-http-jetty
			${cxf.version}
		
		
			org.eclipse.jetty
			jetty-webapp
			8.1.1.v20120215
		
		
			junit
			junit
			4.10
			jar
			compile
		
		
			org.springframework
			spring-test
			${spring.framework.version}
			jar
			compile
		
		
			org.springframework
			spring-core
			${spring.framework.version}
			jar
			compile
		
		
			org.springframework
			spring-beans
			${spring.framework.version}
		
		
			org.springframework
			spring-web
			${spring.framework.version}
		

Step 2: Update build plugin for jetty to use servlet 3.x api

The Jetty 8.x supports Servlet 3.x api to support bootstrapping and java based configurations and is used by the jetty plugin:

			
				org.mortbay.jetty
				jetty-maven-plugin
				8.1.5.v20120716
				
					10
					
						/${project.artifactId}
					
					true
					foo
					9999
					
						
							9090
							60000
						
					
				
				
					
						start-jetty
						pre-integration-test
						
							run
						
						
							0
							true
						
					
					
						stop-jetty
						post-integration-test
						
							stop
						
					
				
			

Step 3: Configure Maven War Plugin to ignore web.xml

The maven war plugin throws otherwise a exception if it does not found the web.xml file:

			
				org.apache.maven.plugins
				maven-war-plugin
				2.2
				
					src/main/webapp
					${project.artifactId}
					false
					
					
						
				
			

 

Java Configuration

Step 4: Write Configuration file

Write a class that implement the WebApplicationInitializer interface from Spring Web and override the onStartup Method. Inside that you have to setup spring application context and map the servlet classes to url patterns:

package demo.spring.cfg;

import javax.servlet.ServletContext;
import javax.servlet.ServletException;
import javax.servlet.ServletRegistration;

import org.apache.cxf.transport.servlet.CXFServlet;
import org.springframework.web.WebApplicationInitializer;
import org.springframework.web.context.ContextLoaderListener;
import org.springframework.web.context.support.XmlWebApplicationContext;

public class WebAppInitializer implements WebApplicationInitializer {

	@Override
	public void onStartup(ServletContext container) throws ServletException {
		XmlWebApplicationContext rootContext = new XmlWebApplicationContext();
		rootContext.setConfigLocations(new String[] { "classpath*:applicationContext.xml" });
		container.addListener(new ContextLoaderListener(rootContext));

		ServletRegistration.Dynamic dispatcher = container.addServlet("CXFServlet", CXFServlet.class);
		dispatcher.addMapping("/*");
	}
}

Step 5: Delete web.xml

Delete inside WEB-INF folder the web.xml file and use the mvn clean command to remove it from target folder.

Step 6: Testing

run mvn package to build the war file in your project. Download and extract tomcat 7.x for testing your war file. Put the war file in the webapps folder and run your server with the startup.bat in the bin folder of tomcat.

Xlib: extension “RANDR” missing on display…

i got in the log of my selenium based integration test against firefox inside a Xvfb server. My first thought was of a missing library but the problem is caused by selenium:

“org.openqa.selenium.firefox.NotConnectedException: Unable to connect to host 127.0.0.1 on port 7055 after 45000 ms. Firefox console output:”

was the line above and i had recently updated firefox on my ubuntu 12.01 server to version 15 by normal updates. The maven dependent selenium plugin version was still the same when i got the error. After updating to the latest version everything works as before:

 

		
			org.seleniumhq.selenium
			selenium-java
			2.24.1
			test
		

Common pitfalls installing Oracle XE 11 under Oracle Linux 6

First thing to check is the hostname inside /etc/hosts to ensure the install process can find the net listener. During the installation of Oracle Linux you set the hostname for example to oracle-vm.localdomain. Open with nano /etc/hosts and keep sure you have a line like this.

127.0.0.1 oracle-vm.localdomain localhost localhost.localdomain localhost4 localhost4.localdomain4

Next thing is to keep sure you have shared memory configured. Enter df -k and see if a line starts with shmfs. If not then enter

mount -t tmpfs shmfs -o size=2048m /dev/shm

and change your fstab to have shared memory available after next boot:

shmfs /dev/shm tmpfs size=2048m 0 0

Oracle XE for Linux is only available for X64 systems. Enter uname -a and see if it ends with

x86_64 x86_64 x86_64 GNU/Linux

If not reinstall your system with the x64 version of your linux distribution.

Keep sure your system is up to date with yum update.

After Download of Oracle Database Express Edition 11g unzip the File to a folder. Install the rpm with

rpm -ivH Disk1/oracle-xe-11.2.0-1.0.x86_64.rpm

and enter

/etc/init.d/oracle-xe configure

Check if the install process outputs ends with

Starting Oracle Net Listener…Done
Configuring database…Done
Starting Oracle Database 11g Express Edition instance…Done
Installation completed successfully.

or the log files under

/u01/app/oracle/product/11.2.0/xe/config/log.

On success you have a icon called “Get started with Oracle… .desktop”. Click on the icon and mark the link as trust worthy. It will open a browser

http://localhost:9000/apex/f?p=4950

If asked for a user name and password use SYSTEM and your chosen password as credentials.

tech stuff, development news…