Vaadin app deployed as OSGI Bundle

Hello Guys,

I’m trying the Vaadin into OSGI Container.
I saw this wiki page that shows how to use osgi module service with Vaadin App: http://vaadin.com/wiki/-/wiki/Main/Creating%20a%20Modular%20Vaadin%20Application%20with%20OSGi

The problem is: My services and Also my VAADIN app (war) is deployed as osgi bundle (using the osgi-http addon on glassfish-v3.1). When I try to start my app I get the error sayin’:

|Requested resource [VAADIN/widgetsets/com.vaadin.terminal.gwt.DefaultWidgetSet/com.vaadin.terminal.gwt.DefaultWidgetSet.nocache.js]
not found from filesystem or through class loader. Add widgetset and/or theme JAR to your classpath or add files to WebContent/VAADIN folder.|#]

|Requested resource [VAADIN/themes/reindeer/styles.css]
not found from filesystem or through class loader. Add widgetset and/or theme JAR to your classpath or add files to WebContent/VAADIN folder.|#]

|Requested resource [VAADIN/themes/reindeer/favicon.ico]
not found from filesystem or through class loader. Add widgetset and/or theme JAR to your classpath or add files to WebContent/VAADIN folder.|#]

It’s seems like the VAADIN is unable to find the those resources while workin’ as OSGI module.
My webservlet is correctly configured as:

@WebServlet(urlPatterns={“/app/", "/VAADIN/”})

So any request to /VAADIN/ should be delivered right way.

Anybody already tried this out? I’m using the snapshot version of vaadin 6.4.
One more thing, It seems the CDI can’t work together with OSGI, tried to get the Application using the @Inject ann (and my App has the @SessionScope ann) but is always null.

Thanks in advance.

Let me explain with more details.

The vaadin JAR (6.4-snapshot) is deployed as OSGI module under felix (embedded on glassfish).
I’ve developed an VAADIN app (WAR) and instead of deploying it like normal web application I want to install as OSGI module.

As the vaadin is already installed as OSGI Module, I don’t have a directly dependency on my WAR to it (compile), I just use the scope provided and a dependency to vaadin service, maybe this is where the problem lives.

The installation process works, I can see on felix:

[ 276]
[Active ]
[ 1]
GIT Web Module (1.0.0.SNAPSHOT)

When I type the URL on the browser I get my window title but nothin’ else is rendered.
After 15s Vaadin display an error message (see attached file).

The follow errors are printed on my server.log file:

[#|2010-07-13T19:08:46.229-0300|SEVERE|glassfish3.1|null|_ThreadID=19;_ThreadName=Thread-2;|Requested resource [VAADIN/themes/reindeer/styles.css]
not found from filesystem or through class loader. Add widgetset and/or theme JAR to your classpath or add files to WebContent/VAADIN folder.|#]

[#|2010-07-13T19:08:46.248-0300|SEVERE|glassfish3.1|null|_ThreadID=19;_ThreadName=Thread-2;|Requested resource [VAADIN/themes/reindeer/favicon.ico]
not found from filesystem or through class loader. Add widgetset and/or theme JAR to your classpath or add files to WebContent/VAADIN folder.|#]

[#|2010-07-13T19:13:58.630-0300|SEVERE|glassfish3.1|null|_ThreadID=19;_ThreadName=Thread-2;|Requested resource [VAADIN/widgetsets/com.vaadin.terminal.gwt.DefaultWidgetSet/com.vaadin.terminal.gwt.DefaultWidgetSet.nocache.js]
not found from filesystem or through class loader. Add widgetset and/or theme JAR to your classpath or add files to WebContent/VAADIN folder.|#]

[#|2010-07-13T19:13:58.636-0300|SEVERE|glassfish3.1|null|_ThreadID=19;_ThreadName=Thread-2;|Requested resource [VAADIN/themes/reindeer/styles.css]
not found from filesystem or through class loader. Add widgetset and/or theme JAR to your classpath or add files to WebContent/VAADIN folder.|#]

[#|2010-07-13T19:13:58.642-0300|SEVERE|glassfish3.1|null|_ThreadID=19;_ThreadName=Thread-2;|Requested resource [VAADIN/themes/reindeer/favicon.ico]
not found from filesystem or through class loader. Add widgetset and/or theme JAR to your classpath or add files to WebContent/VAADIN folder.|#]

Hope anyone can help me.

Thanks.
11346.png

Hi,

Have you read article http://dev.vaadin.com/wiki/Articles/VaadinAndGlassFish3/HelloWorldExample?

-Niko

I found out the problem, thanks Niko.

I’m using the maven-bundle-plugin maven plugin and it only includes ‘import package’ for some vaadin packages, it was missing the ‘required-bundle’ statement that I’ve found on the HelloWorldOSGi example.
The solution is just edit the ‘osgi.bundle’ file (root path on your project) and add the line:

Require-Bundle: com.vaadin

After that your plugin will include this info on the MANIFEST.MF file and everythin’ will run smoothly.

Thanks.