Probably i must describe my scenario:
1) I have my application running on same AS (jboss) of jbpm-console
2) My application run on 8082 and it must show the list of deployed processes by jpdl.
3) My application uses its hibernate.cfg.xml and the error makes me wonder to some conflicts with jbpm session.
4) I use jbpm 3.2.2
5) Processdefinition files are deployed on local jbpm-console (just during development)
Where are you running this code?
if you are doing this in a JUnit test, you must ensure that jbpm.cfg.xml is in your classpath, so you can do the following:
JbpmConfiguration conf= JbpmConfiguration.getInstance(); JbpmContext context=conf.createJbpmContext();
Then you should check that your context is not null.
I follow your suggestion but nothing change...it seems jbpm.cfg.xml is not correct because an error regarding a class of my application is required. The error is
Caused by: org.hibernate.MappingException: An AnnotationConfiguration instance is required to use <mapping class="it.eurosoft.mapping....
How do this two simple called functions want MY mapping class? Is jbpm reading my hibernate.cfg.xml? :-(
Of course, if you not have content in your jbpm.cfg.xml, the content is taken from default.jbpm.cfg.xml that is in jbpm-jpdl.jar. Inside this file, there is a reference to hibernate.cfg.xml.
So check your mappings in hibernate.cfg.xml in order to fix your problem
Oh my god...I don't understand...so I need to add to MY hibernate.cfg.xml the mappings, for instance, from hibernate.cfg.xml of jbpm-console...but then it should require me to put in my jar all mapping xml...
If you want to create or use a JbpmContext you need to know where is the structe of the processDefinitions and the processInstances. For this, of course that you need to know where and how all the structure are mapped.
So if you also add entities in variables, you need to map it too...
If you are in a standalone app, you will need the same hibernate mappings that you have in the console.. and may you must change where the Datasource is pointing.
Hope it helps
and how can I know where is the structure of the processDefinitions and the processInstances?
this is why you need hibernate.cfg.xml with the correct mappings..
because there is the structure of your process and the data of your instances.
If you create a sample project with eclipse you should see that a hibernate.cfg.xml is created for you and an empty jbmp.cfg.xml is also created.