0

I can't import Java EE annotations in eclipse,such as @EJB and @Stateless, instead eclipse recommends me to create them.

Eclipse compiler error

Lukas
  • 812
  • 1
  • 14
  • 43

1 Answers1

0

Per se, you can't use the EJB specification with a plain Tomcat server. Tomcat is an open-source implementation of the Java Servlet, JavaServer Pages, Java Expression Language and WebSocket specification.

The EJB (Enterprise JavaBeans) specification is part of Java EE (now called Jakarta EE) and requires a Java EE application server: e.g. TomEE, Payara, Glassfish, Open Liberty, WildFly, etc. Tomcat is not a Java EE application server as it is just a servlet-container.

If you still want to run your application in a Tomcat-like environment, have a look at the TomEE application server: How to deploy EJB based application on Tomcat.

rieckpil
  • 10,470
  • 3
  • 32
  • 56