How does the Social Business Toolkit Samples application uses managed-beans.xml?

So far I have:

  • installed and started sbt.sample-1.0.0.20140125-1133.ear on my WebSphere Application Server,
  • added an URL resource for the SBT Properties file.

The Social Business Toolkit Samples app runs fine and I'm able to connect to my IBM Connections and retrieve some ActivityStream entries.

When I first loaded the application, I noticed this error:

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. 

In the Samples application's ibm-web-bnd.xml file I found this line:

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

And in the 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> 

I'm wondering, why should there be an URL resource to the JSF Application Configuration Resource File (managed-beans.xml) in the first place? According to the Java EE documentation the JavaServer Faces implementation will look for it in the /WEB-INF/ folder.

Does the SBT uses JavaServer Faces technology somewhere? Or can I choose not to use the managed-beans.xml file in my own applications that use the SBT?

Answers


I wouldn't recommend you consider them related. managed-beans.xml had a prior name, and it's just a set of configuration objects. The project itself does not use Java Server Faces.


I just read the documentation again, more carefully than the first time, and I think I now have a better understanding of what I asked in my second question. From the documentation:

In a web application SBTFilter (HTTP servlet filter) is responsible for initializing the application using servlet context. Application does the initialization like loading the managed beans and properties factories.

The sample app is a web application. I think in my own application I can choose to use com.ibm.commons.runtime.impl.app.ApplicationStandalone instead of com.ibm.commons.runtime.impl.servlet.ApplicationServlet and then configure an endpoint programmatically. Or alternatively do not use an Application at all, like so:

RuntimeFactory runtimeFactory = new RuntimeFactoryStandalone();
Application application = runtimeFactory.initApplication(null);
Context.init(application, null, null);

Need Your Help

Setting environment variables for no-login users

linux tomcat environment-variables .bash-profile login-script

I have an RHEL server with tomcat installed. Tomcat runs as a no-login user called tomcat . I have set the required environment variables in /etc/profile.d/myenvvars.sh as

F# - Keep F# interactive from posting output

f# f#-interactive

I'm working with F# interactive and I'm computing some large lists and arrays and I'd rather not have the interactive window post all of that information. Is there way to suppress output?