Question 10
A developer runs a servlet from an OSGi web project named CounterWebBundle on a Liberty server and gets the following error message when the doGet method of the servlet is run:
[ERROR ] SRVE0777E: Exception thrown by application class
'com.ibm.ws.eba.servlet.CounterServlet.doGet():42' java.lang.NoClassDefFoundError: javax.naming.InitialContext
How should the developer resolve the problem?
Ensure that jndi-1.0 and serverStatus-1.0 are added to the Feature Manager in the server configuration.
Ensure that jndi-1.0 is added to the Feature Manager in the server configuration and the javax.naming package is added to the Import-Package of CounterWebBundle.
Ensure that jndi-1.0 is added to the Feature Manager in the server configuration and Web 2.0 is selected in the Project Facets of the Properties for CounterWebBundle.
Ensure that jndi-1.0 is added to the Feature Manager in the server configuration and the javax.naming.InitialContext is specified in the init-method of the bean specified in the blueprint.xml file of CounterWebBundle.
Correct answer: B