0

We have a SOAP based service that is built with EJB stack and it runs on jboss EAP 7.1.

We need to convert and merge with ongoing project (This new project spring boot app).

As initial step, we merged the code with new app, got rid of compilation errors, replaced the EJB annotations with spring annotations, build and deployed.

When we try to access the URL, its giving NPE.

We understand that EJBs are managed by container and spring is not aware of them until we tell spring to manage those beans.

I wonder if there is a way to work with those EJB components without converting them to spring beans. Is there a way to tell spring to manage the EJBs as well?

Simon Martinelli
  • 34,053
  • 5
  • 48
  • 82
alex
  • 21
  • 1
  • 5
  • How did you replace the EJB annotations and where do you get a NPE? – Simon Martinelli Jun 15 '21 at 14:59
  • For instance, @EJB annotation is replaced with autowired, singleton is replaced with service. When I call the service from my controller, I thought since I annotated the service class with service and injected it in my controller using autowired, spring would instantiate service object and inject into my controller. But, its giving NPE in my controller class which clearly says my service object was not instantiated. – alex Jun 16 '21 at 09:41
  • What you explain should work. Can you please show some code how you do that? – Simon Martinelli Jun 16 '21 at 10:54
  • @SimonMartinelli Well, it certainly did work. The only problem is, I missed few EJB annotations in another package. And the reason for NPE is, in legacy code some objects were manually instantiated and when I converted to spring, it could not create the beans and hence NPE. I carefully examined those and fixed them. – alex Jun 30 '21 at 06:29

0 Answers0