halo-sigs / plugin-alioss

【过时】为 Halo 2.0 提供阿里云 OSS 的存储策略。请使用 S3 插件替代:https://github.com/halo-sigs/plugin-s3
https://halo.run/store/apps/app-Qxhpp
GNU General Public License v3.0
10 stars 4 forks source link

无法在开发环境运行 #3

Open ruibaby opened 2 years ago

ruibaby commented 2 years ago

配置文件:

halo:
  plugin:
    runtime-mode: development # development, deployment
    classes-directories:
      - "build/classes"
      - "build/resources"
    lib-directories:
      - "libs"
    fixedPluginPath:
      - "path/to/plugin-alioss"

启动日志:

2022-09-17T20:38:25.544+08:00 ERROR 8718 --- [pool-6-thread-1] run.halo.app.plugin.HaloPluginManager    : Unable to start plugin 'PluginAliOSS@0.0.1-SNAPSHOT'

org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'run.halo.alioss.AliOssAttachmentHandler': Lookup method resolution failed
    at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.determineCandidateConstructors(AutowiredAnnotationBeanPostProcessor.java:347) ~[spring-beans-6.0.0-M5.jar:6.0.0-M5]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.determineConstructorsFromBeanPostProcessors(AbstractAutowireCapableBeanFactory.java:1282) ~[spring-beans-6.0.0-M5.jar:6.0.0-M5]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1184) ~[spring-beans-6.0.0-M5.jar:6.0.0-M5]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:566) ~[spring-beans-6.0.0-M5.jar:6.0.0-M5]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:526) ~[spring-beans-6.0.0-M5.jar:6.0.0-M5]
    at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:326) ~[spring-beans-6.0.0-M5.jar:6.0.0-M5]
    at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234) ~[spring-beans-6.0.0-M5.jar:6.0.0-M5]
    at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:324) ~[spring-beans-6.0.0-M5.jar:6.0.0-M5]
    at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:200) ~[spring-beans-6.0.0-M5.jar:6.0.0-M5]
    at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:930) ~[spring-beans-6.0.0-M5.jar:6.0.0-M5]
    at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:926) ~[spring-context-6.0.0-M5.jar:6.0.0-M5]
    at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:592) ~[spring-context-6.0.0-M5.jar:6.0.0-M5]
    at run.halo.app.plugin.PluginApplicationInitializer.initApplicationContext(PluginApplicationInitializer.java:104) ~[main/:na]
    at run.halo.app.plugin.PluginApplicationInitializer.onStartUp(PluginApplicationInitializer.java:120) ~[main/:na]
    at run.halo.app.plugin.HaloPluginManager.doStartPlugin(HaloPluginManager.java:279) ~[main/:na]
    at run.halo.app.plugin.HaloPluginManager.startPlugin(HaloPluginManager.java:235) ~[main/:na]
    at run.halo.app.core.extension.reconciler.PluginReconciler.startPlugin(PluginReconciler.java:129) ~[main/:na]
    at run.halo.app.core.extension.reconciler.PluginReconciler.reconcilePluginState(PluginReconciler.java:96) ~[main/:na]
    at run.halo.app.core.extension.reconciler.PluginReconciler.lambda$reconcile$0(PluginReconciler.java:51) ~[main/:na]
    at java.base/java.util.Optional.map(Optional.java:260) ~[na:na]
    at run.halo.app.core.extension.reconciler.PluginReconciler.reconcile(PluginReconciler.java:48) ~[main/:na]
    at run.halo.app.core.extension.reconciler.PluginReconciler.reconcile(PluginReconciler.java:29) ~[main/:na]
    at run.halo.app.extension.controller.DefaultController.run(DefaultController.java:102) ~[main/:na]
    at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:539) ~[na:na]
    at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264) ~[na:na]
    at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136) ~[na:na]
    at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635) ~[na:na]
    at java.base/java.lang.Thread.run(Thread.java:833) ~[na:na]
