Uploaded image for project: 'WildFly'
  1. WildFly
  2. WFLY-3925

JAX-RS bean implemented as Stateless is destroyed after response

    XMLWordPrintable

Details

    • Bug
    • Resolution: Won't Do
    • Major
    • None
    • 8.1.0.Final
    • None
    • None
    • Hide

      1. Create this test bean:

      @Path("/test2")
      @Stateless
      public class Test2 {
      	@GET
      	public String hello() {
      		return "hello !";
      	}
      
      	@PostConstruct
      	protected void postConstruct() {
      		System.out.println("Test2().postConstruct() " + this);
      	}
      
      	@PreDestroy
      	protected void preDestroy() {
      		System.out.println("Test2().preDestroy() " + this);
      	}
      
      }
      

      2. Hit the URL (ex: http://localhost:8080/TestRest3/rest/test2) and look at the server output, something like this will show:

      16:21:46,430 INFO  [stdout] (default task-41) Test1().postConstruct() test.Test2@890a1e2
      16:21:46,432 INFO  [stdout] (default task-41) Test1().preDestroy() test.Test2@890a1e2
      

      AFAIK SLSB shouldn't be destroyed after service request.

      Show
      1. Create this test bean: @Path( "/test2" ) @Stateless public class Test2 { @GET public String hello() { return "hello !" ; } @PostConstruct protected void postConstruct() { System .out.println( "Test2().postConstruct() " + this ); } @PreDestroy protected void preDestroy() { System .out.println( "Test2().preDestroy() " + this ); } } 2. Hit the URL (ex: http://localhost:8080/TestRest3/rest/test2 ) and look at the server output, something like this will show: 16:21:46,430 INFO [stdout] (default task-41) Test1().postConstruct() test.Test2@890a1e2 16:21:46,432 INFO [stdout] (default task-41) Test1().preDestroy() test.Test2@890a1e2 AFAIK SLSB shouldn't be destroyed after service request.

    Description

      A JAX-RS bean implemented as stateless EJB is destroyed after response is sent.

      Attachments

        Activity

          People

            jgreene@redhat.com Jason Greene
            ssamayoagt Sergio Samayoa (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: