Packaging WAR without vaadin.jar

Hello, I have a question concerning packaging Vaadins application…
I use actually Jboss server, and I create a few (small) test applications that work perfectly :smiley:

So, let’s consider I created a lot of vaadin applications (more than 10), so I have as many wars, each containing themes and the vaadin jar.

So to optimize this, I would like to put the vaadin.jar outside the wars, and the same for the themes (I would like to have only one theme, shared by all vaadin’s app).

What kind of settings should I put in my vaadin-webApps (Web.xml I suppose) to make it work correclty ?

Would you agree with this way of deploying, or do you see any further problems that can arise consequently ?

Thanks !

I believe there is no such setting. Application servers just use custom class loaders. If those class loaders can see Vaadin, then they should be able to execute application without problem.
Every server has something like lib directory, try coping vaadin.jar there and see what happens.

Good luck

Some Web containers (notably Resin) allow you to specify the classpath in a more flexible way, such that you don’t need to replicate libraries in each war. But that is not a standard feature, and I don’t know about JBoss. Typically that is done in a separate server-specific file that complements web.xml (e.g. resin-web.xml ou weblogic.xml)

Thanks for these precisions.

In fact it seems that Jboss wants that the vaadin library to be loaded by the same class loader as the ‘local’ application classes.

It means that when I put vaadin in the lib directory of my Jboss, I get a message like : “can’t find application class…”
So I needeed to extract the classes of my application to put them also aside of the webApp…

So finally I have :

  • the vaadin.jar in the lib directory of my server
  • all my application classes, put in a jar, in the deploy folder of my jboss (the root folder)
  • my .war, which contains indeed only the web.xml (!)

With this settings it is ok !

The only remaining ‘problem’ for me is the Themes. Because I would like to use a theme (custom or not) in a static way. But ‘most of all’, I would like to share it between my differents VAADIN applications deployed on this server.

Is this possible ? Apparently Vaadin try to load the theme from the
webApp, but is there any parameter/seeting to give to the vaadin servlet that can tell it to search for the theme in a different webApp than its own?

Thanks !

Just for those who could be interested in : The classloader configuration is the right solution to have the VAADIN jar outside your webApp.

So now I have my classes in my webApp (which is better) and the Vaadin jar in my lib directory and everything works fine. :smiley:

So my last problem is the ‘theme sharing’.
Apparently no one seems interested in this possibility :sleep:

But when I look on the liferay portlet chapter, I can see that the theme can be deployed on the root of the tomcat server.
In fact, that’s exactly what I would like to do (to have the them deployed at one place on my server, to avoid having to replicate it among all of my applications…)

So, still no idea…?

By default, Vaadin creates a HTML page that loads the theme CSS, WidgetSet, … If you want to, you can replace this HTML by your own index.html and set the paths for loading CSS, images, WidgetSet to be almost anything. This way you could share all the client-side resources between your applications.

One way to create a custom HTML is to just cut-n-paste Vaadin generated HTML (browser, show HTML source). To see a simplified example, look at multiapp.html in Vaadin package.

Ok thanks

I’m going to try this :smiley: