Websphere liberty profile 16.0.0.4 deployment issue (ZipException) - websphere-liberty

We are using Websphere liberty profile 16.0.0.4 to deploy EAR application.
Nothing jee specific. the EAR has a simple WAR file. We put the EAR file inside
the dropins folder and it seems like websphere is extracting the content of EAR
file inside the workarea directory.
When reading the content of one jar sqljdbc.jar it puts the jar inside cache
folder. However the sqljdbc.jar seems to be a 0 sized file.
Here is a sample path to the sqljdbc.jar. All of them are directories
D:\comdata\wlp\usr\servers\defaultServer\workarea\org.eclipse.osgi\121\data\cach
e\com.ibm.ws.app.manager_88\Tax2290.war\WEB-INF\lib\.cache\sqljdbc.jar
The sqljdbc.jar inside sqljdbc.jar folder above turns out to be 0 byte sized.
Because of this ZipException is thrown.
There is also this exception thrown before the ZipException. I am not sure if
it is related to this or not.
java.lang.ClassNotFoundException: iconnectlogout
com.ibm.ws.jaxrs20.server.component.JaxRsWebModuleInfoBuilder
What are these org.eclipse.osgi, cache, com.ibm.ws.app.manager_88 folders.
We checked the WAR file inside EAR and it has the right sized sqljdbc.jar.
any ideas why this is happening? Is anything getting downloaded from internet?
Proxy / firewall issues.
First Edit:
-----------
Uploaded the problematic ear file.
Here is link to problematic ear file
https://wetransfer.com/downloads/3585882e88626f6e5a480075fba0c48e20170118170610/43e43f

The sqljdbc.jar file in the Tax2290.war's WEB-INF/lib directory contains an embedded JAR file with the same name - and that embedded sqljdbc.jar file is 0 length - with another another file, sqljdbc.jar.old, that seems like a valid archive. It is this embedded JAR file that Liberty is choking on.
You should be able to resolve the problem by removing that 0 length JAR file from the sqljdbc.jar -- or by replacing it with a valid JAR.
That said, Liberty should probably provide a better error message or be able to handle this case better, so I would suggest opening a PMR with IBM support to have this addressed.
Thanks, Andy

Related

Deploy a embedded Jetty&Jersey war to jetty9,only can see static file?

I cteate a jetty&jersey embedded project with IDEA and Maven,I put it in Github https://github.com/Mengqi777/JettyProject. Run JettyServerStart.java start the server, in the browser address bar enter localhost:8080/dynamic, show OK, enter localhost:8080/static, show static resource file
Now I package it to a war file,and put it in jetty webapps directory. But only can see static file in brower with enter localhost:8080/static.404 Not Found Error when in brower with enter localhost:8080/dynamic
What happend?
What should I do to package this project into a war file or jar file and run it in jetty successfully?
You are doing things in your embedded-jetty usage in JettyServerStart.java that you do not declare/configure in your webapp or war file.
It's a maven project, but not declared as a webapp or war project (in the pom.xml)
Its doesn't have its WEB-INF in the right place (maven directory structure wise), which means your built war file is invalid.
The dependencies are not declared correctly for a webapp or war project (you cannot include jetty-server in a war file)
Your badly located WEB-INF/web.xml does not perform the same configuration steps as your JettyServerStart.java
You don't specify how you created your ${jetty.base} directory to support this war file?
You didn't specify what version of jetty-distribution or jetty-home you downloaded, or are attempting to work with.
The statement "and put it in jetty webapps directory" is unclear, which one? (using jetty-distribution/webapps is invalid and will cause many errors and warnings if you attempt to use it for your own webapps, there's no jetty-home/webapps, and you didn't identify your jetty-base configuration)
The way your project is declared right now, even if manually assembled, skipping maven entirely, you have no servlets, no filters, no listeners, no intializers, only a servlet spec mandated DefaultServlet on url-pattern / giving you static content. That's why accessing http://localhost:8080/static/ works, but nothing else.

What is an exploded EAR?

