Classpath issue: Jar file not recognised from EAR in Websphere Liberty Deployment - noclassdeffounderror

I am using Websphere liberty profile network deployment 20.0.6 for deploying my application (EAR) application. Before that my application runs fine in websphere traditional 8.5.5 and 9.0.0. But While deploying the application on liberty (by placing ear file in dropins), I am getting classpath problems. All the required .jar files are present in the .ear but it's unable to detect a class present inside AdminConsole jar(that jar is present in ear file). There are five EJB modules which are dependent on each other and some utility jar files inside ear file. But still I am getting NoClassDefFoundError for AdminConsole and application doesn't start
The details of the error message -
[6/15/21 9:33:37:835 IST] 00000029 com.ibm.ws.logging.internal.impl.IncidentImpl                I FFDC1015I: An FFDC Incident has been created: "java.lang.NoClassDefFoundError: com/iitap/adminconsole/export/ent/service/IEAdminSQLExecutor com.ibm.ws.app.manager.module.internal.SimpleDeployedAppInfoBase 535" at ffdc_21.06.15_09.33.37.0.log
[6/15/21 9:33:37:835 IST] 00000029 om.ibm.ws.app.manager.ear.internal.EARApplicationHandlerImpl E CWWKZ0106E: Could not start web application (ApplicationaName).[6/15/21 9:33:37:835 IST]
00000029 com.ibm.ws.app.manager.AppMessageHelper                      E CWWKZ0002E: An exception occurred while starting the application . The exception message was: java.lang.NoClassDefFoundError: com/iitap/adminconsole/export/ent/service/IEAdminSQLExecutor
If I am copying the .jar files into the Application server's lib, then its working fine for few class but since the application has transitive dependencies the error shifts on another class not found. Even I tried to modify Manifest.MF file but not working.
The structure of ear file is -
Application EAR
|
|_____Jar files
|
|_____WAR file
|
|__META-INF
| |
| |__MANIFEST.MF
|
|__WEB-INF
|
|__lib
|__classes
|__scripts
Is there any classpath I need to set somewhere in websphere libert configuration file so that the server could take it up from there. I would really appreciate your suggestion/information on this issue.

Related

Eclipse | Adding SOAP UI Jar files | Error | "Cannot be read or is not a valid ZIP error" is thrown

Currently am learning SOAPUI API Testing and Automation. When I tried to add the SOAP UI Jar files to working project below error is thrown in the Console section
Screenshot_Error_Image
Description
Resource
Path
Location
Type
Archive for required library: 'C:/Program Files/SmartBear/ReadyAPI-3.30.0/lib/groovy-all-3.0.6.jar' in project 'SoapTesting' cannot be read or is not a valid ZIP file SoapTesting
Soap testing
Build Path
Build path Problem

Unable to deploye ejb3 project on eclipse mars

I am developing an EJB 3.0 application on eclipse mars. I am unable to deploy project on glassfish 4 server. I use JDK 7.
My server log:
cannot Deploy SampleEJBProject
deploy is failing=Error occurred during deployment: Exception while deploying the app [SampleEJBProject] : A MultiException has 2 exceptions. They are:
1. com.sun.enterprise.module.ResolveError: Failed to start OSGiModuleImpl:: Bundle = [org.glassfish.main.web.weld-integration [296]], State = [RESOLVED]
2. java.lang.IllegalStateException: Could not load descriptor SystemDescriptor(
implementation=org.glassfish.weld.WeldContainer
name=org.glassfish.weld.WeldContainer
contracts={org.glassfish.weld.WeldContainer,org.glassfish.api.container.Container}
scope=javax.inject.Singleton
qualifiers={}
descriptorType=CLASS
descriptorVisibility=NORMAL
metadata=Bundle-SymbolicName={org.glassfish.main.web.weld-integration},Bundle-Version={4.1.1}
rank=0
loader=OsgiPopulatorPostProcessor.HK2Loader(OSGiModuleImpl:: Bundle = [org.glassfish.main.web.weld-integration [296]], State = [RESOLVED],377949866)
proxiable=null
proxyForSameScope=null
analysisName=null
id=414
locatorId=0
identityHashCode=2094253683
reified=false)
. Please see server.log for more details.
Please help me.
I am referring this link for developing application
https://www.genuitec.com/products/myeclipse/learning-center/javaee/myeclipse-ejb-3-x-tutorial/
The problem got resolved automatically.

eclipse and gradle: do not deploy test classes

