TFS SDK 11.0.0 - TFS 2015 更新 3 服务器 - NullPointerException 创建缺陷

TFS SDK 11.0.0 - TFS 2015 Update 3 Server - NullPointerException Create Defect

我们正在使用 TFS SDK 版本 11.0.0 库连接 "TFS: 2015 update 3" 以获取数据或创建缺陷(错误, 问题, ...)。但是,在使用 workItem.save() 方法创建新缺陷或更新现有缺陷时,我们会遇到 NullPointerException。我们是否将正确版本的 TFS SDK 与 'TFS 2015 update 3' 一起使用?我们是否需要从 TFS 2015 服务器配置任何特殊内容,以便 TFS SDK 可以创建新缺陷?如果我们做错了什么,请告知,如果您需要更多信息,请告诉我们。

您知道我们在哪里可以获得所有版本的 TFS SDK 吗?

非常感谢。

Maven 配置:

        <dependency>

            <groupId>com.microsoft.tfs.sdk</groupId>

            <artifactId>com.microsoft.tfs.sdk</artifactId>

            <version>11.0.0</version>

        </dependency>

使用 Java 代码创建缺陷: https://github.com/denimgroup/threadfix/blob/2.3/threadfix-main/src/main/java/com/denimgroup/threadfix/service/defects/utils/tfs/TFSClientImpl.java

    WorkItem item = client.newWorkItem(selectedWorkItemType);

    if (item == null) {

        LOG.warn("Unable to create item in TFS.");

        return null;

    }

    setValues(item, fieldsMap, description);

    String itemId = null;

    if (item.isValid()) {

        item.save(); // --> It throws NullPointerException after calling this save() method

        itemId = String.valueOf(item.getID());

    }

使用Java代码更新存在的缺陷:

    int workItemId = 6;

    WorkItem itemExisted = client.getWorkItemByID(workItemId);

    if(itemExisted != null && itemExisted.isValid()){

       System.out.println(">>>>>>>>>>>>>" + itemExisted.getTitle());

       itemExisted.setTitle("Updated to New Title Bug");

       itemExisted.save(); // It throws NullPointerException after calling this save() method 

    }   

