您好,我是 Java、Spring 和 Gluu 的新手,如果我错了,请纠正我 :)
我正在尝试构建一个 jar 文件库来支持 Gluu IDP 中的自定义身份验证
根据文档,Gluu 使用 Jython-python 语言编译和执行自定义脚本
我使用 Eclipse Luna IDE 测试我的 Jython-python,并导入我的 jar 文件,它工作正常
然后我使用构建 Jar 文件maven-assembly-plugin
,这是我的 pom.xml 文件
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.fns</groupId>
<artifactId>gluu</artifactId>
<version>0.0.8-SNAPSHOT</version>
<name>gluu</name>
<!-- FIXME change it to the project's website -->
<url>http://gluubionic.local.io</url>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
<!-- Please keep (version) properties in alphabetical order! -->
<junit.version>4.12</junit.version>
<gluu.version>4.1</gluu.version>
<resteasy.version>3.0.14.Final</resteasy.version>
</properties>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>${junit.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring</artifactId>
<version>5.3.5</version>
<type>pom</type>
</dependency>
<!-- WebSocket Library-->
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-websocket</artifactId>
<version>5.2.8.RELEASE</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-messaging</artifactId>
<version>5.2.8.RELEASE</version>
</dependency>
<dependency>
<groupId>org.glassfish.tyrus.bundles</groupId>
<artifactId>tyrus-standalone-client</artifactId>
<version>1.13.1</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
<version>2.9.4</version>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<version>1.18.12</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-classic</artifactId>
<version>1.2.3</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-enforcer-plugin</artifactId>
<version>1.4.1</version>
<configuration>
<rules><dependencyConvergence/></rules>
</configuration>
</plugin>
<!-- dependency 들을 모두 포함하기위한 -->
<plugin>
<artifactId>maven-assembly-plugin</artifactId>
<version>2.6</version>
<configuration>
<descriptorRefs>
<descriptorRef>jar-with-dependencies</descriptorRef>
</descriptorRefs>
<archive>
<manifest>
<mainClass>com.test.gluu.TestMain</mainClass>
</manifest>
</archive>
</configuration>
<executions>
<execution>
<id>make-assembly</id>
<phase>package</phase>
<goals>
<goal>single</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
然后,我使用 windows 对其进行了测试cmd
,java -jar gluu-0.0.8-SNAPSHOT.jar
它也可以正常工作
但是,在我将其提交到 Gluu 并对其进行测试后,Gluu 向我显示此错误
2021-03-23 07:00:38,904 ERROR [SimpleAsyncTaskExecutor-1] [com.fns.gluu.utils.HttpUtils$1] (HttpUtils.java:120) - connectSocket handleTransportError
java.lang.NoClassDefFoundError: org/springframework/util/LinkedCaseInsensitiveMap$EntrySet
at org.springframework.util.LinkedCaseInsensitiveMap.entrySet(LinkedCaseInsensitiveMap.java:264) ~[?:?]
at org.springframework.util.MultiValueMapAdapter.entrySet(MultiValueMapAdapter.java:160) ~[?:?]
at org.springframework.http.HttpHeaders.entrySet(HttpHeaders.java:1738) ~[?:?]
at java.util.AbstractMap.putAll(AbstractMap.java:280) ~[?:1.8.0_222]
at java.util.TreeMap.putAll(TreeMap.java:327) ~[?:1.8.0_222]
at org.springframework.web.socket.client.standard.StandardWebSocketClient$StandardWebSocketClientConfigurator.beforeRequest(StandardWebSocketClient.java:201) ~[?:?]
at org.eclipse.jetty.websocket.jsr356.JsrUpgradeListener.onHandshakeRequest(JsrUpgradeListener.java:47) ~[javax-websocket-client-impl-9.4.26.v20200117.jar:9.4.26.v20200117]
at org.eclipse.jetty.websocket.client.WebSocketUpgradeRequest.initWebSocketHeaders(WebSocketUpgradeRequest.java:486) ~[websocket-client-9.4.26.v20200117.jar:9.4.26.v20200117]
at org.eclipse.jetty.websocket.client.WebSocketUpgradeRequest.send(WebSocketUpgradeRequest.java:559) ~[websocket-client-9.4.26.v20200117.jar:9.4.26.v20200117]
at org.eclipse.jetty.websocket.client.WebSocketUpgradeRequest.sendAsync(WebSocketUpgradeRequest.java:565) ~[websocket-client-9.4.26.v20200117.jar:9.4.26.v20200117]
at org.eclipse.jetty.websocket.client.WebSocketClient.connect(WebSocketClient.java:379) ~[websocket-client-9.4.26.v20200117.jar:9.4.26.v20200117]
at org.eclipse.jetty.websocket.jsr356.ClientContainer.connect(ClientContainer.java:242) ~[javax-websocket-client-impl-9.4.26.v20200117.jar:9.4.26.v20200117]
at org.eclipse.jetty.websocket.jsr356.ClientContainer.connectToServer(ClientContainer.java:286) ~[javax-websocket-client-impl-9.4.26.v20200117.jar:9.4.26.v20200117]
at org.springframework.web.socket.client.standard.StandardWebSocketClient.lambda$doHandshakeInternal$0(StandardWebSocketClient.java:151) ~[?:?]
at java.util.concurrent.FutureTask.run(FutureTask.java:266) [?:1.8.0_222]
at java.lang.Thread.run(Thread.java:748) [?:1.8.0_222]
Caused by: java.lang.ClassNotFoundException: org.springframework.util.LinkedCaseInsensitiveMap$EntrySet
at org.python.core.SyspathJavaLoader.findClass(SyspathJavaLoader.java:128) ~[jython-standalone-2.7.2.jar:2.7.2]
at java.lang.ClassLoader.loadClass(ClassLoader.java:424) ~[?:1.8.0_222]
at java.lang.ClassLoader.loadClass(ClassLoader.java:357) ~[?:1.8.0_222]
... 16 more
2021-03-23 07:00:38,903 ERROR [qtp1590550415-15] [com.fns.gluu.utils.HttpUtils] (HttpUtils.java:130) - WebSocketService ExecutionException.
java.util.concurrent.ExecutionException: java.lang.NoClassDefFoundError: org/springframework/util/LinkedCaseInsensitiveMap$EntrySet
at java.util.concurrent.FutureTask.report(FutureTask.java:122) ~[?:1.8.0_222]
at java.util.concurrent.FutureTask.get(FutureTask.java:206) ~[?:1.8.0_222]
at org.springframework.util.concurrent.SettableListenableFuture.get(SettableListenableFuture.java:134) ~[?:?]
at com.fns.gluu.utils.HttpUtils.connectSocket(HttpUtils.java:124) ~[?:?]
at com.fns.gluu.api.GuardianApiService.checkAuthStatus(GuardianApiService.java:82) ~[?:?]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_222]
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:1.8.0_222]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_222]
at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_222]
at org.python.core.PyReflectedFunction.__call__(PyReflectedFunction.java:190) ~[jython-standalone-2.7.2.jar:2.7.2]
at org.python.core.PyReflectedFunction.__call__(PyReflectedFunction.java:208) ~[jython-standalone-2.7.2.jar:2.7.2]
at org.python.core.PyObject.__call__(PyObject.java:477) ~[jython-standalone-2.7.2.jar:2.7.2]
at org.python.core.PyObject.__call__(PyObject.java:481) ~[jython-standalone-2.7.2.jar:2.7.2]
at org.python.core.PyMethod.__call__(PyMethod.java:141) ~[jython-standalone-2.7.2.jar:2.7.2]
at org.python.pycode._pyx4.authenticate$9(gccs_test.py:105) ~[?:?]
at org.python.pycode._pyx4.call_function(gccs_test.py) ~[?:?]
at org.python.core.PyTableCode.call(PyTableCode.java:173) ~[jython-standalone-2.7.2.jar:2.7.2]
at org.python.core.PyBaseCode.call(PyBaseCode.java:306) ~[jython-standalone-2.7.2.jar:2.7.2]
at org.python.core.PyBaseCode.call(PyBaseCode.java:197) ~[jython-standalone-2.7.2.jar:2.7.2]
at org.python.core.PyFunction.__call__(PyFunction.java:485) ~[jython-standalone-2.7.2.jar:2.7.2]
at org.python.core.PyMethod.instancemethod___call__(PyMethod.java:237) ~[jython-standalone-2.7.2.jar:2.7.2]
at org.python.core.PyMethod.__call__(PyMethod.java:228) ~[jython-standalone-2.7.2.jar:2.7.2]
at org.python.core.PyMethod.__call__(PyMethod.java:218) ~[jython-standalone-2.7.2.jar:2.7.2]
at org.python.core.PyMethod.__call__(PyMethod.java:213) ~[jython-standalone-2.7.2.jar:2.7.2]
at org.python.core.PyObject._jcallexc(PyObject.java:3565) ~[jython-standalone-2.7.2.jar:2.7.2]
at org.python.core.PyObject._jcall(PyObject.java:3598) ~[jython-standalone-2.7.2.jar:2.7.2]
at org.python.proxies.__main__$PersonAuthentication$4.authenticate(Unknown Source) ~[?:?]
at org.gluu.oxauth.service.external.ExternalAuthenticationService.executeExternalAuthenticate(ExternalAuthenticationService.java:196) ~[classes/:?]
at org.gluu.oxauth.service.external.ExternalAuthenticationService$Proxy$_$_WeldClientProxy.executeExternalAuthenticate(Unknown Source) ~[classes/:?]
at org.gluu.oxauth.auth.Authenticator.userAuthenticationInteractive(Authenticator.java:321) ~[classes/:?]
at org.gluu.oxauth.auth.Authenticator.authenticateImpl(Authenticator.java:204) ~[classes/:?]
at org.gluu.oxauth.auth.Authenticator.authenticate(Authenticator.java:132) ~[classes/:?]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_222]
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:1.8.0_222]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_222]
at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_222]
at org.apache.el.parser.AstValue.invoke(AstValue.java:247) ~[org.mortbay.jasper.apache-el-8.5.40.jar:8.5.40]
at org.apache.el.MethodExpressionImpl.invoke(MethodExpressionImpl.java:267) ~[org.mortbay.jasper.apache-el-8.5.40.jar:8.5.40]
at org.jboss.weld.module.web.util.el.ForwardingMethodExpression.invoke(ForwardingMethodExpression.java:40) ~[weld-web-3.1.2.Final.jar:3.1.2.Final]
at org.jboss.weld.module.web.el.WeldMethodExpression.invoke(WeldMethodExpression.java:50) ~[weld-web-3.1.2.Final.jar:3.1.2.Final]
at com.sun.faces.facelets.el.TagMethodExpression.invoke(TagMethodExpression.java:107) ~[javax.faces-2.3.9.jar:2.3.9]
at javax.faces.component.MethodBindingMethodExpressionAdapter.invoke(MethodBindingMethodExpressionAdapter.java:87) ~[javax.faces-2.3.9.jar:2.3.9]
at com.sun.faces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:102) ~[javax.faces-2.3.9.jar:2.3.9]
at javax.faces.component.UICommand.broadcast(UICommand.java:330) ~[javax.faces-2.3.9.jar:2.3.9]
at javax.faces.component.UIViewRoot.broadcastEvents(UIViewRoot.java:870) ~[javax.faces-2.3.9.jar:2.3.9]
at javax.faces.component.UIViewRoot.processApplication(UIViewRoot.java:1418) ~[javax.faces-2.3.9.jar:2.3.9]
at com.sun.faces.lifecycle.InvokeApplicationPhase.execute(InvokeApplicationPhase.java:82) ~[javax.faces-2.3.9.jar:2.3.9]
at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:100) ~[javax.faces-2.3.9.jar:2.3.9]
at com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:201) ~[javax.faces-2.3.9.jar:2.3.9]
at javax.faces.webapp.FacesServlet.service(FacesServlet.java:670) ~[javax.faces-2.3.9.jar:2.3.9]
at org.eclipse.jetty.servlet.ServletHolder$NotAsyncServlet.service(ServletHolder.java:1395) ~[jetty-servlet-9.4.26.v20200117.jar:9.4.26.v20200117]
at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:755) ~[jetty-servlet-9.4.26.v20200117.jar:9.4.26.v20200117]
at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1617) ~[jetty-servlet-9.4.26.v20200117.jar:9.4.26.v20200117]
at org.eclipse.jetty.websocket.server.WebSocketUpgradeFilter.doFilter(WebSocketUpgradeFilter.java:226) ~[websocket-server-9.4.26.v20200117.jar:9.4.26.v20200117]
at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1604) ~[jetty-servlet-9.4.26.v20200117.jar:9.4.26.v20200117]
at org.gluu.oxauth.audit.debug.ServletLoggingFilter.doFilter(ServletLoggingFilter.java:67) ~[classes/:?]
at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1596) ~[jetty-servlet-9.4.26.v20200117.jar:9.4.26.v20200117]
at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:545) ~[jetty-servlet-9.4.26.v20200117.jar:9.4.26.v20200117]
at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:143) ~[jetty-server-9.4.26.v20200117.jar:9.4.26.v20200117]
at org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:590) ~[jetty-security-9.4.26.v20200117.jar:9.4.26.v20200117]
at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:127) ~[jetty-server-9.4.26.v20200117.jar:9.4.26.v20200117]
at org.eclipse.jetty.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:235) ~[jetty-server-9.4.26.v20200117.jar:9.4.26.v20200117]
at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:1607) ~[jetty-server-9.4.26.v20200117.jar:9.4.26.v20200117]
at org.eclipse.jetty.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:233) ~[jetty-server-9.4.26.v20200117.jar:9.4.26.v20200117]
at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1297) ~[jetty-server-9.4.26.v20200117.jar:9.4.26.v20200117]
at org.eclipse.jetty.server.handler.ScopedHandler.nextScope(ScopedHandler.java:188) ~[jetty-server-9.4.26.v20200117.jar:9.4.26.v20200117]
at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:485) ~[jetty-servlet-9.4.26.v20200117.jar:9.4.26.v20200117]
at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:1577) ~[jetty-server-9.4.26.v20200117.jar:9.4.26.v20200117]
at org.eclipse.jetty.server.handler.ScopedHandler.nextScope(ScopedHandler.java:186) ~[jetty-server-9.4.26.v20200117.jar:9.4.26.v20200117]
at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1212) ~[jetty-server-9.4.26.v20200117.jar:9.4.26.v20200117]
at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:141) ~[jetty-server-9.4.26.v20200117.jar:9.4.26.v20200117]
at org.eclipse.jetty.server.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:221) ~[jetty-server-9.4.26.v20200117.jar:9.4.26.v20200117]
at org.eclipse.jetty.server.handler.HandlerCollection.handle(HandlerCollection.java:146) ~[jetty-server-9.4.26.v20200117.jar:9.4.26.v20200117]
at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:127) ~[jetty-server-9.4.26.v20200117.jar:9.4.26.v20200117]
at org.eclipse.jetty.server.Server.handle(Server.java:500) ~[jetty-server-9.4.26.v20200117.jar:9.4.26.v20200117]
at org.eclipse.jetty.server.HttpChannel.lambda$handle$1(HttpChannel.java:383) ~[jetty-server-9.4.26.v20200117.jar:9.4.26.v20200117]
at org.eclipse.jetty.server.HttpChannel.dispatch(HttpChannel.java:547) [jetty-server-9.4.26.v20200117.jar:9.4.26.v20200117]
at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:375) [jetty-server-9.4.26.v20200117.jar:9.4.26.v20200117]
at org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:270) [jetty-server-9.4.26.v20200117.jar:9.4.26.v20200117]
at org.eclipse.jetty.io.AbstractConnection$ReadCallback.succeeded(AbstractConnection.java:311) [jetty-io-9.4.26.v20200117.jar:9.4.26.v20200117]
at org.eclipse.jetty.io.FillInterest.fillable(FillInterest.java:103) [jetty-io-9.4.26.v20200117.jar:9.4.26.v20200117]
at org.eclipse.jetty.io.ChannelEndPoint$2.run(ChannelEndPoint.java:117) [jetty-io-9.4.26.v20200117.jar:9.4.26.v20200117]
at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.runTask(EatWhatYouKill.java:336) [jetty-util-9.4.26.v20200117.jar:9.4.26.v20200117]
at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.doProduce(EatWhatYouKill.java:313) [jetty-util-9.4.26.v20200117.jar:9.4.26.v20200117]
at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.tryProduce(EatWhatYouKill.java:171) [jetty-util-9.4.26.v20200117.jar:9.4.26.v20200117]
at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.run(EatWhatYouKill.java:129) [jetty-util-9.4.26.v20200117.jar:9.4.26.v20200117]
at org.eclipse.jetty.util.thread.ReservedThreadExecutor$ReservedThread.run(ReservedThreadExecutor.java:388) [jetty-util-9.4.26.v20200117.jar:9.4.26.v20200117]
at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:806) [jetty-util-9.4.26.v20200117.jar:9.4.26.v20200117]
at org.eclipse.jetty.util.thread.QueuedThreadPool$Runner.run(QueuedThreadPool.java:938) [jetty-util-9.4.26.v20200117.jar:9.4.26.v20200117]
at java.lang.Thread.run(Thread.java:748) [?:1.8.0_222]
Caused by: java.lang.NoClassDefFoundError: org/springframework/util/LinkedCaseInsensitiveMap$EntrySet
at org.springframework.util.LinkedCaseInsensitiveMap.entrySet(LinkedCaseInsensitiveMap.java:264) ~[?:?]
at org.springframework.util.MultiValueMapAdapter.entrySet(MultiValueMapAdapter.java:160) ~[?:?]
at org.springframework.http.HttpHeaders.entrySet(HttpHeaders.java:1738) ~[?:?]
at java.util.AbstractMap.putAll(AbstractMap.java:280) ~[?:1.8.0_222]
at java.util.TreeMap.putAll(TreeMap.java:327) ~[?:1.8.0_222]
at org.springframework.web.socket.client.standard.StandardWebSocketClient$StandardWebSocketClientConfigurator.beforeRequest(StandardWebSocketClient.java:201) ~[?:?]
at org.eclipse.jetty.websocket.jsr356.JsrUpgradeListener.onHandshakeRequest(JsrUpgradeListener.java:47) ~[javax-websocket-client-impl-9.4.26.v20200117.jar:9.4.26.v20200117]
at org.eclipse.jetty.websocket.client.WebSocketUpgradeRequest.initWebSocketHeaders(WebSocketUpgradeRequest.java:486) ~[websocket-client-9.4.26.v20200117.jar:9.4.26.v20200117]
at org.eclipse.jetty.websocket.client.WebSocketUpgradeRequest.send(WebSocketUpgradeRequest.java:559) ~[websocket-client-9.4.26.v20200117.jar:9.4.26.v20200117]
at org.eclipse.jetty.websocket.client.WebSocketUpgradeRequest.sendAsync(WebSocketUpgradeRequest.java:565) ~[websocket-client-9.4.26.v20200117.jar:9.4.26.v20200117]
at org.eclipse.jetty.websocket.client.WebSocketClient.connect(WebSocketClient.java:379) ~[websocket-client-9.4.26.v20200117.jar:9.4.26.v20200117]
at org.eclipse.jetty.websocket.jsr356.ClientContainer.connect(ClientContainer.java:242) ~[javax-websocket-client-impl-9.4.26.v20200117.jar:9.4.26.v20200117]
at org.eclipse.jetty.websocket.jsr356.ClientContainer.connectToServer(ClientContainer.java:286) ~[javax-websocket-client-impl-9.4.26.v20200117.jar:9.4.26.v20200117]
at org.springframework.web.socket.client.standard.StandardWebSocketClient.lambda$doHandshakeInternal$0(StandardWebSocketClient.java:151) ~[?:?]
at java.util.concurrent.FutureTask.run(FutureTask.java:266) ~[?:1.8.0_222]
... 1 more
我很困惑,因为org/springframework/util/LinkedCaseInsensitiveMap$EntrySet
jar 文件中已经存在。
根据我的代码,这是因为我想使用WebSocketStompClient.connect
来自的函数进行 Stomp 连接org.springframework.web.socket.messaging.WebSocketStompClient
我在这里错过了一些步骤吗?
谢谢