jax-rs

javax.ws.rs.NotFoundException: Could not find resource for full path Error Occures

不问归期 提交于 2019-12-22 10:18:16
问题 I found this same question in here few times, but I couldn't find an answer to that. When I run my application, Im getting the following error javax.ws.rs.NotFoundException: Could not find resource for full path: http://localhost:8080/RemoteQuartzScheduler/rest/TestClass/hello at org.jboss.resteasy.core.registry.ClassNode.match(ClassNode.java:73) at org.jboss.resteasy.core.registry.RootClassNode.match(RootClassNode.java:48) at org.jboss.resteasy.core.ResourceMethodRegistry.getResourceInvoker

How to call swagger codegen programmatically?

十年热恋 提交于 2019-12-22 09:37:55
问题 I am generating a restful java jax-rs api with swagger-codgen-cli.jar. Right now I call java -jar with some command line options to do this. java -jar swagger-codegen-cli.jar generate -i api.yaml -l jaxrs -o ./outputdir Which works fine. But I would like to make this call from of a Java program i.e. including the codegen.jar into my classpath and then call the corresponding method with similar parameters. So is there a public API from the swagger-codegen module which I can call? 回答1: If I

JAX-RS (Resteasy 3.5.0.Final) + Wildfly 12 + Java 9 + maven = 404 not found, but JAX-RS (Resteasy 3.5.0.Final) + Wildfly 12 + Java 8 + maven works

ⅰ亾dé卋堺 提交于 2019-12-22 08:59:43
问题 I have got a simple Hello World example JAX-RS project. Really simple and stupid. Just minimal configuration, which I intend to enhance in future, just imagine something like this with : https://robferguson.org/blog/2016/12/02/getting-started-with-resteasy/ . Well, my problem is, that when I set the Java version to "1.9", I always receive a "404 not found" error. But when I change it back to 1.8, mvn clean install and deploy, it works fine. The java version is the only delta, which makes it

Generate wadl from existing CXF rest service

别说谁变了你拦得住时间么 提交于 2019-12-22 08:41:57
问题 I have working JAX-RS service implemented with CXF. How can I generate wadl? Or is there something like with jersey http://path.to.your/restapp/application.wadl out there already? is there a maven plugin just like for wsdl, java to wsdl? I've searched for answers couldn't find. 回答1: If you are using a recent version of CXF, just hit the service with a ?_wadl parameter. 回答2: There are a lot of possible ways to generate WADL using CXF: You can sent REST call (using Postman, for example) to the

Get user name with Apache CXF 2.4 JAX-RS and Spring Security 3.2

拥有回忆 提交于 2019-12-22 08:32:58
问题 I get the user name in my JAX-RS resource with SecurityContextHolder and that works: @Path("/myresource") public class MyResoure { @Get public String getUserName() { return SecurityContextHolder.getContext().getAuthentication().getName(); } } But I want to inject the SecurityContext into a class field (to write JUnit tests). I tried some documented ways: With javax.ws.rs.core.SecurityContext I get a NullPointerException , because the securityContext is always null . @Path("/myresource")

RestEasy Client Authentication and HTTP Put with Marshalling

两盒软妹~` 提交于 2019-12-22 08:08:40
问题 I want to test my REST-Service using the RestEasy Client Framework. In my application I am using Basic Authentication. According to the RestEasy documentation I am using the org.apache.http.impl.client.DefaultHttpClient to set the Credentials for Authentication. For an HTTP-GET Request this works fine, I am authorized and I get the result Response which I wanted. But what if I want to make a HTTP-Post/HTTP-Put with an Java Object (in XML) in the HTTP-Body of the Request? Is there a way to

URI-specific ExceptionMapper in JAX-RS

試著忘記壹切 提交于 2019-12-22 06:55:34
问题 I'm using Jersey, and Guice as my IOC-container. I'd like to know if it is possible to associate an ExceptionMapper with a specific URI. The reason for this is that I want to map the same exception differently based on what URI was visited. For example, suppose I've got the following two exception mappers for my custom exception: public class MyExceptionMapperForFirstURI implements ExceptionMapper<MyException> {..return response based on first URI..} public class MyExceptionMapperForSecondURI

Cannot use org.jvnet.jax-ws-commons.jaxws-maven-plugin on JDK8

落爺英雄遲暮 提交于 2019-12-22 04:27:16
问题 I'm using org.jvnet.jax-ws-commons:jaxws-maven-plugin to generate client stubs for Soap services. Upgrading to JDK8 made this fail with following error: Failed to read schema document 'xxx.xsd', because 'file' access is not allowed due to restriction set by the accessExternalSchema property. and something like Failed to read DTD 'XMLSchema.dtd', because 'file' access is not allowed due to restriction set by the accessExternalDTD property. Why is this and how can I fix this? 回答1: Seems

How to prevent “Local transaction already has 1 non-XA Resource” exception?

风格不统一 提交于 2019-12-22 04:15:12
问题 I'm using 2 PU in stateless EJB and each of them is invoked on one method: @PersistenceContext(unitName="PU") private EntityManager em; @PersistenceContext(unitName="PU2") private EntityManager em2; @TransactionAttribute(TransactionAttributeType.REQUIRES_NEW ) public void getCandidates(final Integer eventId) throws ControllerException { ElectionEvent electionEvent = em.find(ElectionEvent.class, eventId); ... Person person = getPerson(candidate.getLogin()); ... } @TransactionAttribute

Using Jackson in Jersey with multiple configured ObjectMappers

☆樱花仙子☆ 提交于 2019-12-22 04:04:11
问题 Is it possible to setup Jersey using Jackson for serialization/deserialization using multiple configured ObjectMappers ? What I would like to be able to do is register a "default" Jackson ObjectMapper and then have the ability to register another feature which provides an ObjectMapper with some specialized configuration which under certain circumstance will "override" the "default" ObjectMapper . For example, this ContextResolver would be for the "default" mapper: @Provider @Consumes