using Jira REST Java Client API i get java.lang.NoSuchMethodError in eclipse, but not with ANT - eclipse

Must be the way Eclipse is set up. Anyone have any ideas?
Exception in thread "main" java.lang.NoSuchMethodError: com.sun.jersey.client.apache.DefaultApacheHttpMethodExecutor.headerValueToString(Ljava/lang/Object;)Ljava/lang/String;
at com.sun.jersey.client.apache.DefaultApacheHttpMethodExecutor.writeOutBoundHeaders(DefaultApacheHttpMethodExecutor.java:271)

It looks like DefaultApacheHttpMethodExecutor.headerValueToString was removed from the Jersey library after its 1.7 release:
http://java.net/projects/jersey/lists/commits/archive/2011-06/message/12
Here are some options:
Replace your current version of Jersey and with an older version of Jersey:
Use a newer version of the JIRA REST client. I don't know if any newer versions support the change to the Jersey API.

Actually, the "headerValueToString" method is supported in jersey-client-1.5.jar. Some later versions don't support the method yet, such as jersey-client-1.15.jar.

I use "jersey-apache-client-1.8.jar" downloaded from "http://download.java.net/maven/2/com/sun/jersey/contribs/jersey-apache-client/1.8/" and it works well

Related

Maven quarkus project doesn't start anymore after upgrade to 2.7.3 or 2.7.4