Can someone please explain what's an exploded EAR ? I checked in google but couldn't find a clear answer.
Is it a different format?
What's the difference to a non exploded EAR?
A compressed EAR file, with extension .ear is just a ZIP file containing the directory structure of a JEE project. It is normally used in order to deploy a JEE project.
An exploded EAR file is just the uncompressed content of the above.
Incidentally speaking, war and jar files are also compressed in ZIP format.
The use of the wording "Exploding" instead of "decompressing" a ZIP file seems to be traditional in the java community, and is present in official documentation.
E.g.: www.java2s.com/Code/Java/File-Input-Output/classforexplodingjarzipfilesontothefilesystem.htm (on a IBM contributed source file belonging to Eclipse ).
They can be exploded with the jar command.
You can also use any compression utility, provided you keep the directory structure intact.
e.g.:
jar xvd /myapp_path/myapp.ear

Maven - erroneous weblogic classpath

On my Oracle weblogic 12 installation I have deployed an .ear (built with maven). All is OK except when I go to wls-cat and check Classloader Tree I get entries such as:
D:\Oracle\Middleware\Oracle_Home\user_projects\domains\liferayportal\servers\AdminServer\tmp\_WL_user\mywebapp\nsio4q\APP-INF\lib\lib\antlr-2.7.6.jar
and
D:\Oracle\Middleware\Oracle_Home\user_projects\domains\liferayportal\servers\AdminServer\tmp\_WL_user\mywebapp\5ohvco\war\WEB-INF\lib\..\..\lib\
I have no \lib\lib folder and neither do \lib...\...\lib
What can be the cause? What should I check in my POMs? Thank you.
This is not related to your pom.xml
WLS expands the war file, but copy the files in different places, therefor It doesn't recreate a directory structure (ie: OC4J does it).
Therefore, WLS-CAT is telling where (psychically) is retrieving a particular class (from antlr jar file in your case).

ibm-application-bnd.xml overwritten

I work on an existing Maven project with Eclipse Luna and WebSphere 8.5.5.1.
The source of the ibm-application-bnd.xml is:
D:\projects\svn\application\ear\src\main\application\META-INF\ibm-application-bnd.xml
Once a day, at a random moment, the application folder itself is overwritten with the ear-file, so the \main folder contains a binary file named application and is actually the ear file because I openend the file because I saw it had the same size as the ear (8 MB).:
D:\projects\svn\application\ear\src\main\application
The happens at least once a day, and I have the impression that Eclipse, or JRebel of WebSphere creates this file.
The result is that I have to quit Eclipse, delete the file and update from SVN to get the application folder with the binding xml back.
Any thought how to fix this?
Easy way you could stop the folder from being deleted (and perhaps also find the culprit) is to open command prompt in that directory - it won't allow the folder to be removed in that case.

TOMCAT 7 not deploying war

I have developed a Dynamic Java Project with Eclipse which involves web services(RESTful). After completion I tried to run my project Tomcat 7 runtime of Eclipse IDE, it works fine. I am able to access all my web services.
But, when I created a WAR file out of my project by right-clicking on project and exporting it to WAR file and placed .war file in Tomcat 7's webapps folder. Started the tomcat by running startup.bat, it throws below exceptions and I am not able t access any web service:
I have placed all the required jar files in lib folder of Tomcat.
Exception fixing docBase for context [/Books] (Books is my war file name)
Failed to create work directory [{CATALINA_HOME}\work\Catalina\localhost\Books]
Failed to create destination directory to copy resources.
Could anyone please let me know what I am missing??
Thanks in advance.
Regards,
Piyush
The failed to create "work directory" error can occur if the work folder does not exist in the tomcat7 folder.
Also this error can be caused by tomcat not having sufficient permissions to read, write and execute in the tomcat7 directory.
The issue is because, tomcat is not finding your web.xml location in the classpath.
Do below steps:
Right click on web project-->Properties-->Deployment Assembly--> Add your classpath to web.xml(src/main/webapp) in my case.

Resources