NullPointException 详细信息:

    Cookie: $Version=0; Tfs-SessionId=bbeeb0ec-407f-4115-9a0d-c450cb6de785; $Path=/

    Cookie: $Version=0; Tfs-SessionActive=2019-04-26 20:53:21Z; $Path=/







    -1 <no status line>





    -- RESPONSE UNAVAILABLE --

    --------------------------------------------------------------------------------

    WARN [http-nio-8080-exec-4] TFSClientImpl.createDefect(409) | Ran into Exception while trying to save a work item.

    java.lang.NullPointerException

    at com.fasterxml.aalto.out.ByteXmlWriter.writeAttribute(ByteXmlWriter.java:461)

    at com.fasterxml.aalto.out.StreamWriterBase._writeDefaultNamespace(StreamWriterBase.java:1466)

    at com.fasterxml.aalto.out.NonRepairingStreamWriter.writeDefaultNamespace(NonRepairingStreamWriter.java:107)

    at com.microsoft.tfs.core.ws.runtime.types.DOMAnyContentType.writeElement(DOMAnyContentType.java:306)

    at com.microsoft.tfs.core.ws.runtime.types.DOMAnyContentType.writeElements(DOMAnyContentType.java:274)

    at com.microsoft.tfs.core.ws.runtime.types.DOMAnyContentType.writeAsElement(DOMAnyContentType.java:151)

    at ms.tfs.workitemtracking.clientservices._03._ClientService5Soap_Update.writeAsElement(_ClientService5Soap_Update.java:83)

    at ms.tfs.workitemtracking.clientservices._03._ClientService5Soap12Service.writeSOAPRequest(_ClientService5Soap12Service.java:898)

    at com.microsoft.tfs.core.ws.runtime.client.SOAPRequestEntity12.writeRequest(SOAPRequestEntity12.java:94)

    at com.microsoft.tfs.core.ws.runtime.client.BufferedSOAPRequestEntity.ensureRequestIsBuffered(BufferedSOAPRequestEntity.java:133)

    at com.microsoft.tfs.core.ws.runtime.client.BufferedSOAPRequestEntity.getContentLength(BufferedSOAPRequestEntity.java:65)

    at com.microsoft.tfs.core.httpclient.methods.EntityEnclosingMethod.getRequestContentLength(EntityEnclosingMethod.java:391)

    at com.microsoft.tfs.core.httpclient.methods.EntityEnclosingMethod.addContentLengthRequestHeader(EntityEnclosingMethod.java:474)

    at com.microsoft.tfs.core.httpclient.methods.EntityEnclosingMethod.addRequestHeaders(EntityEnclosingMethod.java:436)

    at com.microsoft.tfs.core.httpclient.HttpMethodBase.writeRequestHeaders(HttpMethodBase.java:2596)

    at com.microsoft.tfs.core.httpclient.HttpMethodBase.writeRequest(HttpMethodBase.java:2451)

    at com.microsoft.tfs.core.httpclient.HttpMethodBase.execute(HttpMethodBase.java:1313)

    at com.microsoft.tfs.core.httpclient.HttpMethodDirector.executeWithRetry(HttpMethodDirector.java:508)

    at com.microsoft.tfs.core.httpclient.HttpMethodDirector.executeMethod(HttpMethodDirector.java:197)

    at com.microsoft.tfs.core.httpclient.HttpClient.executeMethod(HttpClient.java:464)

    at com.microsoft.tfs.core.httpclient.HttpClient.executeMethod(HttpClient.java:376)

    at com.microsoft.tfs.core.ws.runtime.client.SOAPService.executeSOAPRequestInternal(SOAPService.java:588)

    at com.microsoft.tfs.core.ws.runtime.client.SOAPService.executeSOAPRequest(SOAPService.java:473)

    at ms.tfs.workitemtracking.clientservices._03._ClientService5Soap12Service.update(_ClientService5Soap12Service.java:909)

    at com.microsoft.tfs.core.clients.workitem.internal.update.BaseUpdatePackage.update(BaseUpdatePackage.java:88)

    at com.microsoft.tfs.core.clients.workitem.internal.WorkItemImpl.internalSave(WorkItemImpl.java:673)

    at com.microsoft.tfs.core.clients.workitem.internal.WorkItemImpl.save(WorkItemImpl.java:388)

    at com.denimgroup.threadfix.service.defects.utils.tfs.TFSClientImpl.createDefect(TFSClientImpl.java:396)

    at com.denimgroup.threadfix.service.defects.TFSDefectTracker.createDefect(TFSDefectTracker.java:77)

    at com.denimgroup.threadfix.service.DefectSubmissionServiceImpl.submitDefect(DefectSubmissionServiceImpl.java:42)

    at com.denimgroup.threadfix.service.DefectServiceImpl.createDefect(DefectServiceImpl.java:267)

    at sun.reflect.GeneratedMethodAccessor4695.invoke(Unknown Source)

    at java.lang.reflect.Method.invoke(Method.java:498)

    at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:317)

    at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:190)

    at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:157)

    at org.springframework.transaction.interceptor.TransactionInterceptor.proceedWithInvocation(TransactionInterceptor.java:99)

    at org.springframework.transaction.interceptor.TransactionAspectSupport.invokeWithinTransaction(TransactionAspectSupport.java:281)

    at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:96)

    at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)

    at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:207)

    at com.sun.proxy.$Proxy101.createDefect(Unknown Source)

    at com.denimgroup.threadfix.webapp.controller.DefectsController.onSubmit(DefectsController.java:112)

    at sun.reflect.GeneratedMethodAccessor4689.invoke(Unknown Source)

    at java.lang.reflect.Method.invoke(Method.java:498)

    at org.springframework.web.method.support.InvocableHandlerMethod.doInvoke(InvocableHandlerMethod.java:222)

    at org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:137)

    at org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:110)

    at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandlerMethod(RequestMappingHandlerAdapter.java:775)

    at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:705)

    at org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:85)

    at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:959)

    at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:893)

    at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:965)

    at org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:867)

    at javax.servlet.http.HttpServlet.service(HttpServlet.java:648)

    at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:841)

    at javax.servlet.http.HttpServlet.service(HttpServlet.java:729)

    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:292)

    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:207)

    at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)

    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:240)

    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:207)

    at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:720)

    at org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:466)

    at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:391)

    at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:318)

    at org.tuckey.web.filters.urlrewrite.NormalRewrittenUrl.doRewrite(NormalRewrittenUrl.java:213)

    at org.tuckey.web.filters.urlrewrite.RuleChain.handleRewrite(RuleChain.java:171)

    at org.tuckey.web.filters.urlrewrite.RuleChain.doRules(RuleChain.java:145)

    at org.tuckey.web.filters.urlrewrite.UrlRewriter.processRequest(UrlRewriter.java:92)

    at org.tuckey.web.filters.urlrewrite.UrlRewriteFilter.doFilter(UrlRewriteFilter.java:389)

    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:240)

    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:207)

    at org.springframework.orm.hibernate3.support.OpenSessionInViewFilter.doFilterInternal(OpenSessionInViewFilter.java:231)

    at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)

    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:240)

    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:207)

    at com.denimgroup.threadfix.webapp.filter.CsrfPreventionFilter.doFilter(CsrfPreventionFilter.java:286)

    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:240)

    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:207)

    at com.denimgroup.threadfix.webapp.filter.ClickjackHeaderFilter.doFilter(ClickjackHeaderFilter.java:36)

    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:240)

    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:207)

    at com.opensymphony.sitemesh.webapp.SiteMeshFilter.doFilter(SiteMeshFilter.java:65)

    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:240)

    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:207)

    at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:85)

    at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)

    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:240)

    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:207)

    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:330)

    at org.springframework.security.web.access.intercept.FilterSecurityInterceptor.invoke(FilterSecurityInterceptor.java:118)

    at org.springframework.security.web.access.intercept.FilterSecurityInterceptor.doFilter(FilterSecurityInterceptor.java:84)

    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)

    at org.springframework.security.web.access.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:113)

    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)

    at org.springframework.security.web.session.SessionManagementFilter.doFilter(SessionManagementFilter.java:103)

    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)

    at org.springframework.security.web.authentication.AnonymousAuthenticationFilter.doFilter(AnonymousAuthenticationFilter.java:113)

    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)

    at org.springframework.security.web.servletapi.SecurityContextHolderAwareRequestFilter.doFilter(SecurityContextHolderAwareRequestFilter.java:154)

    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)

    at org.springframework.security.web.savedrequest.RequestCacheAwareFilter.doFilter(RequestCacheAwareFilter.java:45)

    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)

    at org.springframework.security.web.FilterChainProxy.doFilterInternal(FilterChainProxy.java:186)

    at org.springframework.security.web.FilterChainProxy.doFilter(FilterChainProxy.java:166)

    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)

    at org.springframework.security.web.authentication.www.BasicAuthenticationFilter.doFilter(BasicAuthenticationFilter.java:150)

    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)

    at org.springframework.security.web.authentication.AbstractAuthenticationProcessingFilter.doFilter(AbstractAuthenticationProcessingFilter.java:199)

    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)

    at org.springframework.security.web.authentication.logout.LogoutFilter.doFilter(LogoutFilter.java:110)

    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)

    at org.springframework.security.web.context.request.async.WebAsyncManagerIntegrationFilter.doFilterInternal(WebAsyncManagerIntegrationFilter.java:50)

    at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)

    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)

    at org.springframework.security.web.session.ConcurrentSessionFilter.doFilter(ConcurrentSessionFilter.java:125)

    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)

    at com.denimgroup.threadfix.webapp.filter.SessionTimeoutFilter.doFilter(SessionTimeoutFilter.java:126)

    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)

    at org.springframework.security.web.context.SecurityContextPersistenceFilter.doFilter(SecurityContextPersistenceFilter.java:87)

    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)

    at org.springframework.security.saml.metadata.MetadataGeneratorFilter.doFilter(MetadataGeneratorFilter.java:87)

    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)

    at org.springframework.security.web.FilterChainProxy.doFilterInternal(FilterChainProxy.java:192)

    at org.springframework.security.web.FilterChainProxy.doFilter(FilterChainProxy.java:160)

    at org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:344)

    at org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:261)

    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:240)

    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:207)

    at com.denimgroup.threadfix.webapp.filter.EnterpriseFilter.doFilter(EnterpriseFilter.java:69)

    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:240)

    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:207)

    at com.denimgroup.threadfix.webapp.filter.CacheBustFilter.doFilter(CacheBustFilter.java:61)

    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:240)

    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:207)

    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:212)

    at org.apache.catalina.core.StandardContextValve.__invoke(StandardContextValve.java:106)

    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java)

    at org.apache.catalina.core.StandardHostValve.__invoke(StandardHostValve.java:141)

    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java)

    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:79)

    at org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:616)

    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:88)

    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:522)

    at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1095)

    at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:672)

    at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1502)

    at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.run(NioEndpoint.java:1458)

    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)

    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)

    at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)

    at java.lang.Thread.run(Thread.java:745)

    WARN [http-nio-8080-exec-4] DefectServiceImpl.createDefect(269) | Exception when submitting defect to Defect Tracker!A

当 运行 在 [=13] 下时,问题跟踪器 https://github.com/Microsoft/team-explorer-everywhere 上已经存在一些错误(这适用于 SDK、Eclipse 和 Java CLI 代码) =] 11. 你应该能够在那里找到不同的 SDK 版本