I'm experiencing an issue with running a WebSphere Liberty server from within Eclipse. I'm using Eclipse 2019-09 R (4.13.0), WAS Liberty with Java EE 8 Web Profile (V19.0.0.11), and WebSphere Liberty Server Liberty Tools Eclipse plugin (19.0.900.v20190912_1541). I'm intending to run a Maven web project on the above Liberty server, to no avail.
I downloaded the Liberty runtime to a directory and configured a server within Eclipse to use this runtime. I then added the web project as a resource to the server. The server seems to start up fine, however, when trying to access a resource, I see several java.lang.NoClassDefFoundError
exceptions. When using the WebSphere Liberty Server Liberty Tools plugin, instead of publishing the WAR file to the Liberty server, it simply publishes an XML file pointing to the resources and the dependencies that would make up the WAR file. The XML is in the usr/servers/<server_name>/apps
directory and has a name like app-name.war.xml
. The contents of the XML file are pretty sparse:
<?xml version="1.0" encoding="UTF-8"?>
<archive>
<dir sourceOnDisk="/path/to/web/project/WebContent" targetInArchive="/"/>
<dir sourceOnDisk="/path/to/web/project/target/classes" targetInArchive="/WEB-INF/classes"/>
<dir sourceOnDisk="/path/to/web/project/target/test-classes" targetInArchive="/WEB-INF/classes"/>
</archive>
It seems pretty obvious looking at the above why the server is throwing exceptions because it can't find all any resources. Previous, older versions of Eclipse, the plugin, and Liberty were configured the same way, but the war.xml
file contained a reference to all the dependencies:
<?xml version="1.0" encoding="UTF-8"?>
<archive>
<archive targetInArchive="/WEB-INF/lib/lib1.jar">
<dir sourceOnDisk="/path/to/workspace/lib1/target/classes" targetInArchive="/"/>
</archive>
<archive targetInArchive="/WEB-INF/lib/lib2.jar">
<dir sourceOnDisk="/path/to/workspace/lib2/target/classes" targetInArchive="/"/>
</archive>
...
<dir sourceOnDisk="/path/to/web/project/target/m2e-wtp/web-resources" targetInArchive="/"/>
<dir sourceOnDisk="/path/to/web/project/src/main/webapp" targetInArchive="/"/>
<dir sourceOnDisk="/path/to/web/project/target/classes" targetInArchive="/WEB-INF/classes"/>
<dir sourceOnDisk="/path/to/web/project/src/main/resources" targetInArchive="/WEB-INF/classes"/>
<file sourceOnDisk="~/.m2/repository/some-lib1.jar" targetInArchive="/WEB-INF/lib/some-lib1.jar"/>
<file sourceOnDisk="~/.m2/repository/some-lib2.jar" targetInArchive="/WEB-INF/lib/some-lib2.jar"/>
...
</archive>
Does anyone have any idea as to why in this newer version of Liberty and the Liberty Tools plugin I'm not getting all the dependencies published? Thanks for your help.