Question

I have successfully created a standalone Java application, communication with our Connections server. The endpoint is defined in the src\META-INF\managed-beans.xml while the sbt.properties is stored in the root of the project.

I want to move the agent to a Notes database as a java-agent. With the Java perspective I can see that the database has a WebContent\WEB-INF folder, but no similar META-INF folder. Putting the managed-beans.xml there doesn't seem to work. I have also tried to define the managed bean inside the WebContent\WEB-INF\faces-config.xml without success (from what I have read so far, it seems like the WEB-INF is more for XPages and web work, while the META-INF is for standalone java agents.

By storing the managed-bean.xml in the sbt.user-directory (C:\Program Files (x86)\IBM\Lotus\Notes\framework at my machine), I got the file to read, but with exceptions. I would be much better if I could store the xml file inside the Notes database.

The code snippet inside the ordinary NotesMain() is

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

BasicEndpoint ep = (BasicEndpoint)EndpointFactory.getEndpoint("connections"); 

EDIT: No success yet, but I saw that the SBTPlayground.nsf had META-INF files located in the Core/Java folder (as seen from the Java Perspective). Tried to place my managed-beans.xml there too, but the agent wouldn't read it (yet!).

Was it helpful?

Solution

faces-config.xml only works when the code is triggered from an xpages, which is not the case when running a java-agent. There are several solution in your case: - You don't use managed beans, but you create your endpoints manually within your code - You create your own managed beans provider (this is an extension point) and load them from your own file Java agents are not designed to support the use of large code libraries. They create a new class loader every time they are invoked, and reload all the classes. This can be lead to performance problems. You can overcome this issue by running the code within an XPages and trigger the XPage from the agent (XAgents), or use an Eclipse Job within the HTTP task (several examples are available on OpenNTF), or use the "DOTS" framework from OpenNTF.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top