19

I am trying a simple app using Jersey JAX-RS + EJB 3.1 on GlassFish 3.1.2.2. All seemed to look pretty well with Jersey REST on GlassFish until I added EJB. When deploying the war file, I got this error.

SEVERE: Error when configuring to use the EJB interceptor binding API. JAX-RS EJB support is disabled.

Anyone who has encountered this before? Is there a configuration in GlassFish to fix this?

My EJB is a simple pojo with @Singleton and @PostConstruct annotation.

@Singleton
public class PurchaseBean {
    private String name;

    @PostConstruct
    public void init() {
        System.out.println("Initializing PurchaseBean");
        setName("Purchase Singleton EJB");
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }


}
Adrian M
  • 7,047
  • 7
  • 24
  • 26

2 Answers2

32

Looks like this is an Eclipse issue. I did the deployment using Eclipse with the GlassFish adapter. Restarting Eclipse solved it.

Solution: Shutdown GlassFish, inside Eclipse go to Project->Clean(select project) and then start GlassFish again.

I don't know why but it worked. :)

Adrian M
  • 7,047
  • 7
  • 24
  • 26
  • 2
    Same problem in a production system,son eclipse is not the problem :( – angelcervera Sep 16 '12 at 19:37
  • 4
    Same problem in NetBeans after deploying a Singleton EJB, and this solved it for me. – Graham May 12 '13 at 16:45
  • I also had this issue after deplying a Singleton EJB. Using EE 7 in eclipse. – Alex Pritchard Mar 06 '14 at 21:00
  • 2
    Actually this seems unrelated (or only indirectly related) to Singleton. I can reproduce it by including certain Maven projects on my path that break the deploy to glassfish with a CDI deployment failure (I think caused by annotations in the jars?). If I add, try and fail to deploy, remove, and then deploy again, I start receiving the Jax-RS EJB integration errors again. Cleaning the project and restarting glassfish resolves the issue. – Alex Pritchard Mar 06 '14 at 21:08
  • Got this problem with Glassfish 3.1.2.2, too, when redeploying a .war using Jersey with EJBs. even **without Eclipse**. Undeploying and deploying again did not help, but **restarting Glassfish** did help. – Michael Paesold Apr 22 '16 at 14:16
  • IntelliJ user here. Restarting (not only redeploying) the glassfish project helps in 90%. However now, I had to **remove** the artifacts from the run configuration (**without** re-adding them afterwards. ide even says "warning, no artifacts selected"). no idea why this works but it does – phil294 Jan 15 '17 at 18:04
0

Working solution or the ones who run the Glassfish standalone: Restart the Glassfish. Glassfish version number 4.1.2

Ridvan
  • 21
  • 2