0

We took ownership of a java web application that current runs in WebLogic. We're now trying to deploy this in Tomcat using OCP.

When we drop the .war file into the Tomcat/webapps directory, the application did not start and the error we received was:

10/06/20 13:33:02.405 [                        main] ERROR  ConversationAwarePrimeResourceHandler[72] = 
javax.naming.NameNotFoundException: Name [BeanManager] is not bound in this Context. Unable to find [BeanManager].
    at org.apache.naming.NamingContext.lookup(NamingContext.java:817)
    at org.apache.naming.NamingContext.lookup(NamingContext.java:159)
    at org.apache.naming.NamingContext.lookup(NamingContext.java:827)
    at org.apache.naming.NamingContext.lookup(NamingContext.java:173)
    at org.apache.naming.SelectorContext.lookup(SelectorContext.java:163)
    at javax.naming.InitialContext.lookup(InitialContext.java:417)
    at pax.XXXNameRemovedXXX.common.web.servlet.ConversationAwarePrimeResourceHandler.getBeanManager(ConversationAwarePrimeResourceHandler.java:60)
    at pax.XXXNameRemovedXXX.common.web.servlet.ConversationAwarePrimeResourceHandler.<init>(ConversationAwarePrimeResourceHandler.java:33)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
    at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
    at java.lang.reflect.Constructor.newInstance(Constructor.java:423)

The error did not come from the web application but from a "custom" .jar file that was build as part of the application. It seems that that code that was used in generating the jar file was not able to retrieve BeanManager.

I found instruction on how to do this for the web application: Application servers and environments supported by Weld

However, this does not seem to work for the code that generates the .jar file. This code is missing stuff like META-INF, WEB-INF, etc.

Can someone tell me how I will need to approach this?

escee999
  • 109
  • 2
  • 10
  • 1
    WebLogic is a JEE server. Tomcat is not a JEE server. It's a servletcontainer. It's absolutely not only CDI/Weld which is missing in Tomcat as compared to a normal JEE server. JEE offers so many more other APIs which are completely absent in Tomcat. Why exactly did you made such a big step backwards? Why not just migrating to a normal JEE server such as WildFly/TomEE/Payara/etc? – BalusC Oct 10 '20 at 22:32
  • Hi. Thanks for the comment. To make long story short, we're moving to red hat OCP. We normally use Tomcat image there. Also, I'm not familiar with Weld or CDI. I found instructions on how to use it in Tomcat and I was following it. Not working. I also tried Tomee but got different set of errors so I went back to Tomcat. Application was written by another team and was turned over to us recently. Would moving to Tomee and try to resolve errors there be better? thx! – escee999 Oct 13 '20 at 11:25
  • 1
    TomEE is also a JEE server albeit it uses internally totally different implementations as compared to WebLogic: https://arjan-tijms.omnifaces.org/2020/05/implementation-components-used-by.html It ought to compile fine (because it's JEE) but runtime would need some testing (because impls may have their own set of bugs not found in other impls). So you might indeed need to finetune bits in that area (but you should absolutely not have the need to provide invididual JEE impls yourself such as CDI/Weld). GlassFish/Payara servers come most close to WebLogic as to the actual implementations used. – BalusC Oct 13 '20 at 11:46
  • Thank you so much for the explanation. I'll see how far I can get with Tomee. I'll also see if we are allow to use GlassFish, etc. Really appreciate this. Currently it's going no where ! :-) – escee999 Oct 13 '20 at 14:26
  • I would _absolutely_ use TomEE not Tomcat for this purpose. You may still run into some small quirks, but you'd be much farther along. – Jonathan S. Fisher Nov 05 '20 at 14:32
  • Hi. Thanks for the comment. This task was just completed by another developer. It seemed he converted app from spring to spring-boot and did a bunch of stuff and was able to get it to work. – escee999 Nov 07 '20 at 14:34

1 Answers1

0

Task was completed by converting app from spring to spring-boot then using embedded tomcat. It was done by another developer so I have no clear idea of what was done but at least I can close this topic.

escee999
  • 109
  • 2
  • 10