Pouyan Vatanpour
unread,Mar 13, 2012, 12:22:45 AM3/13/12Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to Vaadin OSGi Collaboration
Hi,
I have tried to create OSGI Vaadin bundle and using Felix to run.
Right now I have some issue with missing VAADIN/ recourse
Here is the error:
g! Mar 12, 2012 11:46:48 PM
com.vaadin.terminal.gwt.server.AbstractApplicationServlet
serveStaticResourcesInVAADIN
INFO: 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.
Here is the code:
--------- Servlet -------------------
import javax.annotation.Resource;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServletRequest;
import com.vaadin.Application;
import com.vaadin.terminal.gwt.server.AbstractApplicationServlet;
import com.vaadin.ui.Label;
import com.vaadin.ui.Window;
@SuppressWarnings("restriction")
public class InfoBrokerServlet extends Application {
private static final long serialVersionUID = 1110490906466282279L;
@WebServlet(urlPatterns="/*")
public static class Servlet extends AbstractApplicationServlet {
@Override
protected Class<? extends Application> getApplicationClass() {
return InfoBrokerServlet.class;
}
@Override
protected Application getNewApplication(HttpServletRequest request)
throws ServletException {
return new InfoBrokerServlet();
}
}
@Override
public void init() {
Window mainWindow = new Window("Vaddinsample Application");
Label label = new Label("Hello Vaadin user");
mainWindow.addComponent(label);
setMainWindow(mainWindow);
}
}
-------- Activator------------
package com.hascode.bundle.information_broker_servlet.impl;
import javax.servlet.ServletException;
import org.osgi.framework.BundleActivator;
import org.osgi.framework.BundleContext;
import org.osgi.framework.ServiceReference;
import org.osgi.service.http.HttpService;
import org.osgi.service.http.NamespaceException;
import org.osgi.util.tracker.ServiceTracker;
import
com.hascode.bundle.information_broker_bundle.api.InformationBroker;
import
com.hascode.bundle.information_broker_servlet.impl.InfoBrokerServlet.Servlet;
public class Activator implements BundleActivator {
private ServiceTracker infoSrvTracker;
private ServiceTracker httpSrvTracker;
public void start(BundleContext ctx) throws Exception {
infoSrvTracker = new ServiceTracker(
ctx,
InformationBroker.class.getName(),
null);
httpSrvTracker = new ServiceTracker(ctx,
HttpService.class.getName(),
null) {
public Object addingService(ServiceReference reference) {
HttpService httpService = (HttpService)
super.addingService(reference);
try {
httpService.registerServlet("/",new
Servlet(),null, null);
} catch (ServletException e) {
} catch (NamespaceException e) {
}
return httpService;
}
public void removedService(ServiceReference reference,
Object service) {
((HttpService) service).unregister("/");
super.removedService(reference, service);
}
};
infoSrvTracker.open();
httpSrvTracker.open();
}
public void stop(BundleContext ctx) throws Exception {
infoSrvTracker.close();
httpSrvTracker.close();
}
}
===================
I used maven2 ellipse plug-in to create the project. I used to mvn
install to create jar/bundle file and then I install it on Felix
"install file:/..."
As you see I used annotation instead of having web.xml. My question
is, Is there anyway to define WebContent/VAADIN/ directory into
bundle?
Any help will be deeply appreciated .
Thanks
Pouyan