Caused by: java.lang.IllegalStateException: Failed to introspect Class [run.halo.alioss.AliOssAttachmentHandler] from ClassLoader [org.pf4j.PluginClassLoader@55713857]
    at org.springframework.util.ReflectionUtils.getDeclaredMethods(ReflectionUtils.java:483) ~[spring-core-6.0.0-M5.jar:6.0.0-M5]
    at org.springframework.util.ReflectionUtils.doWithLocalMethods(ReflectionUtils.java:320) ~[spring-core-6.0.0-M5.jar:6.0.0-M5]
    at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.determineCandidateConstructors(AutowiredAnnotationBeanPostProcessor.java:325) ~[spring-beans-6.0.0-M5.jar:6.0.0-M5]
    ... 27 common frames omitted
Caused by: java.lang.NoClassDefFoundError: com/aliyun/oss/OSSException
    at java.base/java.lang.Class.getDeclaredMethods0(Native Method) ~[na:na]
    at java.base/java.lang.Class.privateGetDeclaredMethods(Class.java:3402) ~[na:na]
    at java.base/java.lang.Class.getDeclaredMethods(Class.java:2504) ~[na:na]
    at org.springframework.util.ReflectionUtils.getDeclaredMethods(ReflectionUtils.java:465) ~[spring-core-6.0.0-M5.jar:6.0.0-M5]
    ... 29 common frames omitted
Caused by: java.lang.ClassNotFoundException: com.aliyun.oss.OSSException
    at org.pf4j.PluginClassLoader.loadClass(PluginClassLoader.java:144) ~[pf4j-3.6.0.jar:3.6.0]
    ... 33 common frames omitted

