Hi,
I'm new to
Java EE so please bear with me. I am trying to write a server that will listen for connections. When one arrives, it will hand off the connection (server socket) to a stateful bean which will service it and then be destroyed when the connection terminates. The stateful bean will use various JPA entities.
I am trying to do this with Netbeans. I created a new project of type "enterprise application". I then told it to make an
EJB module and an application client module, but not a web application module. I created the main server listener loop in the main method of the application client's main class. The plan was to hand off to the stateful EJB within this loop, eg
clientSocket = ss.accept();
@EJB MainCommLoop mainCommLoop;
mainCommLoop.handleConnection(clientSocket)
so the stateful bean would be used without an interface. I have created all of my entity classes and the stateful bean (MainCommLoop) in a package I created in the ejb module.
However, I have two problems:
1. I can't seem to inject the stateful bean in the application client's main class. The line @EJB MainCommLoop mainCommLoop produces the error: "annotation type not applicable to this kind of declaration".
2. I can't move the main class for the application client to my own package. If I move it from the default (no) package to my own package, it builds, but then when I try to run the application client I get an error that the module was not deployed.
TIA for your help.
Matthew Fleming
Dermvision