gitlab4j / gitlab4j-api

GitLab4J API (gitlab4j-api) provides a full featured Java client library for working with GitLab repositories via the GitLab REST API
MIT License
1.07k stars 463 forks source link

Cannot deserialize value of type #1164

Closed wanghui22718 closed 1 month ago

wanghui22718 commented 2 months ago

gitlab4jversion:5.6.0 gitlab version:GitLab Community Edition [12.8.6

[Fri Sep 20 16:54:24 CST 2024] Starting branch indexing... ERROR: [Fri Sep 20 16:54:25 CST 2024] Could not update folder level actions from source [Fri Sep 20 16:54:25 CST 2024] Finished branch indexing. Indexing took 0.24 sec FATAL: Failed to recompute children of com.fasterxml.jackson.databind.exc.MismatchedInputException: Cannot deserialize value of type org.gitlab4j.api.models.Project from Array value (token JsonToken.START_ARRAY) at [Source: REDACTED (StreamReadFeature.INCLUDE_SOURCE_IN_LOCATION disabled); line: 1, column: 1] at com.fasterxml.jackson.databind.exc.MismatchedInputException.from(MismatchedInputException.java:59) at com.fasterxml.jackson.databind.DeserializationContext.reportInputMismatch(DeserializationContext.java:1767) at com.fasterxml.jackson.databind.DeserializationContext.handleUnexpectedToken(DeserializationContext.java:1541) at com.fasterxml.jackson.databind.DeserializationContext.handleUnexpectedToken(DeserializationContext.java:1488) at com.fasterxml.jackson.databind.deser.BeanDeserializer._deserializeFromArray(BeanDeserializer.java:654) at com.fasterxml.jackson.databind.deser.BeanDeserializer._deserializeOther(BeanDeserializer.java:211) at com.fasterxml.jackson.databind.deser.BeanDeserializer.deserialize(BeanDeserializer.java:187) at com.fasterxml.jackson.databind.deser.DefaultDeserializationContext.readRootValue(DefaultDeserializationContext.java:342) at com.fasterxml.jackson.databind.ObjectReader._bind(ObjectReader.java:2099) at com.fasterxml.jackson.databind.ObjectReader.readValue(ObjectReader.java:1249) at org.glassfish.jersey.jackson.internal.jackson.jaxrs.base.ProviderBase.readFrom(ProviderBase.java:829) at org.glassfish.jersey.message.internal.ReaderInterceptorExecutor$TerminalReaderInterceptor.invokeReadFrom(ReaderInterceptorExecutor.java:234) at org.glassfish.jersey.message.internal.ReaderInterceptorExecutor$TerminalReaderInterceptor.aroundReadFrom(ReaderInterceptorExecutor.java:213) at org.glassfish.jersey.message.internal.ReaderInterceptorExecutor.proceed(ReaderInterceptorExecutor.java:133) at org.glassfish.jersey.message.internal.MessageBodyFactory.readFrom(MessageBodyFactory.java:1072) at org.glassfish.jersey.message.internal.InboundMessageContext.readEntity(InboundMessageContext.java:666) Caused: javax.ws.rs.ProcessingException: Error reading entity from input stream. at org.glassfish.jersey.message.internal.InboundMessageContext.readEntity(InboundMessageContext.java:681) at org.glassfish.jersey.message.internal.InboundMessageContext.readEntity(InboundMessageContext.java:600) at org.glassfish.jersey.client.ClientResponse.readEntity(ClientResponse.java:298) at org.glassfish.jersey.client.InboundJaxrsResponse$1.call(InboundJaxrsResponse.java:93) at org.glassfish.jersey.internal.Errors.process(Errors.java:292) at org.glassfish.jersey.internal.Errors.process(Errors.java:274) at org.glassfish.jersey.internal.Errors.process(Errors.java:205) at org.glassfish.jersey.process.internal.RequestScope.runInScope(RequestScope.java:365) at org.glassfish.jersey.client.InboundJaxrsResponse.runInScopeIfPossible(InboundJaxrsResponse.java:244) at org.glassfish.jersey.client.InboundJaxrsResponse.readEntity(InboundJaxrsResponse.java:90) at org.gitlab4j.api.ProjectApi.getProject(ProjectApi.java:754) at org.gitlab4j.api.ProjectApi.getProject(ProjectApi.java:684) at io.jenkins.plugins.gitlabbranchsource.GitLabSCMSource.getGitlabProject(GitLabSCMSource.java:214) at io.jenkins.plugins.gitlabbranchsource.GitLabSCMSource.getGitlabProject(GitLabSCMSource.java:206) at io.jenkins.plugins.gitlabbranchsource.GitLabSCMSource.retrieveActions(GitLabSCMSource.java:612) at jenkins.scm.api.SCMSource.fetchActions(SCMSource.java:847) at jenkins.branch.MultiBranchProject.computeChildren(MultiBranchProject.java:611) at com.cloudbees.hudson.plugins.folder.computed.ComputedFolder.updateChildren(ComputedFolder.java:269) at com.cloudbees.hudson.plugins.folder.computed.FolderComputation.run(FolderComputation.java:167) at jenkins.branch.MultiBranchProject$BranchIndexing.run(MultiBranchProject.java:1057) at hudson.model.ResourceController.execute(ResourceController.java:101) at hudson.model.Executor.run(Executor.java:442) Finished: FAILURE

jmini commented 2 months ago

It seems that a jenkins plugin is calling org.gitlab4j.api.ProjectApi.getProject(ProjectApi.java:684)

Can you reproduce the same call outside of Jenkins?

Can you enable logs: see how to do it https://github.com/gitlab4j/gitlab4j-api/issues/1109#issuecomment-2051728505 (probably you need to be outside of Jenkins)

And can you reproduce the same call with curl or any other tool to see the complete JSON sent by GitLab in the response?

wanghui22718 commented 1 month ago

wrong setting in jenkins job settings, gitlab4j works well iii. Add path to the owner where the project you want to build exists. If user, enter username. If group, enter group name. If subgroup, enter subgroup path with namespace.