将 EJB3 注入基于注释的 JSF2 支持 bean 导致 javax.naming.NameNotFoundException:
我看到其他线程也有类似问题,但无法工作与我的问题有直接联系。希望我没有重复问题。我的问题是这样的:
我使用 Webpsphere 7 和 JSF2 作为共享隔离库。
当我尝试将 EJB3 注入带注释的 JSF2 支持 bean 时,出现此错误 < br>
Caused by: javax.naming.NameNotFoundException: Name comp/env/helloworld.HelloBean not found in context "java:".
但如果我们使用face.xml 配置JSF2 并且不使用注释,它就可以正常工作。然而,如果没有 EJB3 注入,我们可以使用带有 JSF2 注释的应用程序,并且不会看到任何问题,只有当我们尝试注入 ejb3 时才会出现问题。下面是一个简单试用应用程序的代码
服务接口:
package au.com.test;
import javax.ejb.Local;
@Local
public interface SampleService {
public String getServiceName();
}
服务实现:
package au.com.test;
import javax.ejb.Stateless;
import javax.ejb.TransactionAttribute;
import javax.ejb.TransactionAttributeType;
@Stateless
@TransactionAttribute (TransactionAttributeType.NOT_SUPPORTED)
public class SampleSession implements SampleService {
@Override
public String getServiceName() {
return "Sample Service";
}
}
JSF 托管 bean:
package helloworld;
import java.io.Serializable;
import javax.ejb.EJB;
import javax.faces.bean.ManagedBean;
import javax.faces.bean.SessionScoped;
import au.com.example.service.SampleService;
@ManagedBean
@SessionScoped
public class HelloBean implements Serializable {
/**
*
*/
private static final long serialVersionUID = 1L;
private String name;
@EJB
private SampleService sampleService;
public String getName() {
return sampleService.getServiceName()+ name;
}
public void setName(String name) {
this.name = name;
}
}
堆栈跟踪如下
[2/08/11 7:52:20:394 EST] 00000034 HtmlImageRend W ALT attribute is missing for : waveImg
[2/08/11 7:52:20:488 EST] 00000034 FaceletViewDe E Error Rendering View[/hello.xhtml]
javax.faces.FacesException: Could not retrieve value of component with path : {Component-Path : [Class: javax.faces.component.UIViewRoot,ViewId: /hello.xhtml][Class: javax.faces.component.html.HtmlBody,Id: j_id327415688_1383f7c7][Class: javax.faces.component.html.HtmlForm,Id: helloForm][Class: javax.faces.component.html.HtmlInputText,Id: username]}
at org.apache.myfaces.shared_impl.renderkit.RendererUtils.getValue(RendererUtils.java:347)
at org.apache.myfaces.shared_impl.renderkit.RendererUtils.getStringValue(RendererUtils.java:291)
at org.apache.myfaces.shared_impl.renderkit.html.HtmlTextRendererBase.renderInputBegin(HtmlTextRendererBase.java:169)
at org.apache.myfaces.shared_impl.renderkit.html.HtmlTextRendererBase.renderInput(HtmlTextRendererBase.java:158)
at org.apache.myfaces.shared_impl.renderkit.html.HtmlTextRendererBase.encodeEnd(HtmlTextRendererBase.java:75)
at javax.faces.component.UIComponentBase.encodeEnd(UIComponentBase.java:519)
at javax.faces.component.UIComponent.encodeAll(UIComponent.java:672)
at javax.faces.component.UIComponent.encodeAll(UIComponent.java:668)
at javax.faces.component.UIComponent.encodeAll(UIComponent.java:668)
at javax.faces.component.UIComponent.encodeAll(UIComponent.java:668)
at org.apache.myfaces.view.facelets.FaceletViewDeclarationLanguage.renderView(FaceletViewDeclarationLanguage.java:1483)
at org.apache.myfaces.application.ViewHandlerImpl.renderView(ViewHandlerImpl.java:281)
at org.apache.myfaces.lifecycle.RenderResponseExecutor.execute(RenderResponseExecutor.java:85)
at org.apache.myfaces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:239)
at javax.faces.webapp.FacesServlet.service(FacesServlet.java:191)
at com.ibm.ws.webcontainer.servlet.ServletWrapper.service(ServletWrapper.java:1657)
at com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:939)
at com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:502)
at com.ibm.ws.webcontainer.servlet.ServletWrapperImpl.handleRequest(ServletWrapperImpl.java:179)
at com.ibm.ws.webcontainer.webapp.WebAppRequestDispatcher.forward(WebAppRequestDispatcher.java:353)
at com.ibm.ws.webcontainer.extension.DefaultExtensionProcessor.handleRequest(DefaultExtensionProcessor.java:784)
at com.ibm.ws.webcontainer.webapp.WebApp.handleRequest(WebApp.java:3933)
at com.ibm.ws.webcontainer.webapp.WebGroup.handleRequest(WebGroup.java:276)
at com.ibm.ws.webcontainer.WebContainer.handleRequest(WebContainer.java:931)
at com.ibm.ws.webcontainer.WSWebContainer.handleRequest(WSWebContainer.java:1583)
at com.ibm.ws.webcontainer.channel.WCChannelLink.ready(WCChannelLink.java:186)
at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleDiscrimination(HttpInboundLink.java:452)
at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleNewRequest(HttpInboundLink.java:511)
at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.processRequest(HttpInboundLink.java:305)
at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.ready(HttpInboundLink.java:276)
at com.ibm.ws.tcp.channel.impl.NewConnectionInitialReadCallback.sendToDiscriminators(NewConnectionInitialReadCallback.java:214)
at com.ibm.ws.tcp.channel.impl.NewConnectionInitialReadCallback.complete(NewConnectionInitialReadCallback.java:113)
at com.ibm.ws.tcp.channel.impl.AioReadCompletionListener.futureCompleted(AioReadCompletionListener.java:165)
at com.ibm.io.async.AbstractAsyncFuture.invokeCallback(AbstractAsyncFuture.java:217)
at com.ibm.io.async.AsyncChannelFuture.fireCompletionActions(AsyncChannelFuture.java:161)
at com.ibm.io.async.AsyncFuture.completed(AsyncFuture.java:138)
at com.ibm.io.async.ResultHandler.complete(ResultHandler.java:204)
at com.ibm.io.async.ResultHandler.runEventProcessingLoop(ResultHandler.java:775)
at com.ibm.io.async.ResultHandler$2.run(ResultHandler.java:905)
at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:1604)
Caused by: javax.faces.FacesException: javax.naming.NameNotFoundException: Name comp/env/helloworld.HelloBean not found in context "java:".
at org.apache.myfaces.config.ManagedBeanBuilder.buildManagedBean(ManagedBeanBuilder.java:225)
at org.apache.myfaces.el.unified.resolver.ManagedBeanResolver.createManagedBean(ManagedBeanResolver.java:332)
at org.apache.myfaces.el.unified.resolver.ManagedBeanResolver.getValue(ManagedBeanResolver.java:295)
at javax.el.CompositeELResolver.getValue(CompositeELResolver.java:143)
at org.apache.myfaces.el.unified.resolver.FacesCompositeELResolver.getValue(FacesCompositeELResolver.java:142)
at org.apache.myfaces.el.VariableResolverImpl.resolveVariable(VariableResolverImpl.java:65)
at org.apache.myfaces.el.convert.VariableResolverToELResolver.getValue(VariableResolverToELResolver.java:116)
at javax.el.CompositeELResolver.getValue(CompositeELResolver.java:143)
at org.apache.myfaces.el.unified.resolver.FacesCompositeELResolver.getValue(FacesCompositeELResolver.java:142)
at org.apache.el.parser.AstIdentifier.getValue(AstIdentifier.java:45)
at org.apache.el.parser.AstValue.getValue(AstValue.java:91)
at org.apache.el.ValueExpressionImpl.getValue(ValueExpressionImpl.java:263)
at org.apache.myfaces.view.facelets.el.TagValueExpression.getValue(TagValueExpression.java:85)
at javax.faces.component._DeltaStateHelper.eval(_DeltaStateHelper.java:246)
at javax.faces.component.UIOutput.getValue(UIOutput.java:71)
at javax.faces.component.UIInput.getValue(UIInput.java:142)
at org.apache.myfaces.shared_impl.renderkit.RendererUtils.getValue(RendererUtils.java:343)
... 39 more
Caused by: javax.naming.NameNotFoundException: Name comp/env/helloworld.HelloBean not found in context "java:".
at com.ibm.ws.naming.ipbase.NameSpace.getParentCtxInternal(NameSpace.java:1837)
at com.ibm.ws.naming.ipbase.NameSpace.lookupInternal(NameSpace.java:1166)
at com.ibm.ws.naming.ipbase.NameSpace.lookup(NameSpace.java:1095)
at com.ibm.ws.naming.urlbase.UrlContextImpl.lookup(UrlContextImpl.java:1233)
at com.ibm.ws.naming.java.javaURLContextImpl.lookup(javaURLContextImpl.java:395)
at com.ibm.ws.naming.java.javaURLContextRoot.lookup(javaURLContextRoot.java:214)
at com.ibm.ws.naming.java.javaURLContextRoot.lookup(javaURLContextRoot.java:154)
at javax.naming.InitialContext.lookup(InitialContext.java:436)
at org.apache.myfaces.config.annotation.ResourceAnnotationLifecycleProvider.lookupFieldResource(ResourceAnnotationLifecycleProvider.java:127)
at org.apache.myfaces.config.annotation.AllAnnotationLifecycleProvider.checkFieldAnnotation(AllAnnotationLifecycleProvider.java:83)
at org.apache.myfaces.config.annotation.ResourceAnnotationLifecycleProvider.checkAnnotation(ResourceAnnotationLifecycleProvider.java:78)
at org.apache.myfaces.config.annotation.ResourceAnnotationLifecycleProvider.processAnnotations(ResourceAnnotationLifecycleProvider.java:55)
at org.apache.myfaces.config.annotation.NoInjectionAnnotationLifecycleProvider.newInstance(NoInjectionAnnotationLifecycleProvider.java:46)
at org.apache.myfaces.config.ManagedBeanBuilder.buildManagedBean(ManagedBeanBuilder.java:155)
... 55 more
[2/08/11 7:52:20:503 EST] 00000034 ErrorPageWrit E An exception occurred
javax.faces.FacesException: javax.naming.NameNotFoundException: Name comp/env/helloworld.HelloBean not found in context "java:".
at org.apache.myfaces.shared_impl.context.ExceptionHandlerImpl.wrap(ExceptionHandlerImpl.java:241)
at org.apache.myfaces.shared_impl.context.ExceptionHandlerImpl.handle(ExceptionHandlerImpl.java:156)
at org.apache.myfaces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:258)
at javax.faces.webapp.FacesServlet.service(FacesServlet.java:191)
at com.ibm.ws.webcontainer.servlet.ServletWrapper.service(ServletWrapper.java:1657)
at com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:939)
at com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:502)
at com.ibm.ws.webcontainer.servlet.ServletWrapperImpl.handleRequest(ServletWrapperImpl.java:179)
at com.ibm.ws.webcontainer.webapp.WebAppRequestDispatcher.forward(WebAppRequestDispatcher.java:353)
at com.ibm.ws.webcontainer.extension.DefaultExtensionProcessor.handleRequest(DefaultExtensionProcessor.java:784)
at com.ibm.ws.webcontainer.webapp.WebApp.handleRequest(WebApp.java:3933)
at com.ibm.ws.webcontainer.webapp.WebGroup.handleRequest(WebGroup.java:276)
at com.ibm.ws.webcontainer.WebContainer.handleRequest(WebContainer.java:931)
at com.ibm.ws.webcontainer.WSWebContainer.handleRequest(WSWebContainer.java:1583)
at com.ibm.ws.webcontainer.channel.WCChannelLink.ready(WCChannelLink.java:186)
at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleDiscrimination(HttpInboundLink.java:452)
at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleNewRequest(HttpInboundLink.java:511)
at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.processRequest(HttpInboundLink.java:305)
at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.ready(HttpInboundLink.java:276)
at com.ibm.ws.tcp.channel.impl.NewConnectionInitialReadCallback.sendToDiscriminators(NewConnectionInitialReadCallback.java:214)
at com.ibm.ws.tcp.channel.impl.NewConnectionInitialReadCallback.complete(NewConnectionInitialReadCallback.java:113)
at com.ibm.ws.tcp.channel.impl.AioReadCompletionListener.futureCompleted(AioReadCompletionListener.java:165)
at com.ibm.io.async.AbstractAsyncFuture.invokeCallback(AbstractAsyncFuture.java:217)
at com.ibm.io.async.AsyncChannelFuture.fireCompletionActions(AsyncChannelFuture.java:161)
at com.ibm.io.async.AsyncFuture.completed(AsyncFuture.java:138)
at com.ibm.io.async.ResultHandler.complete(ResultHandler.java:204)
at com.ibm.io.async.ResultHandler.runEventProcessingLoop(ResultHandler.java:775)
at com.ibm.io.async.ResultHandler$2.run(ResultHandler.java:905)
at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:1604)
Caused by: javax.naming.NameNotFoundException: Name comp/env/helloworld.HelloBean not found in context "java:".
at com.ibm.ws.naming.ipbase.NameSpace.getParentCtxInternal(NameSpace.java:1837)
at com.ibm.ws.naming.ipbase.NameSpace.lookupInternal(NameSpace.java:1166)
at com.ibm.ws.naming.ipbase.NameSpace.lookup(NameSpace.java:1095)
at com.ibm.ws.naming.urlbase.UrlContextImpl.lookup(UrlContextImpl.java:1233)
at com.ibm.ws.naming.java.javaURLContextImpl.lookup(javaURLContextImpl.java:395)
at com.ibm.ws.naming.java.javaURLContextRoot.lookup(javaURLContextRoot.java:214)
at com.ibm.ws.naming.java.javaURLContextRoot.lookup(javaURLContextRoot.java:154)
at javax.naming.InitialContext.lookup(InitialContext.java:436)
at org.apache.myfaces.config.annotation.ResourceAnnotationLifecycleProvider.lookupFieldResource(ResourceAnnotationLifecycleProvider.java:127)
at org.apache.myfaces.config.annotation.AllAnnotationLifecycleProvider.checkFieldAnnotation(AllAnnotationLifecycleProvider.java:83)
at org.apache.myfaces.config.annotation.ResourceAnnotationLifecycleProvider.checkAnnotation(ResourceAnnotationLifecycleProvider.java:78)
at org.apache.myfaces.config.annotation.ResourceAnnotationLifecycleProvider.processAnnotations(ResourceAnnotationLifecycleProvider.java:55)
at org.apache.myfaces.config.annotation.NoInjectionAnnotationLifecycleProvider.newInstance(NoInjectionAnnotationLifecycleProvider.java:46)
at org.apache.myfaces.config.ManagedBeanBuilder.buildManagedBean(ManagedBeanBuilder.java:155)
at org.apache.myfaces.el.unified.resolver.ManagedBeanResolver.createManagedBean(ManagedBeanResolver.java:332)
at org.apache.myfaces.el.unified.resolver.ManagedBeanResolver.getValue(ManagedBeanResolver.java:295)
at javax.el.CompositeELResolver.getValue(CompositeELResolver.java:143)
at org.apache.myfaces.el.unified.resolver.FacesCompositeELResolver.getValue(FacesCompositeELResolver.java:142)
at org.apache.myfaces.el.VariableResolverImpl.resolveVariable(VariableResolverImpl.java:65)
at org.apache.myfaces.el.convert.VariableResolverToELResolver.getValue(VariableResolverToELResolver.java:116)
at javax.el.CompositeELResolver.getValue(CompositeELResolver.java:143)
at org.apache.myfaces.el.unified.resolver.FacesCompositeELResolver.getValue(FacesCompositeELResolver.java:142)
at org.apache.el.parser.AstIdentifier.getValue(AstIdentifier.java:45)
at org.apache.el.parser.AstValue.getValue(AstValue.java:91)
at org.apache.el.ValueExpressionImpl.getValue(ValueExpressionImpl.java:263)
at org.apache.myfaces.view.facelets.el.TagValueExpression.getValue(TagValueExpression.java:85)
at javax.faces.component._DeltaStateHelper.eval(_DeltaStateHelper.java:246)
at javax.faces.component.UIOutput.getValue(UIOutput.java:71)
at javax.faces.component.UIInput.getValue(UIInput.java:142)
at org.apache.myfaces.shared_impl.renderkit.RendererUtils.getValue(RendererUtils.java:343)
at org.apache.myfaces.shared_impl.renderkit.RendererUtils.getStringValue(RendererUtils.java:291)
at org.apache.myfaces.shared_impl.renderkit.html.HtmlTextRendererBase.renderInputBegin(HtmlTextRendererBase.java:169)
at org.apache.myfaces.shared_impl.renderkit.html.HtmlTextRendererBase.renderInput(HtmlTextRendererBase.java:158)
at org.apache.myfaces.shared_impl.renderkit.html.HtmlTextRendererBase.encodeEnd(HtmlTextRendererBase.java:75)
at javax.faces.component.UIComponentBase.encodeEnd(UIComponentBase.java:519)
at javax.faces.component.UIComponent.encodeAll(UIComponent.java:672)
at javax.faces.component.UIComponent.encodeAll(UIComponent.java:668)
at javax.faces.component.UIComponent.encodeAll(UIComponent.java:668)
at javax.faces.component.UIComponent.encodeAll(UIComponent.java:668)
at org.apache.myfaces.view.facelets.FaceletViewDeclarationLanguage.renderView(FaceletViewDeclarationLanguage.java:1483)
at org.apache.myfaces.application.ViewHandlerImpl.renderView(ViewHandlerImpl.java:281)
at org.apache.myfaces.lifecycle.RenderResponseExecutor.execute(RenderResponseExecutor.java:85)
at org.apache.myfaces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:239)
... 26 more
任何人都可以帮我解决这个问题吗?
更新
这些是位于 EAR 内的两个独立模块,部署为 WAS7
I have seen other thread with similar issue but was not able to work out direct link with my problem . Hopefully I am not repeating a question.My issue is this:
I am using Webpsphere 7 with JSF2 as Shared Isolated Library .
When I try to inject an EJB3 into in an annotated JSF2 backing bean I get this error
Caused by: javax.naming.NameNotFoundException: Name comp/env/helloworld.HelloBean not found in context "java:".
but It works fine if we configure JSF2 using face.xml and not use annotation. However without EJB3 injection we can use the application with JSF2 annotations and not see any issue only when we try to inject ejb3 we get issues. Code from a simple trial app is below
Service interface:
package au.com.test;
import javax.ejb.Local;
@Local
public interface SampleService {
public String getServiceName();
}
Service Implementation:
package au.com.test;
import javax.ejb.Stateless;
import javax.ejb.TransactionAttribute;
import javax.ejb.TransactionAttributeType;
@Stateless
@TransactionAttribute (TransactionAttributeType.NOT_SUPPORTED)
public class SampleSession implements SampleService {
@Override
public String getServiceName() {
return "Sample Service";
}
}
JSF managed bean:
package helloworld;
import java.io.Serializable;
import javax.ejb.EJB;
import javax.faces.bean.ManagedBean;
import javax.faces.bean.SessionScoped;
import au.com.example.service.SampleService;
@ManagedBean
@SessionScoped
public class HelloBean implements Serializable {
/**
*
*/
private static final long serialVersionUID = 1L;
private String name;
@EJB
private SampleService sampleService;
public String getName() {
return sampleService.getServiceName()+ name;
}
public void setName(String name) {
this.name = name;
}
}
The Stack trace is below
[2/08/11 7:52:20:394 EST] 00000034 HtmlImageRend W ALT attribute is missing for : waveImg
[2/08/11 7:52:20:488 EST] 00000034 FaceletViewDe E Error Rendering View[/hello.xhtml]
javax.faces.FacesException: Could not retrieve value of component with path : {Component-Path : [Class: javax.faces.component.UIViewRoot,ViewId: /hello.xhtml][Class: javax.faces.component.html.HtmlBody,Id: j_id327415688_1383f7c7][Class: javax.faces.component.html.HtmlForm,Id: helloForm][Class: javax.faces.component.html.HtmlInputText,Id: username]}
at org.apache.myfaces.shared_impl.renderkit.RendererUtils.getValue(RendererUtils.java:347)
at org.apache.myfaces.shared_impl.renderkit.RendererUtils.getStringValue(RendererUtils.java:291)
at org.apache.myfaces.shared_impl.renderkit.html.HtmlTextRendererBase.renderInputBegin(HtmlTextRendererBase.java:169)
at org.apache.myfaces.shared_impl.renderkit.html.HtmlTextRendererBase.renderInput(HtmlTextRendererBase.java:158)
at org.apache.myfaces.shared_impl.renderkit.html.HtmlTextRendererBase.encodeEnd(HtmlTextRendererBase.java:75)
at javax.faces.component.UIComponentBase.encodeEnd(UIComponentBase.java:519)
at javax.faces.component.UIComponent.encodeAll(UIComponent.java:672)
at javax.faces.component.UIComponent.encodeAll(UIComponent.java:668)
at javax.faces.component.UIComponent.encodeAll(UIComponent.java:668)
at javax.faces.component.UIComponent.encodeAll(UIComponent.java:668)
at org.apache.myfaces.view.facelets.FaceletViewDeclarationLanguage.renderView(FaceletViewDeclarationLanguage.java:1483)
at org.apache.myfaces.application.ViewHandlerImpl.renderView(ViewHandlerImpl.java:281)
at org.apache.myfaces.lifecycle.RenderResponseExecutor.execute(RenderResponseExecutor.java:85)
at org.apache.myfaces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:239)
at javax.faces.webapp.FacesServlet.service(FacesServlet.java:191)
at com.ibm.ws.webcontainer.servlet.ServletWrapper.service(ServletWrapper.java:1657)
at com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:939)
at com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:502)
at com.ibm.ws.webcontainer.servlet.ServletWrapperImpl.handleRequest(ServletWrapperImpl.java:179)
at com.ibm.ws.webcontainer.webapp.WebAppRequestDispatcher.forward(WebAppRequestDispatcher.java:353)
at com.ibm.ws.webcontainer.extension.DefaultExtensionProcessor.handleRequest(DefaultExtensionProcessor.java:784)
at com.ibm.ws.webcontainer.webapp.WebApp.handleRequest(WebApp.java:3933)
at com.ibm.ws.webcontainer.webapp.WebGroup.handleRequest(WebGroup.java:276)
at com.ibm.ws.webcontainer.WebContainer.handleRequest(WebContainer.java:931)
at com.ibm.ws.webcontainer.WSWebContainer.handleRequest(WSWebContainer.java:1583)
at com.ibm.ws.webcontainer.channel.WCChannelLink.ready(WCChannelLink.java:186)
at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleDiscrimination(HttpInboundLink.java:452)
at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleNewRequest(HttpInboundLink.java:511)
at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.processRequest(HttpInboundLink.java:305)
at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.ready(HttpInboundLink.java:276)
at com.ibm.ws.tcp.channel.impl.NewConnectionInitialReadCallback.sendToDiscriminators(NewConnectionInitialReadCallback.java:214)
at com.ibm.ws.tcp.channel.impl.NewConnectionInitialReadCallback.complete(NewConnectionInitialReadCallback.java:113)
at com.ibm.ws.tcp.channel.impl.AioReadCompletionListener.futureCompleted(AioReadCompletionListener.java:165)
at com.ibm.io.async.AbstractAsyncFuture.invokeCallback(AbstractAsyncFuture.java:217)
at com.ibm.io.async.AsyncChannelFuture.fireCompletionActions(AsyncChannelFuture.java:161)
at com.ibm.io.async.AsyncFuture.completed(AsyncFuture.java:138)
at com.ibm.io.async.ResultHandler.complete(ResultHandler.java:204)
at com.ibm.io.async.ResultHandler.runEventProcessingLoop(ResultHandler.java:775)
at com.ibm.io.async.ResultHandler$2.run(ResultHandler.java:905)
at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:1604)
Caused by: javax.faces.FacesException: javax.naming.NameNotFoundException: Name comp/env/helloworld.HelloBean not found in context "java:".
at org.apache.myfaces.config.ManagedBeanBuilder.buildManagedBean(ManagedBeanBuilder.java:225)
at org.apache.myfaces.el.unified.resolver.ManagedBeanResolver.createManagedBean(ManagedBeanResolver.java:332)
at org.apache.myfaces.el.unified.resolver.ManagedBeanResolver.getValue(ManagedBeanResolver.java:295)
at javax.el.CompositeELResolver.getValue(CompositeELResolver.java:143)
at org.apache.myfaces.el.unified.resolver.FacesCompositeELResolver.getValue(FacesCompositeELResolver.java:142)
at org.apache.myfaces.el.VariableResolverImpl.resolveVariable(VariableResolverImpl.java:65)
at org.apache.myfaces.el.convert.VariableResolverToELResolver.getValue(VariableResolverToELResolver.java:116)
at javax.el.CompositeELResolver.getValue(CompositeELResolver.java:143)
at org.apache.myfaces.el.unified.resolver.FacesCompositeELResolver.getValue(FacesCompositeELResolver.java:142)
at org.apache.el.parser.AstIdentifier.getValue(AstIdentifier.java:45)
at org.apache.el.parser.AstValue.getValue(AstValue.java:91)
at org.apache.el.ValueExpressionImpl.getValue(ValueExpressionImpl.java:263)
at org.apache.myfaces.view.facelets.el.TagValueExpression.getValue(TagValueExpression.java:85)
at javax.faces.component._DeltaStateHelper.eval(_DeltaStateHelper.java:246)
at javax.faces.component.UIOutput.getValue(UIOutput.java:71)
at javax.faces.component.UIInput.getValue(UIInput.java:142)
at org.apache.myfaces.shared_impl.renderkit.RendererUtils.getValue(RendererUtils.java:343)
... 39 more
Caused by: javax.naming.NameNotFoundException: Name comp/env/helloworld.HelloBean not found in context "java:".
at com.ibm.ws.naming.ipbase.NameSpace.getParentCtxInternal(NameSpace.java:1837)
at com.ibm.ws.naming.ipbase.NameSpace.lookupInternal(NameSpace.java:1166)
at com.ibm.ws.naming.ipbase.NameSpace.lookup(NameSpace.java:1095)
at com.ibm.ws.naming.urlbase.UrlContextImpl.lookup(UrlContextImpl.java:1233)
at com.ibm.ws.naming.java.javaURLContextImpl.lookup(javaURLContextImpl.java:395)
at com.ibm.ws.naming.java.javaURLContextRoot.lookup(javaURLContextRoot.java:214)
at com.ibm.ws.naming.java.javaURLContextRoot.lookup(javaURLContextRoot.java:154)
at javax.naming.InitialContext.lookup(InitialContext.java:436)
at org.apache.myfaces.config.annotation.ResourceAnnotationLifecycleProvider.lookupFieldResource(ResourceAnnotationLifecycleProvider.java:127)
at org.apache.myfaces.config.annotation.AllAnnotationLifecycleProvider.checkFieldAnnotation(AllAnnotationLifecycleProvider.java:83)
at org.apache.myfaces.config.annotation.ResourceAnnotationLifecycleProvider.checkAnnotation(ResourceAnnotationLifecycleProvider.java:78)
at org.apache.myfaces.config.annotation.ResourceAnnotationLifecycleProvider.processAnnotations(ResourceAnnotationLifecycleProvider.java:55)
at org.apache.myfaces.config.annotation.NoInjectionAnnotationLifecycleProvider.newInstance(NoInjectionAnnotationLifecycleProvider.java:46)
at org.apache.myfaces.config.ManagedBeanBuilder.buildManagedBean(ManagedBeanBuilder.java:155)
... 55 more
[2/08/11 7:52:20:503 EST] 00000034 ErrorPageWrit E An exception occurred
javax.faces.FacesException: javax.naming.NameNotFoundException: Name comp/env/helloworld.HelloBean not found in context "java:".
at org.apache.myfaces.shared_impl.context.ExceptionHandlerImpl.wrap(ExceptionHandlerImpl.java:241)
at org.apache.myfaces.shared_impl.context.ExceptionHandlerImpl.handle(ExceptionHandlerImpl.java:156)
at org.apache.myfaces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:258)
at javax.faces.webapp.FacesServlet.service(FacesServlet.java:191)
at com.ibm.ws.webcontainer.servlet.ServletWrapper.service(ServletWrapper.java:1657)
at com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:939)
at com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:502)
at com.ibm.ws.webcontainer.servlet.ServletWrapperImpl.handleRequest(ServletWrapperImpl.java:179)
at com.ibm.ws.webcontainer.webapp.WebAppRequestDispatcher.forward(WebAppRequestDispatcher.java:353)
at com.ibm.ws.webcontainer.extension.DefaultExtensionProcessor.handleRequest(DefaultExtensionProcessor.java:784)
at com.ibm.ws.webcontainer.webapp.WebApp.handleRequest(WebApp.java:3933)
at com.ibm.ws.webcontainer.webapp.WebGroup.handleRequest(WebGroup.java:276)
at com.ibm.ws.webcontainer.WebContainer.handleRequest(WebContainer.java:931)
at com.ibm.ws.webcontainer.WSWebContainer.handleRequest(WSWebContainer.java:1583)
at com.ibm.ws.webcontainer.channel.WCChannelLink.ready(WCChannelLink.java:186)
at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleDiscrimination(HttpInboundLink.java:452)
at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleNewRequest(HttpInboundLink.java:511)
at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.processRequest(HttpInboundLink.java:305)
at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.ready(HttpInboundLink.java:276)
at com.ibm.ws.tcp.channel.impl.NewConnectionInitialReadCallback.sendToDiscriminators(NewConnectionInitialReadCallback.java:214)
at com.ibm.ws.tcp.channel.impl.NewConnectionInitialReadCallback.complete(NewConnectionInitialReadCallback.java:113)
at com.ibm.ws.tcp.channel.impl.AioReadCompletionListener.futureCompleted(AioReadCompletionListener.java:165)
at com.ibm.io.async.AbstractAsyncFuture.invokeCallback(AbstractAsyncFuture.java:217)
at com.ibm.io.async.AsyncChannelFuture.fireCompletionActions(AsyncChannelFuture.java:161)
at com.ibm.io.async.AsyncFuture.completed(AsyncFuture.java:138)
at com.ibm.io.async.ResultHandler.complete(ResultHandler.java:204)
at com.ibm.io.async.ResultHandler.runEventProcessingLoop(ResultHandler.java:775)
at com.ibm.io.async.ResultHandler$2.run(ResultHandler.java:905)
at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:1604)
Caused by: javax.naming.NameNotFoundException: Name comp/env/helloworld.HelloBean not found in context "java:".
at com.ibm.ws.naming.ipbase.NameSpace.getParentCtxInternal(NameSpace.java:1837)
at com.ibm.ws.naming.ipbase.NameSpace.lookupInternal(NameSpace.java:1166)
at com.ibm.ws.naming.ipbase.NameSpace.lookup(NameSpace.java:1095)
at com.ibm.ws.naming.urlbase.UrlContextImpl.lookup(UrlContextImpl.java:1233)
at com.ibm.ws.naming.java.javaURLContextImpl.lookup(javaURLContextImpl.java:395)
at com.ibm.ws.naming.java.javaURLContextRoot.lookup(javaURLContextRoot.java:214)
at com.ibm.ws.naming.java.javaURLContextRoot.lookup(javaURLContextRoot.java:154)
at javax.naming.InitialContext.lookup(InitialContext.java:436)
at org.apache.myfaces.config.annotation.ResourceAnnotationLifecycleProvider.lookupFieldResource(ResourceAnnotationLifecycleProvider.java:127)
at org.apache.myfaces.config.annotation.AllAnnotationLifecycleProvider.checkFieldAnnotation(AllAnnotationLifecycleProvider.java:83)
at org.apache.myfaces.config.annotation.ResourceAnnotationLifecycleProvider.checkAnnotation(ResourceAnnotationLifecycleProvider.java:78)
at org.apache.myfaces.config.annotation.ResourceAnnotationLifecycleProvider.processAnnotations(ResourceAnnotationLifecycleProvider.java:55)
at org.apache.myfaces.config.annotation.NoInjectionAnnotationLifecycleProvider.newInstance(NoInjectionAnnotationLifecycleProvider.java:46)
at org.apache.myfaces.config.ManagedBeanBuilder.buildManagedBean(ManagedBeanBuilder.java:155)
at org.apache.myfaces.el.unified.resolver.ManagedBeanResolver.createManagedBean(ManagedBeanResolver.java:332)
at org.apache.myfaces.el.unified.resolver.ManagedBeanResolver.getValue(ManagedBeanResolver.java:295)
at javax.el.CompositeELResolver.getValue(CompositeELResolver.java:143)
at org.apache.myfaces.el.unified.resolver.FacesCompositeELResolver.getValue(FacesCompositeELResolver.java:142)
at org.apache.myfaces.el.VariableResolverImpl.resolveVariable(VariableResolverImpl.java:65)
at org.apache.myfaces.el.convert.VariableResolverToELResolver.getValue(VariableResolverToELResolver.java:116)
at javax.el.CompositeELResolver.getValue(CompositeELResolver.java:143)
at org.apache.myfaces.el.unified.resolver.FacesCompositeELResolver.getValue(FacesCompositeELResolver.java:142)
at org.apache.el.parser.AstIdentifier.getValue(AstIdentifier.java:45)
at org.apache.el.parser.AstValue.getValue(AstValue.java:91)
at org.apache.el.ValueExpressionImpl.getValue(ValueExpressionImpl.java:263)
at org.apache.myfaces.view.facelets.el.TagValueExpression.getValue(TagValueExpression.java:85)
at javax.faces.component._DeltaStateHelper.eval(_DeltaStateHelper.java:246)
at javax.faces.component.UIOutput.getValue(UIOutput.java:71)
at javax.faces.component.UIInput.getValue(UIInput.java:142)
at org.apache.myfaces.shared_impl.renderkit.RendererUtils.getValue(RendererUtils.java:343)
at org.apache.myfaces.shared_impl.renderkit.RendererUtils.getStringValue(RendererUtils.java:291)
at org.apache.myfaces.shared_impl.renderkit.html.HtmlTextRendererBase.renderInputBegin(HtmlTextRendererBase.java:169)
at org.apache.myfaces.shared_impl.renderkit.html.HtmlTextRendererBase.renderInput(HtmlTextRendererBase.java:158)
at org.apache.myfaces.shared_impl.renderkit.html.HtmlTextRendererBase.encodeEnd(HtmlTextRendererBase.java:75)
at javax.faces.component.UIComponentBase.encodeEnd(UIComponentBase.java:519)
at javax.faces.component.UIComponent.encodeAll(UIComponent.java:672)
at javax.faces.component.UIComponent.encodeAll(UIComponent.java:668)
at javax.faces.component.UIComponent.encodeAll(UIComponent.java:668)
at javax.faces.component.UIComponent.encodeAll(UIComponent.java:668)
at org.apache.myfaces.view.facelets.FaceletViewDeclarationLanguage.renderView(FaceletViewDeclarationLanguage.java:1483)
at org.apache.myfaces.application.ViewHandlerImpl.renderView(ViewHandlerImpl.java:281)
at org.apache.myfaces.lifecycle.RenderResponseExecutor.execute(RenderResponseExecutor.java:85)
at org.apache.myfaces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:239)
... 26 more
Can any one help me with this .
UPDATE
These are two separate modules sitting inside an EAR which gets deployed WAS7
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
不考虑共享库来定位组件定义注释(如 @ManagedBean),因此找不到该组件,这意味着在构建 java:comp 命名空间时找不到其 @EJB。您的选择是:
对于#4,一个例子是:
Shared libraries are not considered for locating component-defining annotations (like @ManagedBean), so the component is not found, which means its @EJB is not found while building the java:comp namespace. Your options are:
For #4, an example would be: