Import from excel(xls) using curl command is not working.

Bhavesh Soni, modified 1 Year ago.

Import from excel(xls) using curl command is not working.

Youngling Posts: 5 Join Date: 4/27/23 Recent Posts
I have installed the Klaros community edition for evaluation purposes however, excel import using CURL command is not working. Curl Command:
curl -v -T klarosImportFile.xls "http://localhost:18080/klaros-web/seam/resource/rest/import/testcase/xls?config=P00001\ &username=admin&password=Password"
also,I have attached a sample file that I am trying to upload and Project is present. For more details, Please check attached screenshot: Error:
27-Apr-2023 08:33:50.157 INFO [http-nio-18080-exec-7] org.apache.coyote.http11.Http11Processor.service Error parsing HTTP request header  Note: further occurrences of HTTP request parsing errors will be logged at DEBUG level.     java.lang.IllegalArgumentException: Invalid character found in the request target [/klaros-web/seam/resource/rest/import/testcase/xls?config=P00001\&username=admin&password=Password]. The valid characters are defined in RFC 7230 and RFC 3986         at org.apache.coyote.http11.Http11InputBuffer.parseRequestLine(Http11InputBuffer.java:494)         at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:271)         at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:65)         at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:891)         at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1784)         at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49)         at org.apache.tomcat.util.threads.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1191)         at org.apache.tomcat.util.threads.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:659)         at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)         at java.base/java.lang.Thread.run(Unknown Source)
Please guide me on how can i import the test cases.
Bhavesh Soni, modified 1 Year ago.

RE: Import from excel(xls) using curl command is not working.

Youngling Posts: 5 Join Date: 4/27/23 Recent Posts
there was an extra '\' in  URL (...config=P00001\&username...).after that I am getting below error

curl -v -T klarosImportFile.xls "http://localhost:18080/klaros-web/seam/resource/rest/import/testcase/xls?config=P00001&username=admin&password=Password"


*   Trying 127.0.0.1:18080...
* Connected to localhost (127.0.0.1) port 18080 (#0)
> PUT /klaros-web/seam/resource/rest/import/testcase/xls?config=P00001&username=admin&password=Password HTTP/1.1
> Host: localhost:18080
> User-Agent: curl/7.81.0
> Accept: */*
> Content-Length: 8704
> Expect: 100-continue

* Mark bundle as not supporting multiuse
< HTTP/1.1 100 
* We are completely uploaded and fine
* Mark bundle as not supporting multiuse
< HTTP/1.1 405 
< Allow: OPTIONS, GET, HEAD, POST
< Content-Type: text/html;charset=utf-8
< Content-Language: en
< Content-Length: 685
< Date: Thu, 27 Apr 2023 11:34:47 GMT
< Connection: close

* Closing connection 0
<!doctype html><html lang="en"><head><title>HTTP Status 405 – Method Not Allowed</title><style type="text/css">body {font-family:Tahoma,Arial,sans-serif;} h1, h2, h3, b {color:white;background-coloremoticon525D76;} h1 {font-size:22px;} h2 {font-size:16px;} h3 {font-size:14px;} p {font-size:12px;} a {color:black;} .line {height:1px;background-coloremoticon525D76;border:none;}</style></head><body><h1>HTTP Status 405 – Method Not Allowed</h1><hr class="line" /><p><b>Type</b> Status Report</p><p><b>Description</b> The method received in the request-line is known by the origin server but not supported by the target resource.</p><hr class="line" /><h3>Apache Tomcat/9.0.71</h3></body></html>
Talal Arif, modified 1 Year ago.

RE: Import from excel(xls) using curl command is not working.

Youngling Posts: 2 Join Date: 1/6/16 Recent Posts
Hello Bhavesh, 

I was able to import the test case successfully without any problems.

Please try importing the test case again.
In particular, check your application URL and file path to see if they are correct.
The file name without the path is sufficient if you are in the same folder as the file. 

A spelling mistake can provoke this error.

Regards,

Talal
Bhavesh Soni, modified 1 Year ago.

RE: Import from excel(xls) using curl command is not working.

Youngling Posts: 5 Join Date: 4/27/23 Recent Posts
Thank you Talal for your response.

We are still not able to upload the file in the test case management tool. Please check the error that we are encountering while doing import and correct us if we are doing anything wrong out here:

File Location:



If we are running the below curl command while using "klaros-web" resources then we are getting "HTTP Status 405 – Method Not Allowed" error.

curl -v -T klarosImportFile.xls "http://localhost:18080/klaros-web/seam/resource/rest/import/testcase/xls?config=P00001&username=admin&password=Bhavesh@123!"word=Bhavesh@123!"

*   Trying localhost:18080...
* Connected to localhost(localhost) port 18080 (#0)
> PUT /klaros-web/seam/resource/rest/import/testcase/xls?config=P00001&username=admin&password=Bhavesh@123! HTTP/1.1
> Host: localhost:18080
> User-Agent: curl/7.81.0
> Accept: */*
> Content-Length: 8704
> Expect: 100-continue

* Mark bundle as not supporting multiuse
< HTTP/1.1 100 
* We are completely uploaded and fine
* Mark bundle as not supporting multiuse
< HTTP/1.1 405 
< Allow: OPTIONS, GET, HEAD, POST
< Content-Type: text/html;charset=utf-8
< Content-Language: en
< Content-Length: 685
< Date: Tue, 02 May 2023 12:01:11 GMT
< Connection: close

* Closing connection 0
<!doctype html><html lang="en"><head><title>HTTP Status 405 – Method Not Allowed</title><style type="text/css">body {font-family:Tahoma,Arial,sans-serif;} h1, h2, h3, b {color:white;background-coloremoticon525D76;} h1 {font-size:22px;} h2 {font-size:16px;} h3 {font-size:14px;} p {font-size:12px;} a {color:black;} .line {height:1px;background-coloremoticon525D76;border:none;}</style></head><body><h1>HTTP Status 405 – Method Not Allowed</h1><hr class="line" /><p><b>Type</b> Status Report</p><p><b>Description


If we are running the below curl command without using "klaros-web" resources then we are getting "java.lang.NoSuchMethodError" error.


2023-05-02 12:04:08: ERROR, org.apache.catalina.core.ContainerBase.[Catalina].[localhost].[/].[Seam Resource Servlet] Servlet.service() for servlet [Seam Resource Servlet] in context with path [] threw exception [org.jboss.resteasy.spi.UnhandledException: java.lang.reflect.InvocationTargetException] with root cause
java.lang.NoSuchMethodError: 'de.verit.klaros.web.service.importer.testcase.TestCaseImportResult de.verit.klaros.web.service.importer.testcase.XLSTestCaseImportService.importXLSTestCaseWorkbook(java.io.InputStream, java.util.Date, java.util.UUID, de.verit.klaros.core.dto.ConfigurationDTO, boolean, java.util.List)'
    at de.verit.klaros.web.servlet.importer.testcase.XLSTestCaseImportServlet.importTestCaseData(XLSTestCaseImportServlet.java:80)
    at de.verit.klaros.web.servlet.importer.testcase.BaseTestCaseImportServlet.importer(BaseTestCaseImportServlet.java:87)
    at de.verit.klaros.web.servlet.importer.testcase.XLSTestCaseImportServlet.importer(XLSTestCaseImportServlet.java:71)
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.base/java.lang.reflect.Method.invoke(Unknown Source)
    at org.jboss.seam.util.Reflections.invoke(Reflections.java:19)
    at org.jboss.seam.intercept.RootInvocationContext.proceed(RootInvocationContext.java:31)
    at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:51)
    at org.jboss.seam.resteasy.ResteasyContextInjectionInterceptor.aroundInvoke(ResteasyContextInjectionInterceptor.java:59)
    at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:59)
    at org.jboss.seam.transaction.RollbackInterceptor.aroundInvoke(RollbackInterceptor.java:30)
    at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:59)
    at org.jboss.seam.core.BijectionInterceptor.aroundInvoke(BijectionInterceptor.java:68)
    at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:59)
    at org.jboss.seam.transaction.TransactionInterceptor$1.work(TransactionInterceptor.java:90)
    at org.jboss.seam.util.Work.workInTransaction(Work.java:59)
    at org.jboss.seam.transaction.TransactionInterceptor.aroundInvoke(TransactionInterceptor.java:108)
    at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:59)
    at org.jboss.seam.core.MethodContextInterceptor.aroundInvoke(MethodContextInterceptor.java:47)
    at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:59)
    at org.jboss.seam.intercept.RootInterceptor.invoke(RootInterceptor.java:94)
    at org.jboss.seam.intercept.JavaBeanInterceptor.interceptInvocation(JavaBeanInterceptor.java:167)
    at org.jboss.seam.intercept.JavaBeanInterceptor.invoke(JavaBeanInterceptor.java:92)
    at de.verit.klaros.web.servlet.importer.testcase.XLSTestCaseImportServlet_$$_jvst8c2_8f.importer(XLSTestCaseImportServlet_$$_jvst8c2_8f.java)
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.base/java.lang.reflect.Method.invoke(Unknown Source)
    at org.jboss.resteasy.core.MethodInjectorImpl.invoke(MethodInjectorImpl.java:138)
    at org.jboss.resteasy.core.ResourceMethodInvoker.internalInvokeOnTarget(ResourceMethodInvoker.java:546)
    at org.jboss.resteasy.core.ResourceMethodInvoker.invokeOnTargetAfterFilter(ResourceMethodInvoker.java:435)
    at org.jboss.resteasy.core.ResourceMethodInvoker.lambda$invokeOnTarget$0(ResourceMethodInvoker.java:396)
    at org.jboss.resteasy.core.interception.PreMatchContainerRequestContext.filter(PreMatchContainerRequestContext.java:358)
    at org.jboss.resteasy.core.ResourceMethodInvoker.invokeOnTarget(ResourceMethodInvoker.java:398)
    at org.jboss.resteasy.core.ResourceMethodInvoker.invoke(ResourceMethodInvoker.java:365)
    at org.jboss.resteasy.core.ResourceMethodInvoker.invoke(ResourceMethodInvoker.java:338)
    at org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:440)
    at org.jboss.resteasy.core.SynchronousDispatcher.lambda$invoke$4(SynchronousDispatcher.java:229)
    at org.jboss.resteasy.core.SynchronousDispatcher.lambda$preprocess$0(SynchronousDispatcher.java:135)
    at org.jboss.resteasy.core.interception.PreMatchContainerRequestContext.filter(PreMatchContainerRequestContext.java:358)
    at org.jboss.resteasy.core.SynchronousDispatcher.preprocess(SynchronousDispatcher.java:138)
    at org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:215)
    at org.jboss.seam.resteasy.ResteasyResourceAdapter$1.process(ResteasyResourceAdapter.java:129)
    at org.jboss.seam.servlet.ContextualHttpServletRequest.run(ContextualHttpServletRequest.java:59)
    at org.jboss.seam.resteasy.ResteasyResourceAdapter.getResource(ResteasyResourceAdapter.java:143)
    at org.jboss.seam.servlet.SeamResourceServlet.service(SeamResourceServlet.java:76)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:779)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:227)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162)
    at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:53)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:189)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162)
    at net.bull.javamelody.MonitoringFilter.doFilter(MonitoringFilter.java:199)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:189)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162)
    at de.verit.klaros.web.service.authentication.cas.CasSpringConfiguration$DummyFilter.doFilter(CasSpringConfiguration.java:162)
    at org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:354)
    at org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:267)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:189)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162)
    at org.omnifaces.filter.CharacterEncodingFilter.doFilter(CharacterEncodingFilter.java:123)
    at org.omnifaces.filter.HttpFilter.doFilter(HttpFilter.java:108)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:189)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162)
    at de.verit.klaros.web.filter.UserAgentFilter.doFilter(UserAgentFilter.java:49)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:189)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162)
    at net.bull.javamelody.MonitoringFilter.doFilter(MonitoringFilter.java:211)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:189)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162)
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:177)
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:97)
    at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:541)
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:135)
    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:92)
    at org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:687)
    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:78)
    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:360)
    at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:399)
    at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:65)
    at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:891)
    at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1784)
    at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49)
    at org.apache.tomcat.util.threads.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1191)
    at org.apache.tomcat.util.threads.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:659)
    at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
    at java.base/java.lang.Thread.run(Unknown Source)