2022-09-17T20:38:25.544+08:00 DEBUG 8718 --- [pool-6-thread-1] r.h.app.plugin.SpringComponentsFinder    : Removing components storage from cache [PluginAliOSS].
2022-09-17T20:38:25.545+08:00 DEBUG 8718 --- [pool-4-thread-1] o.s.r2dbc.core.DefaultDatabaseClient     : Executing SQL statement [SELECT extensions.* FROM extensions WHERE extensions.name = $1 LIMIT 2]
2022-09-17T20:38:25.545+08:00 DEBUG 8718 --- [pool-4-thread-1] o.s.r2dbc.core.DefaultDatabaseClient     : Executing SQL statement [SELECT extensions.* FROM extensions WHERE extensions.name = $1 LIMIT 2]
2022-09-17T20:38:25.547+08:00 DEBUG 8718 --- [pool-4-thread-1] o.s.r2dbc.core.DefaultDatabaseClient     : Executing SQL statement [SELECT extensions.* FROM extensions WHERE extensions.name = $1 LIMIT 2]
2022-09-17T20:38:25.548+08:00 DEBUG 8718 --- [pool-4-thread-1] o.s.r2dbc.core.DefaultDatabaseClient     : Executing SQL statement [SELECT extensions.* FROM extensions WHERE extensions.name = $1 LIMIT 2]
2022-09-17T20:38:25.559+08:00 DEBUG 8718 --- [pool-4-thread-1] o.s.r2dbc.core.DefaultDatabaseClient     : Executing SQL statement [SELECT extensions.* FROM extensions WHERE extensions.name = $1 LIMIT 2]
2022-09-17T20:38:25.561+08:00 DEBUG 8718 --- [pool-4-thread-1] o.s.r2dbc.core.DefaultDatabaseClient     : Executing SQL statement [SELECT extensions.* FROM extensions WHERE extensions.name = $1 LIMIT 2]
2022-09-17T20:38:25.562+08:00 DEBUG 8718 --- [pool-4-thread-1] o.s.r2dbc.core.DefaultDatabaseClient     : Executing SQL statement [SELECT extensions.* FROM extensions WHERE extensions.name = $1 LIMIT 2]
2022-09-17T20:38:25.564+08:00 DEBUG 8718 --- [pool-4-thread-1] o.s.r2dbc.core.DefaultDatabaseClient     : Executing SQL statement [SELECT extensions.* FROM extensions WHERE extensions.name = $1 LIMIT 2]
2022-09-17T20:38:25.566+08:00 DEBUG 8718 --- [pool-4-thread-1] o.s.r2dbc.core.DefaultDatabaseClient     : Executing SQL statement [SELECT extensions.* FROM extensions WHERE extensions.name = $1 LIMIT 2]
2022-09-17T20:38:25.567+08:00 DEBUG 8718 --- [pool-4-thread-1] o.s.r2dbc.core.DefaultDatabaseClient     : Executing SQL statement [SELECT extensions.* FROM extensions WHERE extensions.name = $1 LIMIT 2]
2022-09-17T20:38:25.568+08:00 DEBUG 8718 --- [pool-4-thread-1] o.s.r2dbc.core.DefaultDatabaseClient     : Executing SQL statement [SELECT extensions.* FROM extensions WHERE extensions.name = $1 LIMIT 2]
2022-09-17T20:38:25.569+08:00 DEBUG 8718 --- [pool-4-thread-1] o.s.r2dbc.core.DefaultDatabaseClient     : Executing SQL statement [SELECT extensions.* FROM extensions WHERE extensions.name = $1 LIMIT 2]
2022-09-17T20:38:25.571+08:00 DEBUG 8718 --- [pool-4-thread-1] o.s.r2dbc.core.DefaultDatabaseClient     : Executing SQL statement [SELECT extensions.* FROM extensions WHERE extensions.name = $1 LIMIT 2]
2022-09-17T20:38:25.573+08:00 DEBUG 8718 --- [pool-4-thread-1] o.s.r2dbc.core.DefaultDatabaseClient     : Executing SQL statement [SELECT extensions.* FROM extensions WHERE extensions.name = $1 LIMIT 2]
2022-09-17T20:38:25.574+08:00 DEBUG 8718 --- [pool-4-thread-1] o.s.r2dbc.core.DefaultDatabaseClient     : Executing SQL statement [SELECT extensions.* FROM extensions WHERE extensions.name = $1 LIMIT 2]
2022-09-17T20:38:25.575+08:00 DEBUG 8718 --- [pool-4-thread-1] o.s.r2dbc.core.DefaultDatabaseClient     : Executing SQL statement [SELECT extensions.* FROM extensions WHERE extensions.name = $1 LIMIT 2]
2022-09-17T20:38:25.576+08:00 DEBUG 8718 --- [pool-4-thread-1] o.s.r2dbc.core.DefaultDatabaseClient     : Executing SQL statement [SELECT extensions.* FROM extensions WHERE extensions.name = $1 LIMIT 2]
2022-09-17T20:38:25.577+08:00 DEBUG 8718 --- [pool-4-thread-1] o.s.r2dbc.core.DefaultDatabaseClient     : Executing SQL statement [SELECT extensions.* FROM extensions WHERE extensions.name = $1 LIMIT 2]
2022-09-17T20:38:25.579+08:00 DEBUG 8718 --- [pool-4-thread-1] o.s.r2dbc.core.DefaultDatabaseClient     : Executing SQL statement [SELECT extensions.* FROM extensions WHERE extensions.name = $1 LIMIT 2]
2022-09-17T20:38:25.580+08:00 DEBUG 8718 --- [pool-4-thread-1] o.s.r2dbc.core.DefaultDatabaseClient     : Executing SQL statement [SELECT extensions.* FROM extensions WHERE extensions.name = $1 LIMIT 2]
2022-09-17T20:38:25.584+08:00 DEBUG 8718 --- [pool-4-thread-1] o.s.r2dbc.core.DefaultDatabaseClient     : Executing SQL statement [SELECT extensions.* FROM extensions WHERE extensions.name = $1 LIMIT 2]
2022-09-17T20:38:25.584+08:00 DEBUG 8718 --- [pool-4-thread-1] o.s.r2dbc.core.DefaultDatabaseClient     : Executing SQL statement [UPDATE extensions SET data = $1, version = $2 WHERE extensions.name = $3 AND (extensions.version = $4)]
2022-09-17T20:38:25.586+08:00 DEBUG 8718 --- [pool-4-thread-1] o.s.r2dbc.core.DefaultDatabaseClient     : Executing SQL statement [SELECT extensions.* FROM extensions WHERE extensions.name = $1 LIMIT 2]
2022-09-17T20:38:25.586+08:00 DEBUG 8718 --- [ool-14-thread-1] r.h.a.e.controller.DefaultDelayQueue     : Adding request Request[name=c45bcc5a-0e35-4141-b273-fe6f906852ef] immediately
2022-09-17T20:38:25.586+08:00 DEBUG 8718 --- [ool-14-thread-1] r.h.a.e.controller.DefaultController     : Reconciled request: Request[name=c45bcc5a-0e35-4141-b273-fe6f906852ef] with result: null
2022-09-17T20:38:25.586+08:00 DEBUG 8718 --- [ool-14-thread-1] r.h.a.e.controller.DefaultController     : StopWatch 'Reconcile: Request[name=c45bcc5a-0e35-4141-b273-fe6f906852ef]': running time = 89847500 ns; [reconciliation] took 89847500 ns = 100%
2022-09-17T20:38:25.586+08:00 DEBUG 8718 --- [pool-4-thread-1] o.s.r2dbc.core.DefaultDatabaseClient     : Executing SQL statement [UPDATE extensions SET data = $1, version = $2 WHERE extensions.name = $3 AND (extensions.version = $4)]
2022-09-17T20:38:25.587+08:00 DEBUG 8718 --- [pool-4-thread-1] r.h.a.i.ExtensionResourceInitializer     : Initialized extension resource: storage.halo.run/v1alpha1/PolicyTemplate/local
2022-09-17T20:38:25.587+08:00 DEBUG 8718 --- [pool-4-thread-1] o.s.r2dbc.core.DefaultDatabaseClient     : Executing SQL statement [SELECT extensions.name, extensions.data, extensions.version FROM extensions WHERE extensions.name LIKE $1]
2022-09-17T20:38:25.588+08:00 DEBUG 8718 --- [pool-4-thread-1] o.s.r2dbc.core.DefaultDatabaseClient     : Executing SQL statement [UPDATE extensions SET data = $1, version = $2 WHERE extensions.name = $3 AND (extensions.version = $4)]
2022-09-17T20:38:25.589+08:00 DEBUG 8718 --- [pool-4-thread-1] r.h.a.i.ExtensionResourceInitializer     : Initialized extension resource: v1alpha1/Setting/local-policy-template-setting
2022-09-17T20:38:25.589+08:00 DEBUG 8718 --- [pool-4-thread-1] o.s.r2dbc.core.DefaultDatabaseClient     : Executing SQL statement [SELECT extensions.name, extensions.data, extensions.version FROM extensions WHERE extensions.name LIKE $1]
2022-09-17T20:38:25.590+08:00 DEBUG 8718 --- [pool-4-thread-1] o.s.r2dbc.core.DefaultDatabaseClient     : Executing SQL statement [UPDATE extensions SET data = $1, version = $2 WHERE extensions.name = $3 AND (extensions.version = $4)]
2022-09-17T20:38:25.590+08:00 DEBUG 8718 --- [pool-4-thread-1] r.h.a.i.ExtensionResourceInitializer     : Initialized extension resource: v1alpha1/Role/anonymous
2022-09-17T20:38:25.590+08:00 DEBUG 8718 --- [pool-4-thread-1] o.s.r2dbc.core.DefaultDatabaseClient     : Executing SQL statement [SELECT extensions.* FROM extensions WHERE extensions.name = $1 LIMIT 2]
2022-09-17T20:38:25.591+08:00 DEBUG 8718 --- [pool-4-thread-1] o.s.r2dbc.core.DefaultDatabaseClient     : Executing SQL statement [UPDATE extensions SET data = $1, version = $2 WHERE extensions.name = $3 AND (extensions.version = $4)]
2022-09-17T20:38:25.591+08:00 DEBUG 8718 --- [pool-8-thread-1] r.h.a.e.controller.DefaultController     : Reconciled request: Request[name=34bcd76b-8d18-43b5-aaf4-dfcd064c8d7b] with result: Result[reEnqueue=false, retryAfter=null]
2022-09-17T20:38:25.591+08:00 DEBUG 8718 --- [pool-8-thread-1] r.h.a.e.controller.DefaultController     : StopWatch 'Reconcile: Request[name=34bcd76b-8d18-43b5-aaf4-dfcd064c8d7b]': running time = 84474958 ns; [reconciliation] took 84474958 ns = 100%
2022-09-17T20:38:25.591+08:00 DEBUG 8718 --- [pool-4-thread-1] r.h.a.i.ExtensionResourceInitializer     : Initialized extension resource: v1alpha1/Role/authenticated
2022-09-17T20:38:25.591+08:00 DEBUG 8718 --- [pool-4-thread-1] o.s.r2dbc.core.DefaultDatabaseClient     : Executing SQL statement [UPDATE extensions SET data = $1, version = $2 WHERE extensions.name = $3 AND (extensions.version = $4)]
2022-09-17T20:38:25.592+08:00 DEBUG 8718 --- [pool-4-thread-1] o.s.r2dbc.core.DefaultDatabaseClient     : Executing SQL statement [UPDATE extensions SET data = $1, version = $2 WHERE extensions.name = $3 AND (extensions.version = $4)]
2022-09-17T20:38:25.592+08:00 DEBUG 8718 --- [pool-6-thread-1] r.h.a.e.controller.DefaultDelayQueue     : Adding request Request[name=PluginAliOSS] immediately
2022-09-17T20:38:25.592+08:00 DEBUG 8718 --- [pool-4-thread-1] r.h.a.i.ExtensionResourceInitializer     : Initialized extension resource: v1alpha1/Role/role-template-own-user-info
2022-09-17T20:38:25.592+08:00 ERROR 8718 --- [pool-6-thread-1] r.h.a.c.e.reconciler.PluginReconciler    : Error creating bean with name 'run.halo.alioss.AliOssAttachmentHandler': Lookup method resolution failed