After upgrade from 2.7.2 to 2.7.3 or 2.7.4 my quarkus project doesn't start anymore. I get following Exception:
Caused by: java.lang.NoSuchFieldError: ACCESS_CONTROL_ALLOW_PRIVATE_NETWORK
at io.vertx.core.http.HttpHeaders.<clinit>(HttpHeaders.java:106)
at io.vertx.core.http.impl.headers.HeadersMultiMap.<clinit>(HeadersMultiMap.java:63)
at io.quarkus.smallrye.openapi.runtime.OpenApiHandler.<clinit>(OpenApiHandler.java:24)
at io.quarkus.smallrye.openapi.runtime.OpenApiRecorder.handler(OpenApiRecorder.java:35)
Maybe it is releated to the upgrade of open api https://github.com/quarkusio/quarkus/pull/23886
When I disable open api it starts
quarkus.smallrye-openapi.enable=false
Your problem seems to be related to this one, So i believe we have 2 workarounds:
First try using different browser than chrome (if you don't, go directly to second step)
Then, try enabling CORS in your application.properties like following :
quarkus.http.cors=true
My problem was caused by a dependency with an older version of netty.
Updating netty fixed the problem.
https://stackoverflow.com/a/71423882/9651670
Thanks, this answer helped me a lot. I had to force a specific netty version on a previous update for azure/microsoft libs to work. Now they work with default managed version from quarkus and i removed netty-bom from dependencymanagement instead of updating it.

Swagger 1.3.7 and Jersey 2.15/2.16 issue: the request entity is in a format not supported by the requested resource

I have a REST API that was working with Jersey 2.6 and Swagger 1.3.7. I read that Jersey 2.9 fixes a warning that I was getting so I upgraded to the latest Jersey 2.16 but then Swagger stopped working. I went back and upgraded one version at a time until I saw that Swagger was working with 2.15 so I settled on that. Now, the PUT API fails with Swagger with the following error:
The server refused this request because the request entity is in a format not supported by the requested resource for the requested method
The API works using FireFox RESTClient and specifying "application/json".
I do have "jersey-media-json-jackson" as a dependency and call "Client client = ClientBuilder.newClient().register(JacksonFeature.class);" in the program.
I tried upgrading Swagger but that did not help.
Has Swagger been verified to work with Jersey 2.15/2.16?
I've recently managed to get swagger-core to work with Jersey 2.16 with a similar issue. Keep in mind they are using the latest version (1.5.X) and not 1.3.X but the same solution will apply.
The problem is most likely with version resolution, specifically, the one of jackson-databind. For some reason, even jersey-media-json-jackson 2.16 depends on an older version of jackson-databind, even though it works fine with the latest version. Without having more details, it would be difficult to suggest a full solution, but you can follow the dependency tree and see the conflicts there.
If you do require further assistance, I'd suggest either using our mailing list, or even better, the IRC channel where we could interact online and resolve it.

java.lang.NoSuchMethodError: javax.persistence.EntityManager.getMetamodel()

How to fix this error using OpenXava 4.6 with Glassfish 2.2:
javax.servlet.ServletException: java.lang.NoSuchMethodError: javax.persistence.EntityManager.getMetamodel()Ljavax/persistence/metamodel/Metamodel
I got this error when trying to access my test module from the browser.
http://localhost:8080/testmod/xava/module.jsp?application=testmod&module=test
In my case, using openxava 4.6 with glassfishESBv22 gave me the error java.lang.NoSuchMethodError: javax.persistence.EntityManager.getMetamodel... so when i changed the server to default tomcat bundle with OX4.6, it worked fine. that means it was the glassfish server problem...finally i used the latest glassfish server v3.1.2 and it also worked fine. so problem solved...only changing the server to the latest one was the solution.
OpenXava 4.6 uses JPA2, while the application server you're using uses JPA1. If you need to work with an old application server you can configure the classloaders in order that use JPA engine included your OpenXava application.

Jboss AS 7 and class loading

I am using JBOSS AS 7.0.2 Final, and was trying to upgrade the version of RESTEASY that comes with 7.0.2 RESTEASY 2.2.1.GA to a newer version such as 2.3.4.Final. I followed the directions as indicated in patching provided by JBOSS, and when I did that, at application server startup it throws the error of being unable to parse the module.xml file.
I attempted the same procedure on 7.1.1 Final and it works fine.
First Question is, anyone know how to update RESTEASY in 7.0.2 (My other servers are all using this so I really like not to have to reset my other servers and replace with newer version of JBOSS)
I was hoping to upgrade RESTEASY, with hopes that this error may have been resolved in newer version
I have also tried by adjusting my POM to use version 2.3.4.Final and tried every scope, but it always would fail to use the newer jars and stick with JBOSS supplied jar.
15:14:09,947 SEVERE [org.jboss.resteasy.core.SynchronousDispatcher] (http--127.0.0.1-8443-6) Failed executing POST /countermeasure/customQueryLite: org.jboss.resteasy.core.NoMessageBodyWriterFoundFailure: Could not find MessageBodyWriter for response object of type: java.util.ArrayList of media type
: application/xml
at org.jboss.resteasy.core.ServerResponse.writeTo(ServerResponse.java:216) [resteasy-jaxrs-2.2.1.GA.jar:]
It works fine for json, and text, and singular xml objects, but not list objects for xml.
Any answers in regards to these issues with resteasy and jboss would be helpful.

Define WADL resources base in Jersey

I am using Jersey 1.9 and it is generating my WADL perfectly except I need to redefine the resources base URI.
I'm running Jetty 7 sitting behind Apache using mod_proxy as a reverse proxy to route REST requests back to Jetty / Jersey. So Jersey generates the resources base URI as
http://localhost:8080/testRestAPI/rest/
when I need something like
http://mydomain.com/rest/
I found this from Google but it is not working: http://jersey.576304.n2.nabble.com/Changing-baseURI-when-generating-WADL-td6169703.html
unfortunately, you've found a bug in Jersey implementation. Please file a new issue as stated on mailing list - jira link: http://java.net/jira/browse/JERSEY
What you can do for now is downgrade to Jersey 1.8, which should not be affected by latest changes in this area. Thanks and sorry for inconvenience!
EDIT: issue link: http://java.net/jira/browse/JERSEY-773
it is already fixed, so you should be able to use this feature in Jersey 1.10-b02 and newer.