We have here a JEE Vaadin project in eclipse (neon) IDE and as build system we use gradle. But we have a problem with our test classes. If we build our war/ear with gradle all is fine. The test classes are not part of the war archive.
But if we want to deploy the ear project on the wildfly server from inside of eclipse it seems that the test classes are part of the war archive. Because while deploy the ear we getting some errors like:
...
Caused by: com.google.common.util.concurrent.ExecutionError: com.google.common.util.concurrent.ExecutionError: java.lang.LinkageError: Failed to link com/coco_on/docFlow/vaadin/admin/TestAdminRoles (Module "deployment.DFl_EAR.ear.DFl_Vaadin.war:main" from Service Module Loader)
at com.google.common.cache.LocalCache$Segment.get(LocalCache.java:2201)
at com.google.common.cache.LocalCache.get(LocalCache.java:3937)
at com.google.common.cache.LocalCache.getOrLoad(LocalCache.java:3941)
at com.google.common.cache.LocalCache$LocalLoadingCache.get(LocalCache.java:4824)
at org.jboss.weld.util.cache.LoadingCacheUtils.getCacheValue(LoadingCacheUtils.java:49)
at org.jboss.weld.resources.DefaultReflectionCache.getBackedAnnotatedTypeAnnotationSet(DefaultReflectionCache.java:169)
at org.jboss.weld.annotated.slim.backed.BackedAnnotatedType.getAnnotations(BackedAnnotatedType.java:112)
at org.jboss.weld.annotated.slim.backed.BackedAnnotatedType.getAnnotation(BackedAnnotatedType.java:98)
at org.jboss.weld.bootstrap.BeanDeployer.processPriority(BeanDeployer.java:105)
at org.jboss.weld.bootstrap.BeanDeployer.processAnnotatedTypes(BeanDeployer.java:174)
at org.jboss.weld.bootstrap.BeanDeployment.createTypes(BeanDeployment.java:224)
at org.jboss.weld.bootstrap.WeldStartup.startInitialization(WeldStartup.java:381)
at org.jboss.weld.bootstrap.WeldBootstrap.startInitialization(WeldBootstrap.java:76)
at org.jboss.as.weld.WeldStartService.start(WeldStartService.java:92)
at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1948)
at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1881)
... 3 more
Caused by: java.lang.NoClassDefFoundError: com/vaadin/testbench/TestBenchTestCase
...
TestAdminRoles is one of our test classes and TestBenchTestCase is one of the needed classes in a test framework (Vaadin Testbench). But this test framework will be not found and this is also ok, because we don't want link this library into the ear/war.
We have also read this post: https://stackoverflow.com/a/9820317/1465758
So we have removed the src/test/ directories from the deployment and set a different bin directory for the test source directories. But without success. The error above is still there.
And so my question is: How can I configure eclipse so that eclipse don't put the compiled test classes to the war file?
You need to change the output-folder of the sourcefolders for test-sources and remove the test-directories from the deployment assembly.
This should be added to the build.gradle. (the eclipse-plugin needs to be also applied)
eclipse {
// change output dir of the sourcefolders
classpath.file.whenMerged {
entries.findAll { it instanceof org.gradle.plugins.ide.eclipse.model.SourceFolder }.each {
it.output = 'build/eclipse/' + (it.path.startsWith('src/test') ? 'output-test' : 'output')
}
}
// removes test dirs from deployment assemble
wtp.component.file.whenMerged {
wbModuleEntries.removeIf {
it instanceof org.gradle.plugins.ide.eclipse.model.WbResource && it.sourcePath.startsWith('/src/test')
}
}
}
Code Source (small changes where applied)
In this example the output-directory from non test-sources are also changed, that all output-directories are inside the build-directory from Gradle.

Deploying application in domain failed; White spaces are required between publicId and systemId

While deploying any war file in glassfish server 2.1 I am getting the below issue. I have done with small sample web application with hello world in a welcome jsp file in that case as well getting the same issue. Already running war I have undeployed and tried to deploy again. Still the same issue. OS is Solaris.
Deploying application in domain failed; Error loading deployment descriptors for module [repreg_nov2] Line 1 Column 50 -- Deployment descriptor file WEB-INF/web.xml in archive [repreg_nov2]. White spaces are required between publicId and systemId. Error loading deployment descriptors for module [repreg_nov2] Line 1 Column 50 -- Deployment descriptor file WEB-INF/web.xml in archive [repreg_nov2]. White spaces are required between publicId and systemId
I have deleted the glassfish domain and created again Still the same issue...Please help me ...
Using the version 2.0 in web.xml solves the problem, it works.

NetBeans and JBoss

I am reading this tutorial http://www.tutorialspoint.com/ejb/index.htm. I have installed NetBeans IDE 8.0.2 and JBoss 5 server. And I have a problem with this part of the tutorial http://www.tutorialspoint.com/ejb/ejb_create_application.htm with jndi.properties file. I don't understand where should i put it? I have put it here C:\Users\Mimo\Documents\NetBeansProjects\EjbTester\jndi.properties in my EjbTester project and I get the following exceptions.
run:
java.io.FileNotFoundException: C:\Users\Mimo\Documents\NetBeansProjects\EjbTester\jndi.properties (The system cannot find the file specified)
at java.io.FileInputStream.open0(Native Method)
at java.io.FileInputStream.open(FileInputStream.java:195)
at java.io.FileInputStream.(FileInputStream.java:138)
at java.io.FileInputStream.(FileInputStream.java:93)
at com.tutorialspoint.test.EJBTester.(EJBTester.java:25)
at com.tutorialspoint.test.EJBTester.main(EJBTester.java:39)
Need to specify class name in environment or system property, or as an applet parameter, or in an application resource file: java.naming.factory.initial
javax.naming.NoInitialContextException: Need to specify class name in environment or system property, or as an applet parameter, or in an application resource file: java.naming.factory.initial
at javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:662)
at javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:313)
at javax.naming.InitialContext.getURLOrDefaultInitCtx(InitialContext.java:350)
at javax.naming.InitialContext.lookup(InitialContext.java:417)
at com.tutorialspoint.test.EJBTester.testStatelessEjb(EJBTester.java:53)
at com.tutorialspoint.test.EJBTester.main(EJBTester.java:41)
Thanks for all your help!
Right click on project name in Project explorer window and select empty file name is jndi.properties and add info it... its work