org.pf4j.PluginRuntimeException: Error creating bean with name 'run.halo.alioss.AliOssAttachmentHandler': Lookup method resolution failed
    at run.halo.app.core.extension.reconciler.PluginReconciler.handleStatus(PluginReconciler.java:169) ~[main/:na]
    at run.halo.app.core.extension.reconciler.PluginReconciler.startPlugin(PluginReconciler.java:130) ~[main/:na]
    at run.halo.app.core.extension.reconciler.PluginReconciler.reconcilePluginState(PluginReconciler.java:96) ~[main/:na]
    at run.halo.app.core.extension.reconciler.PluginReconciler.lambda$reconcile$0(PluginReconciler.java:51) ~[main/:na]
    at java.base/java.util.Optional.map(Optional.java:260) ~[na:na]
    at run.halo.app.core.extension.reconciler.PluginReconciler.reconcile(PluginReconciler.java:48) ~[main/:na]
    at run.halo.app.core.extension.reconciler.PluginReconciler.reconcile(PluginReconciler.java:29) ~[main/:na]
    at run.halo.app.extension.controller.DefaultController.run(DefaultController.java:102) ~[main/:na]
    at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:539) ~[na:na]
    at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264) ~[na:na]
    at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136) ~[na:na]
    at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635) ~[na:na]
    at java.base/java.lang.Thread.run(Thread.java:833) ~[na:na]

在 deployment 模式上传 JAR 可以正常运行使用。

JohnNiang commented 1 year ago

/assign