Hi David,
If email-based subscription is not working for you, please log-in to java.net with your java.net account and then visit this page:
https://java.net/projects/jersey/lists
You should be able to subscribe to the Jersey users mailing list there by clicking the proper button.
As for your JSON issue, I do not see any problem that should lead to receiving 405. Can you please send us the zipped project sources so we can have a look?
Thanks,
Marek
On 15 May 2014, at 14:11, David G <davidg.1111_at_hotmail.com> wrote:
> Hi,
>
> I am a new user here. I am trying to learn Jersey 2.8. I am facing a problem with Json Moxy. I need help. I am trying to subsribe to mailing list but it always return with Mail Delivery failure.
>
> I have built small HelloWorld application. It works well for GET and POST request but now I want to send and receive JSON request using Moxy. I added dependencies in Maven
>
>
> <dependencies>
> <dependency>
> <groupId>org.glassfish.jersey.containers</groupId>
> <artifactId>jersey-container-servlet-core</artifactId>
> <!-- use the following artifactId if you don't need servlet 2.x compatibility -->
> <!-- artifactId>jersey-container-servlet</artifactId -->
> </dependency>
>
> <dependency>
> <groupId>org.glassfish.jersey.media</groupId>
> <artifactId>jersey-media-moxy</artifactId>
> </dependency>
>
> </dependencies>
>
>
> I am using tomcat 7 server.
>
>
> My Resource is
>
> package com.test.jersey1;
>
> import javax.ws.rs.Consumes;
> import javax.ws.rs.FormParam;
> import javax.ws.rs.GET;
> import javax.ws.rs.POST;
> import javax.ws.rs.Path;
> import javax.ws.rs.PathParam;
> import javax.ws.rs.Produces;
> import javax.ws.rs.core.MediaType;
> import javax.ws.rs.core.MultivaluedMap;
>
> @Path("hello")
> public class HelloWorldResource {
>
>
> @POST
> @Produces(MediaType.APPLICATION_JSON)
> @Path("echo")
> public Person echo(Person person) {
> return person;
> }
> }
>
>
> client is
>
>
> package com.test.jersey1;
>
> import javax.ws.rs.client.Client;
> import javax.ws.rs.client.ClientBuilder;
> import javax.ws.rs.client.Entity;
> import javax.ws.rs.client.WebTarget;
> import javax.ws.rs.core.Form;
> import javax.ws.rs.core.MediaType;
>
>
> public class HelloClient {
>
> public static void main(String[] args) {
> Client client = ClientBuilder.newClient();
>
>
>
> WebTarget target = client.target("http://localhost:8080/jersey1/hello/echo");
> Person person = new Person(1,"david");
> Person personRet = target.request(MediaType.APPLICATION_JSON_TYPE).post(Entity.entity(person, MediaType.APPLICATION_JSON), Person.class);
> System.out.println(personRet.getName());
>
>
> }
>
> }
>
>
> My Person POJO is
>
> package com.test.jersey1;
>
> import javax.xml.bind.annotation.XmlRootElement;
>
> @XmlRootElement
> public class Person {
> private int id;
> private String name;
> public int getId() {
> return id;
> }
> public void setId(int id) {
> this.id = id;
> }
> public String getName() {
> return name;
> }
> public void setName(String name) {
> this.name = name;
> }
>
> public Person() {
>
> }
>
> public Person(int id,String name) {
> this.id = id;
> this.name = name;
> }
>
> }
>
>
> I get following error
>
> Exception in thread "main" javax.ws.rs.NotAllowedException: HTTP 405 Method Not Allowed
> at org.glassfish.jersey.client.JerseyInvocation.convertToException(JerseyInvocation.java:920)
> at org.glassfish.jersey.client.JerseyInvocation.translate(JerseyInvocation.java:770)
> at org.glassfish.jersey.client.JerseyInvocation.access$500(JerseyInvocation.java:90)
> at org.glassfish.jersey.client.JerseyInvocation$2.call(JerseyInvocation.java:671)
> at org.glassfish.jersey.internal.Errors.process(Errors.java:315)
> at org.glassfish.jersey.internal.Errors.process(Errors.java:297)
> at org.glassfish.jersey.internal.Errors.process(Errors.java:228)
> at org.glassfish.jersey.process.internal.RequestScope.runInScope(RequestScope.java:424)
> at org.glassfish.jersey.client.JerseyInvocation.invoke(JerseyInvocation.java:667)
> at org.glassfish.jersey.client.JerseyInvocation$Builder.method(JerseyInvocation.java:423)
> at org.glassfish.jersey.client.JerseyInvocation$Builder.post(JerseyInvocation.java:326)
> at com.test.jersey1.HelloClient.main(HelloClient.java:26)