Getting ZipException Error when Installing a New Plugin Due to Postgres 9 Configuration
症状
Using Postgres 9.0+, the following exception is shown in the logs when installing a new plugin:
2010-10-05 07:14:37,325 ERROR [http-8080-14] [atlassian.plugin.loaders.ScanningPluginLoader] deployPluginFromUnit Unable to deploy plugin 'null', file Unit: C:\confluence\data\plugin-cache\xxxxxxxx.jar (1286277277321)
-- url: /admin/uploadplugin.action | userName: someuser | referer: http://<confluence server base url>:8080/admin/viewplugins.action | action: uploadplugin
com.atlassian.plugin.PluginParseException: Cannot open JAR file for reading: C:\confluence\data\plugin-cache\1286277277033taskdock-1.2.jar
at com.atlassian.plugin.JarPluginArtifact.getResourceAsStream(JarPluginArtifact.java:53)
at com.atlassian.plugin.factories.LegacyDynamicPluginFactory.canCreate(LegacyDynamicPluginFactory.java:137)
at com.atlassian.plugin.loaders.ScanningPluginLoader.deployPluginFromUnit(ScanningPluginLoader.java:113)
at com.atlassian.plugin.loaders.ScanningPluginLoader.addFoundPlugins(ScanningPluginLoader.java:176)
at com.atlassian.confluence.plugin.DatabaseClassLoadingPluginLoader.addFoundPlugins(DatabaseClassLoadingPluginLoader.java:53)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:304)
at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:182)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:149)
...
Caused by: java.util.zip.ZipException: error in opening zip file
at java.util.zip.ZipFile.open(Native Method)
at java.util.zip.ZipFile.<init>(ZipFile.java:114)
at java.util.jar.JarFile.<init>(JarFile.java:135)
at java.util.jar.JarFile.<init>(JarFile.java:99)
at com.atlassian.plugin.JarPluginArtifact.getResourceAsStream(JarPluginArtifact.java:49)
... 220 more
原因
The PostgreSQL 8.x JDBC drivers that ship with Confluence are not compatible with PostgreSQL 9.x. The underlying cause is a change to PostgreSQL which has modified the bytea_output data type.
This change affects Confluence's ability to store plugin binaries in the plugindata table in the database when installing a new plugin.
ソリューション
Confluence 4.0 and later contains the updated PostgreSQL 9.x JDBC drivers which fixes this problem.
If you are running an earlier version of Confluence, you can upgrade to the latest PostgreSQL JDBC drivers by replacing the existing driver JAR file in Confluence's WEB-INF/lib/
directory. The driver version 9.0-801.jdbc3 does not suffer from this problem.