User Tools

Site Tools


vaadin_7_osgi_web_application

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
vaadin_7_osgi_web_application [2014/10/30 16:04]
mihael
vaadin_7_osgi_web_application [2015/04/29 13:37] (current)
mihael
Line 1: Line 1:
 ====== Vaadin 7 OSGi Web Application ====== ====== Vaadin 7 OSGi Web Application ======
  
-  Note: This was tested with the latest ​Vaadin ​release (7.3.3).+<​note>​ 
 +This was tested with Vaadin 7.3.3. ​This guide cannot be used exactly as it is for Vaadin 7.4. See [[vaadin_7.4_osgi_web_application|Vaadin 7.4 OSGi Web Application]] for a using Vaadin 7.4. 
 +</​note>​
  
 [[http://​vaadin.com | Vaadin 7]] is a Servlet based Java web framework. And as most OSGi container support Servlet based web applications very well this should be a match made in heaven. But their are some minor things one will stumble upon when trying to run a Vaadin application inside an OSGi container. One of those things is always the classpath. [[http://​vaadin.com | Vaadin 7]] is a Servlet based Java web framework. And as most OSGi container support Servlet based web applications very well this should be a match made in heaven. But their are some minor things one will stumble upon when trying to run a Vaadin application inside an OSGi container. One of those things is always the classpath.
Line 27: Line 29:
  
   hg clone http://​hg.code.sf.net/​u/​fist/​test.vaadin7 test.vaadin7   hg clone http://​hg.code.sf.net/​u/​fist/​test.vaadin7 test.vaadin7
- 
-<note warning>​Not updated yet!</​note>​ 
  
 === VaadinServlet === === VaadinServlet ===
Line 146: Line 146:
 </​sxh>​ </​sxh>​
  
 +==== vaadinbootstrap.js ====
 +The file //​vaadinbootstrap.js//​ is located in the //​vaadin-server//​ jar in the folder //VAADIN//. The file should be copied from the vaadin-server jar to the folder ''​src/​main/​webapp/​VAADIN/''​.
 +
 +==== Classpath ====
 +Vaadin expects some things to be on the classpath of the application,​ like themes and compiled resources. To get this working in a simple way is to include these in the war (see Embed-Dependency in pom.xml) and add them to the Bundle-ClassPath entry in the manifest file.
 +
 +  Bundle-ClassPath:​ .,​WEB-INF/​classes/,​WEB-INF/​lib/​vaadin-themes-7.3.3.jar,​WEB-INF/​lib/​vaadin-client-compiled-7.3.3.jar
 +  ​
 ===== Building ===== ===== Building =====
 Building the web application bundle with maven is no more than doing a  Building the web application bundle with maven is no more than doing a 
Line 151: Line 159:
   mvn clean package   mvn clean package
  
-The target folder ​should contain ​the bundle (war) file. +The "target" ​folder ​contains ​the bundle (war) file. 
  
 ===== Deployment ===== ===== Deployment =====
Line 200: Line 208:
  
 === Installing Demo === === Installing Demo ===
-Just copy the test.vaadin-x.x.x.war to the deploy folder ​are you are done. The web application is available under the path which is specified in the manifest with the //​Web-ContextPath//,​ in this example ''/​test.vaadin7''​.+Just copy the test.vaadin-x.x.x.war to the deploy folder ​and you are done. The web application is available under the path which is specified in the manifest with the //​Web-ContextPath//,​ in this example ''/​test.vaadin7''​.
  
 So point the browser to ''​http://​localhost:​8181/​test.vaadin7''​. So point the browser to ''​http://​localhost:​8181/​test.vaadin7''​.
Line 213: Line 221:
  
  
 +===== Stylesheet Compiling =====
 +If a CSS style is used or one of the predefined styles then everything is alright and should work. But if you are using your own style (or extending an existing one) than normally Vaadin would compile it on the fly during the first call of the servlet. But that ends in a nice error message.
 +
 +  java.lang.NoClassDefFoundError:​ com/​vaadin/​sass/​internal/​ScssStylesheet
 +  ​
 +But the Book of Vaadin explains nicely how to compile the stylesheet before the deployment.
 +
 +For myself the easiest way was to manually compile it with the following command
 +
 +  java -cp "/​my/​path/​to/​vaadin-all-7.3.3/​lib/​*":"/​my/​path/​to/​vaadin-all-7.3.3/​*"​ com.vaadin.sass.SassCompiler styles.scss styles.css
 +
 +  ​
 ===== Open Questions ===== ===== Open Questions =====
 The Vaadin Push support has been tested in this setup. It may need some additional classes which has to be available on the bundle classpath. The Vaadin Push support has been tested in this setup. It may need some additional classes which has to be available on the bundle classpath.
vaadin_7_osgi_web_application.1414685054.txt.gz · Last modified: 2014/10/30 16:04 by mihael