Hello IvyTeam,

My Ivy Version : 7.0.3 I would like to get the url from a process in a JAX-RS Rest Resource but I get an Exception with this code:

Ivy.html().startref("Functional Processes/dis/videoIdentification/start.ivp")

The JAX-RS Resource is located in the same project as the process. It works without problem in a Process (IvyScript Step).

I can imagine that the fact the code is in a JAX-RS Resource does not allow accessing some Ivy resources like the ProjectModelVersion Provider. Is there a workaround for that? Or do I have to compute the url more manually with the InetAddress and so on ? By the way this code works in this resource: Ivy.html().applicationHomeRef()

Thanks in advance

Here the StackTrace I get:


com.google.inject.ProvisionException: Unable to provision, see the following errors:

1) Error in custom provider, java.lang.NullPointerException
  while locating ch.ivyteam.ivy.workflow.internal.di.CaseProjectProcessModelVersionProvider
  while locating ch.ivyteam.ivy.application.IProcessModelVersion annotated with interface ch.ivyteam.ivy.scope.restricted.FromCaseScope
Caused by: java.lang.NullPointerException
    at ch.ivyteam.ivy.workflow.internal.di.CaseProjectProcessModelVersionProvider.get(CaseProjectProcessModelVersionProvider.java:18)
    at ch.ivyteam.ivy.workflow.internal.di.CaseProjectProcessModelVersionProvider.get(CaseProjectProcessModelVersionProvider.java:1)
    at com.google.inject.internal.ProviderInternalFactory.provision(ProviderInternalFactory.java:81)
    at com.google.inject.internal.BoundProviderFactory.provision(BoundProviderFactory.java:72)
    at com.google.inject.internal.ProviderInternalFactory.circularGet(ProviderInternalFactory.java:61)
    at com.google.inject.internal.BoundProviderFactory.get(BoundProviderFactory.java:62)
    at com.google.inject.internal.InjectorImpl$2$1.call(InjectorImpl.java:1019)
    at com.google.inject.internal.InjectorImpl.callInContext(InjectorImpl.java:1085)
    at com.google.inject.internal.InjectorImpl$2.get(InjectorImpl.java:1015)
    at com.google.inject.internal.InjectorImpl.getInstance(InjectorImpl.java:1050)
    at ch.ivyteam.di.restricted.DiInjector.getInstance(DiInjector.java:77)
    at 

asked 18.04.2018 at 15:06

Emmanuel%20Comba's gravatar image

Emmanuel Comba
(suspended)
accept rate: 50%

edited 25.04.2018 at 03:10

Alex%20Suter's gravatar image

Alex Suter ♦♦
3.1k122247


Hi @Emmanuel Comba

This bug has been fixed with Ivy 7.0.5 and Ivy 7.2. For other versions consider the workaround via a sub process call.

Have a look at ConnectivityDemos:

com.axonivy.connectivity.rest.provider.ApprovalService

Does this code snippet fit you rneeds?

ITask task = SubProcessCall.withPath("rest/createApproval")
                .withParam("title", title)
                .withParam("description", description)
                .call()
                .get("approvalTask", ITask.class);
link

answered 19.04.2018 at 01:39

Alex%20Suter's gravatar image

Alex Suter ♦♦
3.1k122247
accept rate: 84%

edited 25.04.2018 at 03:10

Hi Alex,

Thanks for your answer. This is unfortunately not exactly my use-case. What I want to achieve is:

  • A Rest Client calls the Rest Resource located in Ivy Process Model A. This Process Model has a bunch of process Starts (not SubCallable),
  • The Rest Resource provides a response Object (JSON) with several properties, among them the url of one of the process Start.
  • So I just want there to compute the Process Call url dynamically and "easily" ;)

Normally

Ivy.html().startref("Functional Processes/dis/videoIdentification/start.ivp")

is the easiest way to perform that. But in the case of a jax-rs Rest Resource, I suppose that the we are outside any "real" Ivy context. That could explain why I get the Error I have posted in my first post.

Do you know another way to perform that?

Thanks in advance Emmanuel

link

answered 19.04.2018 at 01:55

Emmanuel%20Comba's gravatar image

Emmanuel Comba
(suspended)
accept rate: 50%

1

hi @Emmanuel Comba I think you're right about in RestAPI we're outside of 'real' ivy context. I also can't use some api like ivy.repo or ivy.rule but i can use ivy.log or ivy.cms.

Normally i need to create callablesub just to execute Ivy.html().startref() then trigger it from RestApi.

I'm looking forward for another solution. :)

(19.04.2018 at 07:12) trungdv trungdv's gravatar image

Hi @trungdv and @Alex Suter Thanks for your help. Calling a subcallable that compute, the given processName url, from the rest Resource is working fine. It is a little bit more complex but it is acceptable ;) It would be great to have access to the Ivy Context within a jax rs resource. Thanks and cheers Emmanuel

(19.04.2018 at 08:37) Emmanuel Comba Emmanuel%20Comba's gravatar image
1

Hello everybody.

Thanks for the additional info. We think that this is a bug and we will fix that. But some api like ivy.repo.get(), will still fail, because they relates to a case. And in the rest context, there is no case set. There you must use ivy.repo.find(): XIVY-2504

(19.04.2018 at 09:51) Alex Suter ♦♦ Alex%20Suter's gravatar image
Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "Title")
  • image?![alt text](/path/img.jpg "Title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Tags:

×147
×37
×33
×4

Asked: 18.04.2018 at 15:06

Seen: 2,166 times

Last updated: 25.04.2018 at 03:10