Talal Arif, modified 1 Year ago.

RE: Import from excel(xls) using curl command is not working.

Youngling Posts: 2 Join Date: 1/6/16 Recent Posts
Hello Bhavesh, 

Unfortunately, I have still not been able to recreate this error. 

Therefore, I have a few questions to be able to localise the error:

-Which Klaros version are you using?
-Are you using a proxy?
-Are there any error messages in the Klaros log files during the import attempts?

Regards, 
Talal
thumbnail
Torsten Stolpmann, modified 1 Year ago.

RE: Import from excel(xls) using curl command is not working.

Jedi Council Member Posts: 756 Join Date: 2/12/09 Recent Posts
Hello Bhavesh,

in addition to Talal`s questions, can you please also list the content of the webapps folder of your installation?
Also, did you change anything in there compared to a fresh installation?

Regards

Torsten
Bhavesh Soni, modified 1 Year ago.

RE: Import from excel(xls) using curl command is not working.

Youngling Posts: 5 Join Date: 4/27/23 Recent Posts
@Talal: Please check my comments inline below:


    1)    Which Klaros version are you using?

 My Comments: 5.4.6 - Build 593 (2023-04-05 17:13:49)
    
    2)    Are you using a proxy?
  
 My Comments: No
    
    3)  Are there any error messages in the Klaros log files during the import attempts?
    
My Comments: Please check attached


@Torsten: 
    1)  can you please also list the content of the webapps folder of your installation?
        My Comments: I have installed Klaros using Docker from following URL: https://github.com/klaros-testmanagement/klaros-docker

    2) Also, did you change anything in there compared to a fresh installation?
       My Comments: We did replace following Jar's jxls-reader-2.0.6.jar  and commons-digester3-3.2.jar

      Also, Copy the file XLSTestCaseImportService.class into the folder <install-dir>\webapps\klaros-web\WEB-INF\classes\de\verit\klaros\web\service\importer\testcase

      Note: Refer this forum question(https://www.klaros-testmanagement.com/en/forum/-/message_boards/message/486288) to resolve it 






thumbnail
Torsten Stolpmann, modified 1 Year ago.

RE: Import from excel(xls) using curl command is not working.

Jedi Council Member Posts: 756 Join Date: 2/12/09 Recent Posts
Hello Bavesh,

thank you for answering, I now think I have a clear view what is going on here.

1. When using the docker version, your application URL is indeed http://10.100.26.100:18080/ (without klaros-web in the path, this is only required in the standard installer version).

So the correct curl command for you to upload test cases is:

 curl -v -T klarosImportFile.xls "http://10.100.26.100:18080/seam/resource/rest/import/testcase/xls?config=P00001&username=admin&password=Bhavesh@123!"

2. By replacing the jars, you provoked the NoSuchMethodError found in your logs. Please remove the additional jars to avoid that (They are also not compatible with the included version of poi, so you will not be able to use them). Just out of interest, why did you change the jars?

With the above changes, your import should succeed. Please let me know if this works for you.

Regards,

Torsten
Bhavesh Soni, modified 1 Year ago.

RE: Import from excel(xls) using curl command is not working.

Youngling Posts: 5 Join Date: 4/27/23 Recent Posts
Hello Torsten,

Thank you for your response.

I have referred below user manual in order to import the test cases in Klaros however, I couldn't able to do it because extra "/" is present in the command then I referred this forum question(https://www.klaros-testmanagement.com/en/forum/-/message_boards/message/486288) to resolve it wherein it is mentioned to replace two Jar file and one class file that's how all the issue started coming.

Now, I have freshly installed the docker and imported the file as per curl command provided and it worked.



Thank you so much Talal and Torsten.

Thanks and Regards,
Bhavesh Soni
thumbnail
Torsten Stolpmann, modified 1 Year ago.

RE: Import from excel(xls) using curl command is not working.

Jedi Council Member Posts: 756 Join Date: 2/12/09 Recent Posts
Hello Bavenosh,

thank you for responding, I am glad to see this resolved.

The backslash in the documentation will be removed.

Please feel encouraged to provide more questions and feedback during your evaluation.

Regards,

Torsten