Skip to main content

How to use the ModelService Class

  4 posts   Feedicon  
Replies: 3 - Last Post: January 24, 2013 21:32
by: Ralph
showing 1 - 4 of 4
Posted: January 15, 2013 21:27 by random_user

Hi, I´m trying to use the ModelService to retrieve data from a workflow.

When I create a ModelService object and call a method i get a null pointer exception. I tried to use the importModel method to import my workflow but it didn´t work because of a wrong InputStream parameter.

So my questions is what is the cause of the null pointer exception and if the importModel method solves the exception, how do you use it?

thank you for your help

Posted: January 16, 2013 13:30 by Ralph
Hi,
please check if your ModelService is injected correctly.
I guess you inject the ModelService EJB with

 // ModelServcie
 @EJB
 org.imixs.workflow.jee.ejb.ModelService modelService;


As it sounds your service is not injected? So if you call any method from this service you got a null pointer exception

public void doSomething()  {
  if (modelService==null)
    // ejbs are not deployed correctly !
}


Can you please check this. Maybe you can post a code snippet here.

===
Ralph
Posted: January 22, 2013 17:25 by random_user
Hi,
sorry for my late answer.

It looks like the Bean was correct, there was a missing entry in the sun-ejb-jar.xml:

<ejb>
<ejb-name>ModelService</ejb-name>
<principal>
<name>Username</name>
</principal>
</ejb>

after adding this, everything worked fine Smile

Thanks for your help
Posted: January 24, 2013 21:32 by Ralph
Glad to hear that it works now Smile
It sounds as if you're trying to access the EJBs as Anonymous? That works well if you add the principal key into the sun-ejb.jar.
The other solution is to secure your application in general and access the imixs ejbs only with authenticated users.
See also: http://www.imixs.org/jee/acl_deployment.html
Replies: 3 - Last Post: January 24, 2013 21:32
by: Ralph
 
 
Close
loading
Please Confirm
Close