0

到目前为止,我有:

  • sbt.sample-1.0.0.20140125-1133.ear在我的 WebSphere Application Server 上安装并启动,
  • 为 SBT 属性文件添加了 URL 资源。

Social Business Toolkit Samples 应用程序运行良好,我能够连接到我的 IBM Connections 并检索一些 ActivityStream 条目。

当我第一次加载应用程序时,我注意到了这个错误:

Exception stack trace: com.ibm.websphere.naming.CannotInstantiateObjectException: A NameNotFoundException occurred on an indirect lookup on the name java:comp/env/url/ibmsbt-managedbeansxml. The name java:comp/env/url/ibmsbt-managedbeansxml maps to a JNDI name in deployment descriptor bindings for the application performing the JNDI lookup. Make sure that the JNDI name mapping in the deployment descriptor binding is correct. If the JNDI name mapping is correct, make sure the target resource can be resolved with the specified name relative to the default initial context. 

在 Samples 应用程序的ibm-web-bnd.xml文件中,我找到了这一行:

<resource-ref name="url/ibmsbt-managedbeansxml" binding-name="url/ibmsbt-managedbeansxml" />

并且在web.xml

<resource-ref>
    <description>Reference to a URL resource which points to the managed bean configuration for the Social Business Toolkit.</description>
    <res-ref-name>url/ibmsbt-managedbeansxml</res-ref-name>
    <res-type>java.net.URL</res-type>
    <res-auth>Container</res-auth>
    <res-sharing-scope>Shareable</res-sharing-scope>
</resource-ref> 



我想知道,为什么首先应该有一个指向 JSF 应用程序配置资源文件 ( managed-beans.xml) 的 URL 资源?根据 Java EE 文档,JavaServer Faces 实现将在/WEB-INF/文件夹中查找它。

SBT 是否在某处使用 JavaServer Faces 技术?或者我可以选择不在managed-beans.xml我自己的使用 SBT 的应用程序中使用该文件吗?

4

2 回答 2

1

我不建议您将它们视为相关。managed-beans.xml 有一个先前的名称,它只是一组配置对象。该项目本身不使用 Java Server Faces。

于 2014-03-12T15:26:47.817 回答
1

我只是再次阅读文档,比第一次更仔细,我想我现在对我在第二个问题中提出的问题有了更好的理解。从文档中:

在 Web 应用程序中,SBTFilter(HTTP servlet 过滤器)负责使用 servlet 上下文初始化应用程序。应用程序执行初始化,例如加载托管 bean 和属性工厂。

示例应用程序是一个 Web 应用程序。我认为在我自己的应用程序中,我可以选择使用com.ibm.commons.runtime.impl.app.ApplicationStandalone而不是com.ibm.commons.runtime.impl.servlet.ApplicationServlet然后以编程方式配置端点。或者根本不使用应用程序,如下所示:

RuntimeFactory runtimeFactory = new RuntimeFactoryStandalone();
Application application = runtimeFactory.initApplication(null);
Context.init(application, null, null);
于 2014-03-19T10:42:01.950 回答