Hi,
I also asked this question in the Vaadin forum. I just thought that maybe
another OSGi developer already had the same problems and am therefore
posting this question here too:
I just tried to run a simple Hello World Vaadin app in an OSGi environment
(I don't use Karaf) and ended up with a ClassNotFoundException:
Caused by: java.lang.ClassNotFoundException: de.unia.smds.maf.web.gui.MyUI
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at
org.eclipse.osgi.internal.framework.ContextFinder.loadClass(ContextFinder.java:132)
at java.lang.ClassLoader.loadClass(Unknown Source)
at
com.vaadin.server.ServletPortletHelper.verifyUIClass(ServletPortletHelper.java:72)
My Setup is as follows:
- I'm using BndTools 3.5 in Eclipse Oxygen
- From Maven I get the following dependencies:
<dependency>
<groupId>com.vaadin</groupId>
<artifactId>vaadin-osgi-integration</artifactId>
<version>8.2.1</version>
</dependency>
<dependency>
<groupId>com.vaadin</groupId>
<artifactId>vaadin-server</artifactId>
<version>8.2.1</version>
</dependency>
<dependency>
<groupId>com.vaadin</groupId>
<artifactId>vaadin-themes</artifactId>
<version>8.2.1</version>
</dependency>
<dependency>
<groupId>com.vaadin</groupId>
<artifactId>vaadin-client-compiled</artifactId>
<version>8.2.1</version>
</dependency>
- I created a new Bnd OSGi project and configured my Buildpath like this:
-buildpath: \
org.eclipse.xtend.lib,\
org.eclipse.xtend.lib.macro,\
org.eclipse.xtext.xbase.lib,\
com.google.guava;version=18.0,\
osgi.enroute.base.api,\
com.vaadin.server;version=8.2,\
org.jsoup;version=1.8,\
com.vaadin.external.gentyref;version=1.2,\
com.vaadin.client-compiled;version=8.2,\
com.vaadin.shared;version=8.2,\
com.vaadin.themes;version=8.2
- Then I created the two classes MyUI and MyUIServlet
public class MyUI extends UI {
@Override
protected void init(final VaadinRequest request) {
Label _label = new Label("Hello World");
this.setContent(_label);
}
}
@Component(service = VaadinServlet.class, property = {
(HttpWhiteboardConstants.HTTP_WHITEBOARD_SERVLET_PATTERN + "=/hello") })
@VaadinServletConfiguration(ui = MyUI.class, productionMode = false)
@SuppressWarnings("all")
public class MyUIServlet extends VaadinServlet {
}
When I try to access the UI at http://localhost:8080/hello I receive the
above mentioned exception.
Did anyone had similar problems?
As I am using the official OSGi integration from Vaadin I thought that this
would work out of the box.
Am I missing something here?
Kind regards,
Thomas
_______________________________________________
OSGi Developer Mail List
[email protected]
https://mail.osgi.org/mailman/listinfo/osgi-dev