build.gradle of rest-api , console error imageI am trying to build my rest api in Liferay 7.4 , but the rest api is not working properly.
Can't find the request for http://localhost:8080/o/marketplace/username/'s Observer. I have tried doing cxf settings and start stop the go-go shell but it didnt work.Here's the error log of my* file for ref:
2021-06-29 07:21:30.488 ERROR [pipe-start 1406][ROOT:93] bundle com.market.rest.api:1.0.0 (1406)BundleComponentActivator : Unexpected failure enabling component holder com.market.rest.api.application.EmailNotificationListener
java.lang.NoClassDefFoundError: com/liferay/portal/kernel/messaging/BaseMessageListener
at java.lang.ClassLoader.defineClass1(Native Method) ~[?:1.8.0_261]
at java.lang.ClassLoader.defineClass(ClassLoader.java:756) ~[?:1.8.0_261]
at org.eclipse.osgi.internal.loader.ModuleClassLoader.defineClass(ModuleClassLoader.java:276) ~[org.eclipse.osgi.jar:?]
at org.eclipse.osgi.internal.loader.classpath.ClasspathManager.defineClass(ClasspathManager.java:634) ~[org.eclipse.osgi.jar:?]
at BundleComponentActivator : Unexpected failure enabling component holder
at org.eclipse.osgi.container.Module.publishEvent(Module.java:476) [org.eclipse.osgi.jar:?]
at org.eclipse.osgi.container.Module.start(Module.java:467) [org.eclipse.osgi.jar:?]
at org.eclipse.osgi.internal.framework.EquinoxBundle.start(EquinoxBundle.java:428) [org.eclipse.osgi.jar:?]
at org.apache.felix.gogo.command.Basic.start(Basic.java:739) [bundleFile:?]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_261]
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:1.8.0_261]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_261]
at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_261]
at org.apache.felix.gogo.runtime.Reflective.invoke(Reflective.java:139) [bundleFile:?]
at org.apache.felix.gogo.runtime.CommandProxy.execute(CommandProxy.java:91) [bundleFile:?]
at org.apache.felix.gogo.runtime.Closure.executeCmd(Closure.java:599) [bundleFile:?]
at org.apache.felix.gogo.runtime.Closure.executeStatement(Closure.java:526) [bundleFile:?]
at org.apache.felix.gogo.runtime.Closure.execute(Closure.java:415) [bundleFile:?]
at org.apache.felix.gogo.runtime.Pipe.doCall(Pipe.java:416) [bundleFile:?]
at org.apache.felix.gogo.runtime.Pipe.call(Pipe.java:229) [bundleFile:?]
at org.apache.felix.gogo.runtime.Pipe.call(Pipe.java:59) [bundleFile:?]
at java.util.concurrent.FutureTask.run(FutureTask.java:266) [?:1.8.0_261]
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) [?:1.8.0_261]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) [?:1.8.0_261]
at java.lang.Thread.run(Thread.java:748) [?:1.8.0_261]
Caused by: java.lang.ClassNotFoundException: com.liferay.portal.kernel.scheduler.SchedulerEntry cannot be found by com.market.rest.api_1.0.0
at org.eclipse.osgi.internal.loader.BundleLoader.findClassInternal(BundleLoader.java:508) ~[org.eclipse.osgi.jar:?]
at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:419) ~[org.eclipse.osgi.jar:?]
at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:411) ~[org.eclipse.osgi.jar:?]
at org.eclipse.osgi.internal.loader.ModuleClassLoader.loadClass(ModuleClassLoader.java:151) ~[org.eclipse.osgi.jar:?]
at java.lang.ClassLoader.loadClass(ClassLoader.java:351) ~[?:1.8.0_261]
... 50 more
2021-06-29 07:21:30.817 WARN [pipe-start 1406][AriesJaxrsServiceRuntime:298] Application from reference CachingServiceReference {__cachedProperties={osgi.jaxrs.application.select=null (cached), osgi.jaxrs.application.base=/marketplace, osgi.jaxrs.name=MarketPlace.Rest, osgi.jaxrs.extension.select=null (cached), osgi.http.whiteboard.context.select=null (cached), osgi.jaxrs.whiteboard.target=null (cached)}__serviceReference={javax.ws.rs.core.Application}={osgi.jaxrs.application.base=/marketplace, service.id=17706, service.bundleid=1406, service.scope=bundle, oauth2.scopechecker.type=none, osgi.jaxrs.name=MarketPlace.Rest, liferay.access.control.disable=true, component.name=com.market.rest.api.application.MarketplaceAPIrestApplication, component.id=8438}__} can't be got [Sanitized]
2021-06-29 07:21:30.832 ERROR [Framework Event Dispatcher: Equinox Container: e7d68436-b9af-4ee0-a2f1-a45bc009ca95][Framework:93] FrameworkEvent ERROR
org.osgi.framework.ServiceException: Exception in org.apache.felix.scr.impl.manager.SingleComponentManager.getService()
at org.eclipse.osgi.internal.serviceregistry.ServiceFactoryUse.factoryGetService(ServiceFactoryUse.java:222) ~[org.eclipse.osgi.jar:?]
at org.eclipse.osgi.internal.serviceregistry.ServiceFactoryUse.getService(ServiceFactoryUse.java:111) ~[org.eclipse.osgi.jar:?]
at org.eclipse.osgi.internal.serviceregistry.ServiceUse.newServiceObject(ServiceUse.java:96) ~[org.eclipse.osgi.jar:?]
at org.eclipse.osgi.internal.serviceregistry.ServiceConsumer$1.getService(ServiceConsumer.java:30) ~[org.eclipse.osgi.jar:?]
at org.eclipse.osgi.internal.serviceregistry.ServiceRegistrationImpl.getService(ServiceRegistrationImpl.java:524) ~[org.eclipse.osgi.jar:?]
at org.eclipse.osgi.internal.serviceregistry.ServiceObjectsImpl.getService(ServiceObjectsImpl.java:89) ~[org.eclipse.osgi.jar:?]
at org.apache.aries.jax.rs.whiteboard.internal.utils.Utils.lambda$null$7(Utils.java:206) ~[?:?]
at org.apache.aries.component.dsl.OSGi.lambda$null$68(OSGi.java:674) ~[?:?]
at org.apache.aries.component.dsl.Publisher.apply(Publisher.java:28) ~[?:?]
at org.apache.aries.component.dsl.OSGi.lambda$null$75(OSGi.java:715) ~[?:?]
at org.apache.aries.component.dsl.OSGi.lambda$null$64(OSGi.java:602) ~[?:?]
at org.apache.aries.component.dsl.OSGi.lambda$null$64(OSGi.java:602) ~[?:?]
at org.apache.aries.component.dsl.internal.JustOSGiImpl.lambda$new$2(JustOSGiImpl.java:47) ~[?:?]
at org.apache.aries.component.dsl.internal.OSGiImpl.run(OSGiImpl.java:50) ~[?:?]
at org.apache.aries.component.dsl.OSGi.lambda$effects$65(OSGi.java:596) ~[?:?]
at org.apache.aries.component.dsl.internal.OSGiImpl.lambda$create$0(OSGiImpl.java:39) ~[?:?]
at org.apache.aries.component.dsl.internal.OSGiImpl.run(OSGiImpl.java:50) ~[?:?]
at org.apache.aries.component.dsl.OSGi.lambda$null$68(OSGi.java:674) ~[?:?]
at org.apache.aries.component.dsl.OSGi.lambda$null$64(OSGi.java:602) ~[?:?]
at org.apache.aries.component.dsl.Publisher.apply(Publisher.java:28) ~[?:?]
at org.apache.aries.component.dsl.OSGi.lambda$null$29(OSGi.java:296) ~[?:?]
at org.apache.aries.component.dsl.internal.UpdateSupport.deferPublication(UpdateSupport.java:40) ~[?:?]
at org.apache.aries.component.dsl.OSGi.lambda$null$32(OSGi.java:295) ~[?:?]
at org.apache.aries.component.dsl.Publisher.apply(Publisher.java:28) ~[?:?]
2021-06-29 07:21:30.817 WARN [pipe-start 1406][AriesJaxrsServiceRuntime:298] Application from reference CachingServiceReference {__cachedProperties={osgi.jaxrs.application.select=null (cached), osgi.jaxrs.application.base=/marketplace, osgi.jaxrs.name=MarketPlace.Rest, osgi.jaxrs.extension.select=null (cached), osgi.http.whiteboard.context.select=null (cached), osgi.jaxrs.whiteboard.target=null (cached)}__serviceReference={javax.ws.rs.core.Application}={osgi.jaxrs.application.base=/marketplace, service.id=17706, service.bundleid=1406, service.scope=bundle, oauth2.scopechecker.type=none, osgi.jaxrs.name=MarketPlace.Rest, liferay.access.control.disable=true, component.name=com.market.rest.api.application.MarketplaceAPIrestApplication, component.id=8438}__} can't be got [Sanitized]
Caused by: java.lang.ClassNotFoundException: com.liferay.portal.kernel.messaging.BaseMessageListener cannot be found by com.market.rest.api_1.0.0
Mostly in the error logs it is class not found exception
here is my rest-api gradle.build I am trying to use for Liferay 7.4
dependencies {
compileOnly group: "com.liferay.portal", name: "release.portal.api"
// https://mvnrepository.com/artifact/javax.ws.rs/javax.ws.rs-api
compileOnly group: 'javax.ws.rs', name: 'javax.ws.rs-api', version: '2.1.1'
compileOnly group: "org.osgi", name: "org.osgi.service.component.annotations"
compileOnly group: "org.osgi", name: "org.osgi.service.jaxrs"
compileOnly group: "org.json", name: "json"
compileOnly group: "com.sun.mail", name: "javax.mail", version: "1.6.2"
compileOnly group: 'commons-httpclient', name: 'commons-httpclient', version: '3.1'
//changes
compileOnly project(":modules:marketplace-service:marketplace-service-api")
compileOnly project(":modules:marketplace-service:marketplace-service-service")
// https://mvnrepository.com/artifact/org.osgi/org.osgi.service.log
//compileOnly group: 'org.osgi', name: 'org.osgi.service.log'
compileOnly group: 'com.liferay.portal', name: 'com.liferay.portal.kernel', version: '11.8.0'
compileInclude group: 'org.apache.poi', name: 'poi', version: '4.0.1', transitive:false
compileInclude group: 'org.apache.poi', name: 'poi-ooxml', version: '4.0.1', transitive:false
compileInclude group: 'org.apache.poi', name: 'poi-ooxml-schemas', version: '4.0.1', transitive:false
compileInclude group: 'org.apache.xmlbeans', name: 'xmlbeans', version: '3.0.2', transitive:false
compileInclude group: 'org.apache.commons', name: 'commons-collections4', version: '4.4', transitive:false
compileInclude group: 'dom4j', name: 'dom4j', version: '1.6.1', transitive:false
compileInclude group: 'org.apache.commons', name: 'commons-compress', version: '1.18', transitive:false
}
I am getting this error
osgi.jaxrs.application.select=null (cached), osgi.jaxrs.application.base=/marketplace, osgi.jaxrs.name=MarketPlace.Rest, osgi.jaxrs.extension.select=null (cached), osgi.http.whiteboard.context.select=null (cached),