我再次对汇合感到沮丧。我正在尝试使用与外部数据库的数据库连接开发一个简单的宏。
问题是数据库驱动程序。
该插件无法在其类路径中找到驱动程序类。因此我将驱动程序放在pom.xml中,如下所示:
<dependency>
<groupId>org.postgresql</groupId>
<artifactId>postgresql</artifactId>
<version>9.4.1208.jre7</version>
<scope>compile</scope>
</dependency>
我为范围尝试了编译和提供。
我还阅读了一些关于将包添加到pom.xml的配置元素的内容,如下所示:
<plugin>
<groupId>com.atlassian.maven.plugins</groupId>
<artifactId>maven-confluence-plugin</artifactId>
<version>${amps.version}</version>
<extensions>true</extensions>
<configuration>
<productVersion>${confluence.version}</productVersion>
<productDataVersion>${confluence.data.version}</productDataVersion>
<enableQuickReload>true</enableQuickReload>
<enableFastdev>false</enableFastdev>
<!-- See here for an explanation of default instructions: -->
<!-- https://developer.atlassian.com/docs/advanced-topics/configuration-of-instructions-in-atlassian-plugins -->
<instructions>
<Atlassian-Plugin-Key>${atlassian.plugin.key}</Atlassian-Plugin-Key>
<!-- Add package to export here -->
<Export-Package>
com.example.plugins.tutorial.confluence.api,
</Export-Package>
<!-- Add package import here -->
<Import-Package>
org.springframework.osgi.*;resolution:="optional",
org.eclipse.gemini.blueprint.*;resolution:="optional",
org.postgresql.*;resolution:="optional",
*
</Import-Package>
<!-- Ensure plugin is spring powered -->
<Spring-Context>*</Spring-Context>
</instructions>
</configuration>
</plugin>
但这并没有改变任何事情。我总是会收到这个错误:
[INFO] [talledLocalContainer] 2016-03-29 20:45:16,931 WARN [ThreadPoolAsyncTaskExecutor::Thread 27] [labs.plugins.quickreload.spring] afterPropertiesSet
[INFO] [talledLocalContainer] Spring context started for bundle : com.atlassian.labs.plugins.quickreload id(215) v(1.24.1) reference:file:/C:/atlassian/tutorial-confluence-macro-demo/target/container/tomcat8x/cargo-confluence-home/webapps/confluence/WEB-INF/atlassian-bundled-plugins/quickreload-1.24.1.jar
[INFO] [talledLocalContainer]
[INFO] [talledLocalContainer] If you want to debug the Spring wiring of your code then set a DEBUG level log level as follows. [ This is a dev.mode only message. ]
[INFO] [talledLocalContainer] log4j.logger.com.atlassian.labs.plugins.quickreload.spring = DEBUG, console, filelog
[INFO] [talledLocalContainer]
[INFO] [talledLocalContainer] 2016-03-29 20:45:17,617 ERROR [localhost-startStop-1] [plugin.osgi.factory.OsgiPlugin] enableInternal Detected an error (BundleException) enabling the plugin 'com.example.plugins.tutorial.confluence.tutorial-confluence-macro-demo-tests' : Unresolved constraint in bundle com.example.plugins.tutorial.confluence.tutorial-confluence-macro-demo-tests [238]: Unable to resolve 238.0: missing requirement [238.0] osgi.wiring.package; (osgi.wiring.package=com.example.plugins.tutorial.confluence.api) [caused by: Unable to resolve 149.0: missing requirement [149.0] osgi.wiring.package; (osgi.wiring.package=com.sun.jna)]. This error usually occurs when your plugin imports a package from another bundle with a specific version constraint and either the bundle providing that package doesn't meet those version constraints, or there is no bundle available that provides the specified package. For more details on how to fix this, see https://developer.atlassian.com/x/mQAN
[INFO] [talledLocalContainer] 2016-03-29 20:45:17,617 WARN [localhost-startStop-1] [atlassian.plugin.impl.AbstractPlugin] enable Unable to enable plugin 'com.example.plugins.tutorial.confluence.tutorial-confluence-macro-demo-tests'
[INFO] [talledLocalContainer] 2016-03-29 20:45:17,617 WARN [localhost-startStop-1] [atlassian.plugin.impl.AbstractPlugin] enable Because of this exception
[INFO] [talledLocalContainer] com.atlassian.plugin.osgi.container.OsgiContainerException: Cannot start plugin: com.example.plugins.tutorial.confluence.tutorial-confluence-macro-demo-tests
[INFO] [talledLocalContainer] at com.atlassian.plugin.osgi.factory.OsgiPlugin.enableInternal(OsgiPlugin.java:407)
[INFO] [talledLocalContainer] at com.atlassian.plugin.impl.AbstractPlugin.enable(AbstractPlugin.java:286)
[INFO] [talledLocalContainer] at com.atlassian.plugin.manager.PluginEnabler.actualEnable(PluginEnabler.java:130)
[INFO] [talledLocalContainer] at com.atlassian.plugin.manager.PluginEnabler.enable(PluginEnabler.java:107)
[INFO] [talledLocalContainer] at com.atlassian.plugin.manager.DefaultPluginManager.enableDependentPlugins(DefaultPluginManager.java:1079)
[INFO] [talledLocalContainer] at com.atlassian.plugin.manager.DefaultPluginManager.addPlugins(DefaultPluginManager.java:1055)
[INFO] [talledLocalContainer] at com.atlassian.plugin.manager.DefaultPluginManager.lateStartup(DefaultPluginManager.java:536)
[INFO] [talledLocalContainer] at com.atlassian.confluence.plugin.ConfluencePluginManager.lateStartup(ConfluencePluginManager.java:137)
[INFO] [talledLocalContainer] at com.atlassian.confluence.plugin.PluginFrameworkContextListener.contextInitialized(PluginFrameworkContextListener.java:79)
[INFO] [talledLocalContainer] at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4760)
[INFO] [talledLocalContainer] at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5184)
[INFO] [talledLocalContainer] at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
[INFO] [talledLocalContainer] at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:724)
[INFO] [talledLocalContainer] at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:700)
[INFO] [talledLocalContainer] at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:714)
[INFO] [talledLocalContainer] at org.apache.catalina.startup.HostConfig.deployWAR(HostConfig.java:919)
[INFO] [talledLocalContainer] at org.apache.catalina.startup.HostConfig$DeployWar.run(HostConfig.java:1704)
[INFO] [talledLocalContainer] at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
[INFO] [talledLocalContainer] at java.util.concurrent.FutureTask.run(FutureTask.java:266)
[INFO] [talledLocalContainer] at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
[INFO] [talledLocalContainer] at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
[INFO] [talledLocalContainer] at java.lang.Thread.run(Thread.java:745)
[INFO] [talledLocalContainer] Caused by: org.osgi.framework.BundleException: Unresolved constraint in bundle com.example.plugins.tutorial.confluence.tutorial-confluence-macro-demo-tests [238]: Unable to resolve 238.0: missing requirement [238.0] osgi.wiring.package; (osgi.wiring.package=com.example.plugins.tutorial.confluence.api) [caused by: Unable to resolve 149.0: missing requirement [149.0] osgi.wiring.package; (osgi.wiring.package=com.sun.jna)]
[INFO] [talledLocalContainer] at org.apache.felix.framework.Felix.resolveBundleRevision(Felix.java:3974)
[INFO] [talledLocalContainer] at org.apache.felix.framework.Felix.startBundle(Felix.java:2037)
[INFO] [talledLocalContainer] at org.apache.felix.framework.BundleImpl.start(BundleImpl.java:955)
[INFO] [talledLocalContainer] at org.apache.felix.framework.BundleImpl.start(BundleImpl.java:942)
[INFO] [talledLocalContainer] at com.atlassian.plugin.osgi.factory.OsgiPlugin.enableInternal(OsgiPlugin.java:388)
[INFO] [talledLocalContainer] ... 21 more
[INFO] [talledLocalContainer] 2016-03-29 20:45:17,618 ERROR [localhost-startStop-1] [atlassian.plugin.manager.PluginEnabler] actualEnable Unable to enable plugin com.example.plugins.tutorial.confluence.tutorial-confluence-macro-demo-tests
[INFO] [talledLocalContainer] com.atlassian.plugin.osgi.container.OsgiContainerException: Cannot start plugin: com.example.plugins.tutorial.confluence.tutorial-confluence-macro-demo-tests
[INFO] [talledLocalContainer] at com.atlassian.plugin.osgi.factory.OsgiPlugin.enableInternal(OsgiPlugin.java:407)
[INFO] [talledLocalContainer] at com.atlassian.plugin.impl.AbstractPlugin.enable(AbstractPlugin.java:286)
[INFO] [talledLocalContainer] at com.atlassian.plugin.manager.PluginEnabler.actualEnable(PluginEnabler.java:130)
[INFO] [talledLocalContainer] at com.atlassian.plugin.manager.PluginEnabler.enable(PluginEnabler.java:107)
[INFO] [talledLocalContainer] at com.atlassian.plugin.manager.DefaultPluginManager.enableDependentPlugins(DefaultPluginManager.java:1079)
[INFO] [talledLocalContainer] at com.atlassian.plugin.manager.DefaultPluginManager.addPlugins(DefaultPluginManager.java:1055)
[INFO] [talledLocalContainer] at com.atlassian.plugin.manager.DefaultPluginManager.lateStartup(DefaultPluginManager.java:536)
[INFO] [talledLocalContainer] at com.atlassian.confluence.plugin.ConfluencePluginManager.lateStartup(ConfluencePluginManager.java:137)
[INFO] [talledLocalContainer] at com.atlassian.confluence.plugin.PluginFrameworkContextListener.contextInitialized(PluginFrameworkContextListener.java:79)
[INFO] [talledLocalContainer] at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4760)
[INFO] [talledLocalContainer] at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5184)
[INFO] [talledLocalContainer] at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
[INFO] [talledLocalContainer] at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:724)
[INFO] [talledLocalContainer] at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:700)
[INFO] [talledLocalContainer] at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:714)
[INFO] [talledLocalContainer] at org.apache.catalina.startup.HostConfig.deployWAR(HostConfig.java:919)
[INFO] [talledLocalContainer] at org.apache.catalina.startup.HostConfig$DeployWar.run(HostConfig.java:1704)
[INFO] [talledLocalContainer] at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
[INFO] [talledLocalContainer] at java.util.concurrent.FutureTask.run(FutureTask.java:266)
[INFO] [talledLocalContainer] at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
[INFO] [talledLocalContainer] at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
[INFO] [talledLocalContainer] at java.lang.Thread.run(Thread.java:745)
[INFO] [talledLocalContainer] Caused by: org.osgi.framework.BundleException: Unresolved constraint in bundle com.example.plugins.tutorial.confluence.tutorial-confluence-macro-demo-tests [238]: Unable to resolve 238.0: missing requirement [238.0] osgi.wiring.package; (osgi.wiring.package=com.example.plugins.tutorial.confluence.api) [caused by: Unable to resolve 149.0: missing requirement [149.0] osgi.wiring.package; (osgi.wiring.package=com.sun.jna)]
[INFO] [talledLocalContainer] at org.apache.felix.framework.Felix.resolveBundleRevision(Felix.java:3974)
[INFO] [talledLocalContainer] at org.apache.felix.framework.Felix.startBundle(Felix.java:2037)
[INFO] [talledLocalContainer] at org.apache.felix.framework.BundleImpl.start(BundleImpl.java:955)
[INFO] [talledLocalContainer] at org.apache.felix.framework.BundleImpl.start(BundleImpl.java:942)
[INFO] [talledLocalContainer] at com.atlassian.plugin.osgi.factory.OsgiPlugin.enableInternal(OsgiPlugin.java:388)
[INFO] [talledLocalContainer] ... 21 more
[INFO] [talledLocalContainer] 2016-03-29 20:45:17,985 INFO [ThreadPoolAsyncTaskExecutor::Thread 27] [plugins.quickreload.config.AutoRefresher] startupMessage
[INFO] [talledLocalContainer]
[INFO] [talledLocalContainer] Quick Reload - ←[34mStealing back time from Maven since 2013.←[39m
[INFO] [talledLocalContainer]
[INFO] [talledLocalContainer] Tracking the following directories for changes :
[INFO] [talledLocalContainer]
[INFO] [talledLocalContainer] ←[33mC:\atlassian\tutorial-confluence-macro-demo\target←[39m
[INFO] [talledLocalContainer] ←[33m
[INFO] [talledLocalContainer] The system property 'plugin.resource.directories' is as follows :
[INFO] [talledLocalContainer]
[INFO] [talledLocalContainer] ←[33mC:\atlassian\tutorial-confluence-macro-demo\src\main\resources←[39m
[INFO] [talledLocalContainer] ←[33mC:\atlassian\tutorial-confluence-macro-demo\src\test\resources←[39m
[INFO] [talledLocalContainer] ←[39m
[INFO] [talledLocalContainer] The Control Panel page is available at :
[INFO] [talledLocalContainer]
[INFO] [talledLocalContainer] ←[33m/plugins/servlet/qr←[39m
[INFO] [talledLocalContainer]
[INFO] [talledLocalContainer] The REST API is available at :
[INFO] [talledLocalContainer]
[INFO] [talledLocalContainer] ←[33m/rest/qr/1.0/api←[39m
[INFO] [talledLocalContainer]
[INFO] [talledLocalContainer] Web Resource batching and caching is currently ←[32menabled←[39m
[INFO] [talledLocalContainer]
[INFO] [talledLocalContainer] 2016-03-29 20:45:28,931 WARN [localhost-startStop-1] [confluence.plugin.dev.DeprecatedPluginModuleListener] findAndLogDeprecations Class com.atlassian.applinks.api.auth.types.TrustedAppsAuthenticationProvider of module 'com.atlassian.applinks.applinks-trustedapps-plugin:confluence-inbound-trusted' is deprecated
[INFO] [talledLocalContainer] 2016-03-29 20:45:30,140 WARN [localhost-startStop-1] [confluence.plugin.dev.DeprecatedPluginModuleListener] findAndLogDeprecations Class com.atlassian.confluence.plugins.dailysummary.analytics.SummaryEmailTrackingServlet of module 'com.atlassian.confluence.plugins.confluence-daily-summary-email:summaryEmailTrackingServlet' is deprecated
[INFO] [talledLocalContainer] 2016-03-29 20:45:30,961 WARN [localhost-startStop-1] [confluence.plugin.dev.DeprecatedPluginModuleListener] findAndLogDeprecations Class com.atlassian.confluence.plugins.like.notifications.NotificationListener of module 'com.atlassian.confluence.plugins.confluence-like:notificationListener' is deprecated
[INFO] [talledLocalContainer] 2016-03-29 20:45:31,398 WARN [localhost-startStop-1] [confluence.plugin.dev.DeprecatedPluginModuleListener] findAndLogDeprecations Type com.atlassian.plugin.webresource.transformer.WebResourceTransformer inherited by class com.atlassian.upm.template.UnderscoreTemplateWebResourceTransformer of module 'com.atlassian.upm.atlassian-universal-plugin-manager-plugin:javascriptTemplateWebResourceTransformer' is deprecated
[INFO] [talledLocalContainer] 2016-03-29 20:45:31,399 WARN [localhost-startStop-1] [confluence.plugin.dev.DeprecatedPluginModuleListener] findAndLogDeprecations Type com.atlassian.plugin.webresource.transformer.WebResourceTransformer inherited by class com.atlassian.upm.notification.NotificationWebResourceTransformer of module 'com.atlassian.upm.atlassian-universal-plugin-manager-plugin:notificationWebResourceTransformer' is deprecated
[INFO] [talledLocalContainer] 2016-03-29 20:45:31,525 WARN [localhost-startStop-1] [atlassian.confluence.cache.TransactionalCacheFactory] logNonTxUsageWarning Update operation performed on transactional cache [com.atlassian.confluence.plugin.CachingPluginStateStore] outside of a transaction. All updates to this cache should be performed from a thread with a valid transaction context.
[INFO] [talledLocalContainer] 2016-03-29 20:45:31,525 INFO [localhost-startStop-1] [atlassian.plugin.manager.DefaultPluginManager] lateStartup Plugin system lateStartup finished in 0:00:20.430
[INFO] [talledLocalContainer] 2016-03-29 20:45:31,565 INFO [lifecycle:thread-1] [sal.core.upgrade.DefaultPluginUpgradeManager] upgradeInternal Running plugin upgrade tasks...
[INFO] [talledLocalContainer] 2016-03-29 20:45:31,571 INFO [lifecycle:thread-1] [sal.core.upgrade.PluginUpgrader] doUpgrade Upgrading plugin com.atlassian.plugins.atlassian-whitelist-core-plugin
[INFO] [talledLocalContainer] 2016-03-29 20:45:31,575 INFO [lifecycle:thread-1] [sal.core.upgrade.PluginUpgrader] upgradeTaskSucceeded Upgraded plugin com.atlassian.plugins.atlassian-whitelist-core-plugin to version 1 - Migrate existing application links to the whitelist.
[INFO] [talledLocalContainer] 2016-03-29 20:45:31,578 INFO [lifecycle:thread-1] [sal.core.upgrade.PluginUpgrader] upgradeTaskSucceeded Upgraded plugin com.atlassian.plugins.atlassian-whitelist-core-plugin to version 2 - Migrate existing whitelist entries used by the RSS and HTML include macro.
[INFO] [talledLocalContainer] 2016-03-29 20:45:31,580 INFO [lifecycle:thread-1] [sal.core.upgrade.PluginUpgrader] upgradeTaskSucceeded Upgraded plugin com.atlassian.plugins.atlassian-whitelist-core-plugin to version 3 - Migrate existing Confluence Gadget whitelist data.
[INFO] [talledLocalContainer] 2016-03-29 20:45:31,580 INFO [lifecycle:thread-1] [sal.core.upgrade.PluginUpgrader] postUpgrade Plugin com.atlassian.plugins.atlassian-whitelist-core-plugin upgrade completed. Current version is: 3
[INFO] [talledLocalContainer] 2016-03-29 20:45:31,589 INFO [lifecycle:thread-1] [sal.core.upgrade.PluginUpgrader] doUpgrade Upgrading plugin com.atlassian.confluence.plugins.confluence-roadmap-plugin
[INFO] [talledLocalContainer] 2016-03-29 20:45:32,082 INFO [lifecycle:thread-1] [sal.core.upgrade.PluginUpgrader] upgradeTaskSucceeded Upgraded plugin com.atlassian.confluence.plugins.confluence-roadmap-plugin to version 6 - Remove the "currentspaces" parameter from Roadmap macros
[INFO] [talledLocalContainer] 2016-03-29 20:45:32,083 INFO [lifecycle:thread-1] [sal.core.upgrade.PluginUpgrader] postUpgrade Plugin com.atlassian.confluence.plugins.confluence-roadmap-plugin upgrade completed. Current version is: 6
[INFO] [talledLocalContainer] 2016-03-29 20:45:32,085 INFO [lifecycle:thread-1] [sal.core.upgrade.PluginUpgrader] doUpgrade Upgrading plugin com.atlassian.upm.atlassian-universal-plugin-manager-plugin
[INFO] [talledLocalContainer] 2016-03-29 20:45:32,123 INFO [lifecycle:thread-1] [sal.core.upgrade.PluginUpgrader] upgradeTaskSucceeded Upgraded plugin com.atlassian.upm.atlassian-universal-plugin-manager-plugin to version 5 - Posts an initial topology report for a new UPM instance.
[INFO] [talledLocalContainer] 2016-03-29 20:45:32,123 INFO [lifecycle:thread-1] [sal.core.upgrade.PluginUpgrader] postUpgrade Plugin com.atlassian.upm.atlassian-universal-plugin-manager-plugin upgrade completed. Current version is: 5
[INFO] [talledLocalContainer] 2016-03-29 20:45:32,125 INFO [lifecycle:thread-1] [sal.core.upgrade.PluginUpgrader] doUpgrade Upgrading plugin com.atlassian.support.stp
[INFO] [talledLocalContainer] 2016-03-29 20:45:32,136 INFO [lifecycle:thread-1] [sal.core.upgrade.PluginUpgrader] upgradeTaskSucceeded Upgraded plugin com.atlassian.support.stp to version 1 - Verify if the obsolete Health Check scheduler exists and remove it.
[INFO] [talledLocalContainer] 2016-03-29 20:45:32,136 INFO [lifecycle:thread-1] [sal.core.upgrade.PluginUpgrader] postUpgrade Plugin com.atlassian.support.stp upgrade completed. Current version is: 1
[INFO] [talledLocalContainer] 2016-03-29 20:45:32,140 INFO [lifecycle:thread-5] [gadgets.renderer.internal.BlobCrypterImpl] onLifecycleEvent onLifecycleEvent LIFECYCLE_AWARE_ON_START
[INFO] [talledLocalContainer] 2016-03-29 20:45:32,140 INFO [lifecycle:thread-5] [gadgets.renderer.internal.BlobCrypterImpl] onLifecycleEvent Startup lifecycle complete, initialising BlobCrypter
[INFO] [talledLocalContainer] 2016-03-29 20:45:35,344 WARN [localhost-startStop-1] [atlassian.config.xml.AbstractDom4jXmlConfigurationPersister] saveDocumentAtomically Unable to move C:\atlassian\tutorial-confluence-macro-demo\target\confluence\home\confluence.cfg.xml5736989692032523721tmp to C:\atlassian\tutorial-confluence-macro-demo\target\confluence\home\confluence.cfg.xml. Falling back to non-atomic overwrite.
[INFO] [talledLocalContainer] 2016-03-29 20:45:35,364 INFO [localhost-startStop-1] [confluence.upgrade.impl.DefaultUpgradeGate] waitForBooleanValue Waiting to find if plugin dependent upgrades are required. Maximum wait time will be 90 seconds.
我也尝试将driver-jar文件放入web-inf / lib目录,但正如Atlassian在本页描述的那样
https://developer.atlassian.com/docs/getting-started/working-with-the-pom/managing-dependencies
这不再适用了。
上述错误有以下消息:
Unresolved constraint in bundle com.example.plugins.tutorial.confluence.tutorial-confluence-macro-demo-tests [238]:
Unable to resolve 238.0: missing requirement [238.0] osgi.wiring.package; (osgi.wiring.package=com.example.plugins.tutorial.confluence.api)
[caused by: Unable to resolve 149.0: missing requirement [149.0] osgi.wiring.package; (osgi.wiring.package=com.sun.jna)].
This error usually occurs when your plugin imports a package from another bundle with a specific version constraint and either the bundle providing that package doesn't meet those version constraints, or there is no bundle available that provides the specified package. For more details on how to fix this, see https://developer.atlassian.com/x/mQAN
所以我不太清楚这个消息的意思。
也许有人可以帮助我。
更新
从pom.xml中删除Import-Package标记后
<Import-Package>
org.springframework.osgi.*;resolution:="optional",
org.eclipse.gemini.blueprint.*;resolution:="optional",
org.postgresql.*;resolution:="optional",
*
</Import-Package>
有效。
非常感谢 Hauke