Failed to run sample project with EAR package

Hi,

I downloaded the simple sample project (a clicking button) from Project Base to try. However, I changed the package method from war to ear. The package structure looks like:

root
|-lib(including all the libraries needed, including polymer-2.6.0)
|-META-INF(including application.xml)
|-sampleejb.jar(dummy ejb classes)
|-sample.war(downloaded files are listsed here)

However, when running on server, the browser came up with blank. I checked Chrome debug console, and it said the the polymer resources could not be found at the designated path. I am wondering how the polymer path should be defined in template html with such ear package structure.

Best regards,
Joey

Hi,

Further on this issue, I found that if artifacts of vaadin-core and polymer were put under WEB-INF/lib and deployed war only, then it went well. But if those artifacts were put under EAR-level lib directory and deployed ear, then resourceslike polymer, vaadin-button, vaadin-ordered-layout could not get loaded. I am wondering how the libraries should be deployed if we still need EAR deployment.

Best regards,
Joey

Hi.

Have you tried having the application in production mode in the ear package?
Then the content to be served would not be gotten from the jars, but served from the
bundle file.

All files are requested through the ServletContext of the servlet container, so if it can
get the files then so should flow.

Also I have a feeling that the bundle file for a production build should be located in
the directory META-INF/resources

I’ll try to look into this next week.

  • Mikael

Hi, Mikael,

Thanks a lot for your comments. Further investigations of checking Chrome debug tool showed different run-time source structures on different deployment. When running on EAR deployment, the run-time structure looks like:

localhsot:8080
|-mycontextroot
   |--frontend
       |---src
	        |---(files)
	   |---styles
	        |---(files)
	    (index)

When running on war deployment only, the run-time structure looks like:

localhost:8080
|-mycontextroot
   |---VAADIN/static/client
        |---(files)
   |---frontend
        |---bower_components
		    |---(files)
		|---src
		    |---(files)
		|---styles
		    |---(files)

It seems that when deployed on EAR configurations, the sources could not get right. I have no ideas how to correct it. Your help would be greatly appreciated.

Best regards,
Joey

Hi.

I got the ear to deploy and run with the following setup. I tested it using docker and the jboss/wildfly image with version 13.0.0.Final (or latest)

Hope this helps with getting a project up and running.

Running it in docker makes the application available at http://localhost:8080/flow-ear-web/

$ docker build -t wildfly .
$ docker run -p 8080:8080 -p 9990:9990 -t wildfly

– Mikael
17138434.zip (10.3 KB)

Hi,

Your sample is quite helpful. However, the deployment structure is somewhat different from what we required. Within the final ear package, you put the library jars under web module’s WEB-INF/lib. However, what we need is to put the library jars under ear-level lib, because our ejb package might also need to refer to the libraries. Attached you’ll find my sources. Kindly advise how we can handle this.

Best regards,
Joey

Sorry not attaching files.

Best regards,
Joey
17142243.zip (23.1 KB)

You shouldn’t use frontend dependecies from the enterprise beans package.

It should be possible to have the war as a skinny war by adding <skinnyWars>true</skinnyWars> to the ear-plugin configuration and have for instance a jar package that is added to the ear containing the dependencies.

    <artifactId>flow-ear-jar</artifactId>
    <packaging>jar</packaging>
    <name>Flow-ear - jar</name>

and then have the jar as provided in the war

        <dependency>
            <groupId>com.vaadin</groupId>
            <artifactId>flow-ear-jar</artifactId>
            <scope>provided</scope>
        </dependency>

and as a dependency in the EAR.

This requires that the application server gives access to the lib jars to the war package.
I only get a Forbidden response from wildfly with that kind of setup.

I need to refer to classes of flow-server and flow-data within my ejb-module. That’s why I put vaadin-core under ear-level lib directory. I tried your suggestion in several ways, but I still failed to get it run on WildFly. I am not sure whether I get your idea right. I also tries to separate the vaadin jars into two different parts, one which I need for ejb-module was put under ear-level lib, one was put under WEB-INF/lib. However, that approach still won’t work.

Best regards,
Joey

I couldn’t get it to work either. I would suggest running as a fat war and having the ejb module depend on the war dependencies if possible.
Ideally anything not in the war should only have the need of the data package. Any other and the structure of the app should most likely be rethought.

  • Mikael