[Persistence, JBoss/CMP, Hibernate, Database] - Re: Referenced datasource not found with JBoss 5.0 (Beta4)
by jaikiran
I think what "depryf" is trying to do is, define a resource-ref named "app-specific/datasource" for the "java:/app/datasource" datasource and then use java:comp/env/app-specific/datasource as the jndi-name for looking up the datasource.
depryf,
Going by the exception stacktrace, i guess this is what is happening:
anonymous wrote :
| at $Proxy109.getDbColumnInfo(Unknown Source)
| at com.imsweb.seerdms.shared.util.PropertyMappingsUtils.initialize(PropertyMappingsUtils.jav
| a:139)
| at com.imsweb.seerdms.shared.util.PropertyMappingsUtils.initialize(PropertyMappingsUtils.jav
| a:111)
| at com.imsweb.seerdms.web.shared.configuration.ConfigurationServlet.init(ConfigurationServle
| t.java:158)
| at javax.servlet.GenericServlet.init(GenericServlet.java:212)
anonymous wrote : at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:629)
| at javax.naming.InitialContext.lookup(InitialContext.java:392)
| at com.imsweb.seerdms.shared.api.ServiceLocator.lookup(ServiceLocator.java:631)
| at com.imsweb.seerdms.shared.api.ServiceLocator.getConnection(ServiceLocator.java:597)
| at com.imsweb.seerdms.app.shared.dao.hibernate.HibernateCommonDataDAO.getDbColumnInfo(Hibern
| ateCommonDataDAO.java:97)
You have a resource-ref defined in your web component, in which you have a startup servlet. This startup servlet will then have access to the java:comp/env/app-specific/datasource datasource. Based on the exception stacktrace, i can see that in the init method of your startup servlet you are looking up an EJB and invoking an method on the EJB. The EJB then (i guess through a DAO) tries to lookup the datasource using java:comp/env/app-specific/datasource jndi-name. This is not going to work because, the EJB has its own java:comp/env namespace. Since you have specified the resource-ref for your web component and not the EJB component, the java:comp/env namespace will be empty for the EJB and hence the lookup fails.
Just to verify this, you can lookup the datasource "java:comp/env/app-specific/datasource" directly in the init method of the startup servlet. I believe you should be able to successfully get the datasource.
If you want the datasource to be available at java:comp/env namespace of the EJB, then you will have to define a resource-ref through the ejb-jar.xml and jboss.xml for the EJB.
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4143648#4143648
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4143648
18 years, 2 months
[JBoss jBPM] - The 'correct' way to join application data to a workflow ins
by nathancoast
My app has a persistent business object model. I also have a persistent jbpm workflow which describes the status of an entities in my biz model.
I need to select entities based on their workflow state and their data. E.g. A global document system where documents are approved by regional editors. I need to select all documents in the state "awaiting approval" where the document region is EU.
I'm not sure of the correct approach to model this:
1) place the relevant document attributes (doc_id, region) as variables within the workflow. Search for approval workflow tasks with matching process vars - region = 'EU'. Necessitates duplication of vars between biz entity and process vars.
2) add an attribute to the doc entity (process_id). Search for approval workflow tasks, joined to biz model where doc.region = 'EU' and doc.process_id = foo.
3) place the doc_id as a variable in the workflow and query both process and biz database joined by doc_id and were doc.region = 'EU'
Is there a "correct" way to achieve this?
Thanks in advance,
Nathan
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4143643#4143643
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4143643
18 years, 2 months