Thank you Gurgan. But as you can see from the path in this line:file:/C:/Users/test/eclipse/workspaces/2012_0226/.metadata/.plugins/org.eclipse.core.resources/.projects/OWBWL11gEAR/beadep/mydomain/OWBWL11gEAR/OWBWL11g.war/WEB-INF/beans.xml beans.xml was in WEB-INF. I tried by putting beans.xml in a) src/META-INFb) and in WebContent/WEB-INF It did not work. I am testing against WebLogic 10.3.6 (the latest in the 10.3.x series). FYI: I tried the MyFaces+WELD on WebLogic approach recommended here:http://jianmingli.com/wp/?p=4373 It did not work either. Essentially Beans were not injected and Weld complained that it cannot start. Did any thing change between WebLogic 10.3.5 and 10.3.6? Can anybody please tell me which exact version of WebLogic this defect was worked against:https://issues.apache.org/jira/browse/OWB-519 If I need to go to a lower version (like 10.3.4, 10.3.5) I can and once I get it working I can try to research what changed in WebLogic or at least where OWB is breaking in 10.3.6. The current symptom is:javax.naming.OperationNotSupportedException: bind not allowed in a ReadOnlyContext; remaining name 'BeanManager' Thanks,-Chandra --- On Mon, 3/12/12, Gurkan Erdogdu <[email protected]> wrote:
From: Gurkan Erdogdu <[email protected]> Subject: Re: Getting OpenWebBeans working in WebLogic 11g To: [email protected], [email protected] Date: Monday, March 12, 2012, 2:47 AM Move META-INF/beans.xml to WEB-INF/beans.xml and try again! Remove META-INF/beans.xml. Gurkan 2012/3/12 <[email protected]> Hi, I am trying to get OpenWebBeans 1.1.5 working in WebLogic 11g (10.3.6). I don't need any JSF (MyFaces) because I am trying to use this for writing Web Services. But I can bring in CODI if it is needed. =============================== Jars in WebContent/WEB-INF/lib: =============================== geronimo-atinject_1.0_spec-1.0.jar geronimo-interceptor_1.1_spec-1.0.jar geronimo-jcdi_1.0_spec-1.0.jar javassist.jar openwebbeans-ee-1.1.3.jar openwebbeans-ee-common-1.1.3.jar openwebbeans-ejb-1.1.3.jar openwebbeans-el10-1.1.3.jar openwebbeans-impl-1.1.3.jar openwebbeans-jms-1.1.3.jar openwebbeans-osgi-1.1.3.jar openwebbeans-resource-1.1.3.jar openwebbeans-spi-1.1.3.jar openwebbeans-web-1.1.3.jar scannotation-1.0.2.jar =============================== WebContent/WEB-INF/web.xml =============================== <web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" id="WebApp_ID" version="2.5"> <display-name>OWBWL11g</display-name> <welcome-file-list> <welcome-file>index.html</welcome-file> </welcome-file-list> <listener> <listener-class>org.apache.webbeans.servlet.WebBeansConfigurationListener</listener-class> </listener> <!-- I ran with and without this resource-env-ref section --> <resource-env-ref> <description>Object factory for the CDI Bean Manager</description> <resource-env-ref-name>BeanManager</resource-env-ref-name> <resource-env-ref-type>javax.enterprise.inject.spi.BeanManager</resource-env-ref-type> </resource-env-ref> <servlet> <description></description> <display-name>BookServlet</display-name> <servlet-name>BookServlet</servlet-name> <servlet-class>oracle.km.cdi.test.model.BookServlet</servlet-class> </servlet> <servlet-mapping> <servlet-name>BookServlet</servlet-name> <url-pattern>/BookServlet</url-pattern> </servlet-mapping> </web-app> =============================== Other files: =============================== src/META-INF/openwebbeans/openwebbeans.properties src/META-INF/persistence.xml WebContent/WEB-INF/weblogic.xml (empty except for weblogic-verison and context-root). =============================== I am getting the following exception: <Mar 11, 2012 9:20:03 PM EDT> <Warning> <JMX> <BEA-149517> <An attempt was made to unregister an mbean that was already unregistered: weblogic.servlet.internal.ServletRuntimeMBeanImpl@5f788551> Mar 11, 2012 9:20:50 PM org.apache.webbeans.web.lifecycle.WebContainerLifecycle startApplication INFO: OpenWebBeans Container is starting... Mar 11, 2012 9:20:50 PM org.apache.webbeans.plugins.PluginLoader startUp INFO: Adding OpenWebBeansPlugin : [OpenWebBeansJmsPlugin] Mar 11, 2012 9:20:50 PM org.apache.webbeans.web.scanner.WebScannerService addWebBeansXmlLocation INFO: added beans.xml marker: file:/C:/Users/test/eclipse/workspaces/2012_0226/.metadata/.plugins/org.eclipse.core.resources/.projects/OWBWL11gEAR/beadep/mydomain/OWBWL11gEAR/OWBWL11g.war/WEB-INF/beans.xml Mar 11, 2012 9:20:50 PM org.apache.webbeans.util.JNDIUtil bind SEVERE: Unable to bind object with name : [java:comp/BeanManager] javax.naming.OperationNotSupportedException: bind not allowed in a ReadOnlyContext; remaining name 'BeanManager' at weblogic.jndi.factories.java.ReadOnlyContextWrapper.newOperationNotSupportedException(ReadOnlyContextWrapper.java:145) at weblogic.jndi.factories.java.ReadOnlyContextWrapper.newOperationNotSupportedException(ReadOnlyContextWrapper.java:161) at weblogic.jndi.factories.java.ReadOnlyContextWrapper.bind(ReadOnlyContextWrapper.java:57) at org.apache.webbeans.util.JNDIUtil.bind(JNDIUtil.java:69) at org.apache.webbeans.ee.common.services.JNDIServiceEnterpriseImpl.bind(JNDIServiceEnterpriseImpl.java:44) at org.apache.webbeans.config.BeansDeployer.deploy(BeansDeployer.java:147) at org.apache.webbeans.lifecycle.AbstractLifeCycle.startApplication(AbstractLifeCycle.java:127) at org.apache.webbeans.web.lifecycle.WebContainerLifecycle.startApplication(WebContainerLifecycle.java:88) at org.apache.webbeans.servlet.WebBeansConfigurationListener.contextInitialized(WebBeansConfigurationListener.java:85) at weblogic.servlet.internal.EventsManager$FireContextListenerAction.run(EventsManager.java:481) at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321) at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:120) at weblogic.servlet.internal.EventsManager.notifyContextCreatedEvent(EventsManager.java:181) at weblogic.servlet.internal.WebAppServletContext.preloadResources(WebAppServletContext.java:1868) at weblogic.servlet.internal.WebAppServletContext.start(WebAppServletContext.java:3154) at weblogic.servlet.internal.WebAppModule.startContexts(WebAppModule.java:1518) at weblogic.servlet.internal.WebAppModule.start(WebAppModule.java:484) at weblogic.application.internal.flow.ModuleStateDriver$3.next(ModuleStateDriver.java:425) at weblogic.application.utils.StateMachineDriver.nextState(StateMachineDriver.java:52) at weblogic.application.internal.flow.ModuleStateDriver.start(ModuleStateDriver.java:119) at weblogic.application.internal.flow.ScopedModuleDriver.start(ScopedModuleDriver.java:200) at weblogic.application.internal.flow.ModuleListenerInvoker.start(ModuleListenerInvoker.java:247) at weblogic.application.internal.flow.ModuleStateDriver$3.next(ModuleStateDriver.java:425) at weblogic.application.utils.StateMachineDriver.nextState(StateMachineDriver.java:52) at weblogic.application.internal.flow.ModuleStateDriver.start(ModuleStateDriver.java:119) at weblogic.application.internal.flow.StartModulesFlow.activate(StartModulesFlow.java:27) at weblogic.application.internal.BaseDeployment$2.next(BaseDeployment.java:671) at weblogic.application.utils.StateMachineDriver.nextState(StateMachineDriver.java:52) at weblogic.application.internal.BaseDeployment.activate(BaseDeployment.java:212) at weblogic.application.internal.EarDeployment.activate(EarDeployment.java:59) at weblogic.application.internal.DeploymentStateChecker.activate(DeploymentStateChecker.java:161) at weblogic.deploy.internal.targetserver.AppContainerInvoker.activate(AppContainerInvoker.java:79) at weblogic.deploy.internal.targetserver.operations.AbstractOperation.activate(AbstractOperation.java:569) at weblogic.deploy.internal.targetserver.operations.ActivateOperation.activateDeployment(ActivateOperation.java:150) at weblogic.deploy.internal.targetserver.operations.ActivateOperation.doCommit(ActivateOperation.java:116) at weblogic.deploy.internal.targetserver.operations.AbstractOperation.commit(AbstractOperation.java:323) at weblogic.deploy.internal.targetserver.DeploymentManager.handleDeploymentCommit(DeploymentManager.java:844) at weblogic.deploy.internal.targetserver.DeploymentManager.activateDeploymentList(DeploymentManager.java:1253) at weblogic.deploy.internal.targetserver.DeploymentManager.handleCommit(DeploymentManager.java:440) at weblogic.deploy.internal.targetserver.DeploymentServiceDispatcher.commit(DeploymentServiceDispatcher.java:163) at weblogic.deploy.service.internal.targetserver.DeploymentReceiverCallbackDeliverer.doCommitCallback(DeploymentReceiverCallbackDeliverer.java:195) at weblogic.deploy.service.internal.targetserver.DeploymentReceiverCallbackDeliverer.access$100(DeploymentReceiverCallbackDeliverer.java:13) at weblogic.deploy.service.internal.targetserver.DeploymentReceiverCallbackDeliverer$2.run(DeploymentReceiverCallbackDeliverer.java:68) at weblogic.work.SelfTuningWorkManagerImpl$WorkAdapterImpl.run(SelfTuningWorkManagerImpl.java:545) at weblogic.work.ExecuteThread.execute(ExecuteThread.java:256) at weblogic.work.ExecuteThread.run(ExecuteThread.java:221) beginning the scanning process scanning type: testowb.cdi.util.EntityTransactionInterceptor scanning type: testowb.cdi.util.EntityTransactionInterceptor scanning type: testowb.cdi.util.PersistenceContextExtension$3 scanning type: testowb.cdi.util.PersistenceContextExtension$1 scanning type: testowb.cdi.test.model.BookFactory scanning type: testowb.cdi.test.model.BookServlet scanning type: testowb.cdi.test.model.Book scanning type: testowb.cdi.util.JTATransactionInterceptor scanning type: testowb.cdi.test.model.Init scanning type: testowb.cdi.util.PersistenceContextExtension$5 scanning type: testowb.cdi.util.PersistenceContextExtension scanning type: testowb.cdi.util.PersistenceContextExtension$4 scanning type: testowb.cdi.util.PersistenceContextExtension$2 scanning type: testowb.cdi.util.Transactional finished the scanning process Mar 11, 2012 9:20:50 PM org.apache.webbeans.config.BeansDeployer validateInjectionPoints INFO: All injection points were validated successfully. Mar 11, 2012 9:20:50 PM org.apache.webbeans.web.lifecycle.WebContainerLifecycle startApplication INFO: OpenWebBeans Container has started, it took [320] ms. I believe "bind not allowed in a ReadOnlyContext;" is similar to this problem Weld has with Tomcat: http://docs.jboss.org/weld/reference/1.1.0.Final/en-US/html/environments.html#d0e5259 But I need a solution for WebLogic 11g similar to the META-INF/context.xml solution recommended there in Weld documentation. WebLogic shows that the application (EAR) is loaded and I can see it in WebLogic console. FYI: 1) I did not add any jars to WebLogic itself or to its startup classpaths. 2) The example is from http://seamframework.org/Documentation/WeldAndJPARunningInTomcat 3) I need to get this working in WebLogic 11g ( I cannot use WebLogic 12c in the environment, CDI is built in to WebLogic 12c and I got the app already working in 12c). 4) If possible I would like to get complete integration with EE injections (using Session Beans with CDI etc) - but I will settle for Servlet Container integration 5) When I try to hit the Book Servlet, I get the following exception implying BookFactory is not injected in to the BookServlet. Error 500--Internal Server Error java.lang.NullPointerException at testowb.cdi.test.model.BookServlet.doGet(BookServlet.java:39) at javax.servlet.http.HttpServlet.service(HttpServlet.java:707) at javax.servlet.http.HttpServlet.service(HttpServlet.java:820) Here is part of the BookServlet class: public class BookServlet extends HttpServlet { @Inject BookFactory bookFactory; protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { String author = request.getParameter("author"); String bookName = request.getParameter("bookName"); if (author != null && bookName != null ) { bookFactory.getBook().setAuthor(author); // <=============== Line 39 bookFactory.getBook().setName(bookName); Book toBeSaved = bookFactory.getBook(); bookFactory.saveBook(); ... } ... } } Thanks, -Chandra -- Gurkan Erdogdu http://gurkanerdogdu.blogspot.com
