[jboss-user] [JBoss jBPM] - Re: SessionFactory creation

iantimothy do-not-reply at jboss.com
Tue Apr 10 07:32:14 EDT 2007


yup...like the example code I gave, you would need to create a class (e.g. JbpmUtil.java) and use a static initializer to create an instance of the JbpmConfiguration object.

Also, you need a static method to access the created static jbpmConfiguration.

Then, you would need a listener.  i.e.

public class AppListener implements ServletContextListener

You can try googling how to implement the listener.

then you can put this line in the web.xml file

  |   <listener-class>package.AppListener</listener-class>
  |  </listener>

You could google how to do this also.

In your AppListener, you would need to use this code.

public void contextInitialized(ServletContextEvent arg0) {
  |   try  {
  |     Class.forName("package.JbpmUtil").newInstance();
  |   }
  |   catch (Exception e)  {
  |     e.printStackTrace();
  |   }	
  | }	

I suggest you google this to get the actual code but I hoped that you have been pointed in the right direction.

What happens is when the server starts, the listener contextInitialized method will be called which will then create an instance of JbpmUtil.  When this happens, the JbpmConfiguration is created.  I think from then on, you can get the sessionfactory u need from jbpmConfiguration.

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4035932#4035932

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4035932

More information about the jboss-user mailing list