liferay 7.2 version
tomcat-9.0.17
gradle.build
compileOnly group: "com.google.api-client", name: "google-api-client", version: ':1.23.0'
compileOnly group: "com.google.oauth-client", name: "google-oauth-client-jetty", version: "1.23.0"
compileOnly group: "com.google.apis", name: "google-api-services-drive", version: "v3-rev110-1.23.0"
i need use java upload file to google drive
when i start server, i hit this error
[![Liferay console output showing error message][1]][1]
2020-06-23 11:10:58.525 INFO [main][PortalContextLoaderListener:139] JVM arguments: -Dcatalina.base=C:/Users/LENOVO/Desktop/liferay-ce-portal-7.2.1-ga2/tomcat-9.0.17 -Dcatalina.home=C:/Users/LENOVO/Desktop/liferay-ce-portal-7.2.1-ga2/tomcat-9.0.17 -Djdk.tls.ephemeralDHKeySize=2048 -Djava.protocol.handler.pkgs=org.apache.catalina.webresources -Dorg.apache.catalina.security.SecurityListener.UMASK=0027 -Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.authenticate=false -Dcom.sun.management.jmxremote.port=8099 -Dcom.sun.management.jmxremote.ssl=false -Dfile.encoding=UTF8 -Djava.endorsed.dirs=C:/Users/LENOVO/Desktop/liferay-ce-portal-7.2.1-ga2/tomcat-9.0.17/endorsed -Djava.io.tmpdir=C:/Users/LENOVO/Desktop/liferay-ce-portal-7.2.1-ga2/tomcat-9.0.17/temp -Djava.net.preferIPv4Stack=true -Djava.util.logging.config.file=C:/Users/LENOVO/Desktop/liferay-ce-portal-7.2.1-ga2/tomcat-9.0.17/conf/logging.properties -Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager -Dorg.apache.catalina.loader.WebappClassLoader.ENABLE_CLEAR_REFERENCES=false -Duser.timezone=GMT -Xmx2560m
2020-06-23 11:11:04.476 INFO [main][DialectDetector:159] Using dialect org.hibernate.dialect.MySQLDialect for MySQL 8.0
2020-06-23 11:11:08.647 INFO [main][ModuleFrameworkImpl:1468] Starting initial bundles
2020-06-23 11:11:08.694 ERROR [Framework Event Dispatcher: Equinox Container: 6c1b290f-406b-44be-9cec-6423b761abd2][Framework:93] FrameworkEvent ERROR
org.osgi.framework.BundleException: Could not resolve module: hero [2129]_ Unresolved requirement: Import-Package: com.google.api.client.auth.oauth2; version="[1.23.0,2.0.0)"_ [Sanitized]
at org.eclipse.osgi.container.Module.start(Module.java:444)
at org.eclipse.osgi.container.ModuleContainer$ContainerStartLevel.incStartLevel(ModuleContainer.java:1682)
at org.eclipse.osgi.container.ModuleContainer$ContainerStartLevel.incStartLevel(ModuleContainer.java:1662)
at org.eclipse.osgi.container.ModuleContainer$ContainerStartLevel.doContainerStartLevel(ModuleContainer.java:1624)
at org.eclipse.osgi.container.SystemModule.startWorker(SystemModule.java:264)
at org.eclipse.osgi.container.Module.doStart(Module.java:581)
at org.eclipse.osgi.container.Module.start(Module.java:449)
at org.eclipse.osgi.container.SystemModule.start(SystemModule.java:188)
at org.eclipse.osgi.internal.framework.EquinoxBundle.start(EquinoxBundle.java:428)
at org.eclipse.osgi.internal.framework.EquinoxBundle.start(EquinoxBundle.java:447)
at org.eclipse.osgi.launch.Equinox.start(Equinox.java:115)
at com.liferay.portal.bootstrap.ModuleFrameworkImpl.startFramework(ModuleFrameworkImpl.java:399)
at com.liferay.portal.module.framework.ModuleFrameworkUtilAdapter.startFramework(ModuleFrameworkUtilAdapter.java:100)
at com.liferay.portal.spring.context.PortalContextLoaderListener.contextInitialized(PortalContextLoaderListener.java:300)
at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4682)
at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5150)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:713)
at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:690)
at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:695)
at org.apache.catalina.startup.HostConfig.deployDescriptor(HostConfig.java:631)
at org.apache.catalina.startup.HostConfig$DeployDescriptor.run(HostConfig.java:1832)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at org.apache.tomcat.util.threads.InlineExecutorService.execute(InlineExecutorService.java:75)
at java.util.concurrent.AbstractExecutorService.submit(AbstractExecutorService.java:112)
at org.apache.catalina.startup.HostConfig.deployDescriptors(HostConfig.java:526)
at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:425)
at org.apache.catalina.startup.HostConfig.start(HostConfig.java:1577)
at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:309)
at org.apache.catalina.util.LifecycleBase.fireLifecycleEvent(LifecycleBase.java:123)
i refer this link https://developers.google.com/drive/api/v3/quickstart/java
any know how to solve ?
compileOnly
will make your dependencies available at compile time only. You will need to make sure that they're available at runtime as well (together with all the required transitive dependencies).
Ideally, if all required dependencies are already OSGi bundles, you just drop them in Liferay's deploy
folder and deploy them to the runtime - and they'll automagically be available.
If your dependencies aren't OSGi bundles: Check if you find a fork of these dependencies which differs only by adding required OSGi directives in the manifest. Or, as a last resort, really not recommended, you can use compileInclude
. This will package the dependencies with your plugin, at the cost of a larger plugin and potential clashes if you do this in multiple of your plugins and expect them all to handle the same data: You won't be able to pass these objects around.
I have a chapter on exactly this topic in a (free, registration required) course OSGi Basics, over on Liferay University. But the main information is what you see above.