0 Replies Latest reply on Dec 19, 2005 6:30 PM by Venkat Challagulla

    Using the portal data source for getting the user and his ro

    Venkat Challagulla Newbie

      Hi all,
      I am using portal 2.0.1RC1 and jbpm 3.0.2.

      I want to use the JBoss portal datasource to get the User details and his roles instead of the jbpm datasource. The current jboss-service.xml of jbpm is

      < mbean code="org.jbpm.db.jmx.JbpmService" name="jboss.jbpm:name=DefaultJbpm,service=JbpmService" description="Default jBPM Service">
      < attribute name="JndiName">java:/jbpm/JbpmSessionFactory
      < depends>jboss.jca:service=DataSourceBinding,name=DefaultDS
      < /depends>
      < /mbean>

      I changed the datasource from "DefaultDS" to "PortalDS". However, when I tried to call the following line in UserBean.java of sample webapp,

      userModule = (UserModule)new InitialContext().lookup(ModuleConstants.USERMODULE_JNDINAME);

      it gives me an null pointer exception as follows:

      15:07:07,818 INFO [STDOUT] java.lang.NullPointerException
      15:07:07,828 INFO [STDOUT] at org.hibernate.impl.SessionFactoryImpl.getCurrentSession(SessionFactoryImpl.java:509)
      15:07:07,828 INFO [STDOUT] at org.jboss.portal.core.impl.user.UserModuleImp
      15:07:07,828 INFO [STDOUT] at org.jboss.portal.core.impl.user.UserModuleImpl.getUserCount(UserModuleImpl.java:198)
      15:07:07,828 INFO [STDOUT] at org.jbpm.webapp.bean.UserBean.getUserSelectItems(UserBean.java:76)

      It is not able to getCurrentSession of "portal"
      SessionFactory sf = (SessionFactory)new InitialContext().lookup("java:portal/SessionFactory");
      Session session = sf.getCurrentSession();

      How do I change the jboss-service.xml and hibernate.cfg.xml to make jbpm get the session of portal.