Hi all

I'm using a htmlUserDialog wich JSF and i have a jsf custom tag, i build and put it on webapp folder of server. this is a custom tag that i will use on my xhtml. this tag somehow is a jsf event listener, it listen system event of jsf (ex: PostAddToView, PreRenderView,...)

Sometime when i start ivy engine (via Windows services), i got exception:

ch.ivyteam.ivy.environment.EnvironmentNotAvailableException: Access to ivy environment outside a process request thread is not possible.
    Current thread: Thread[http-nio-8082-exec-1,5,main]
        at ch.ivyteam.ivy.environment.Ivy.getIvy(Ivy.java:574)
        at ch.ivyteam.ivy.environment.Ivy.getEnvironmentData(Ivy.java:553)
        at ch.ivyteam.ivy.environment.Ivy.getEnvironmentData(Ivy.java:548)
        at ch.ivyteam.ivy.environment.Ivy.request(Ivy.java:242)
        at ch.axonivy.fintech.guiframework.component.GuiEventListenerFactoryServiceProvider.getProjectClassLoader(GuiEventListenerFactoryServiceProvider.java:67)
        at ch.axonivy.fintech.guiframework.component.GuiEventListenerFactoryServiceProvider.getFactory(GuiEventListenerFactoryServiceProvider.java:32)
        at ch.axonivy.fintech.guiframework.component.GuiEventListenerComponent.<init>(GuiEventListenerComponent.java:46)
        at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
        at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
        at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
        at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
        at java.lang.Class.newInstance(Class.java:442)
        at org.apache.myfaces.application.ApplicationImpl.createComponent(ApplicationImpl.java:1469)
        at javax.faces.application.ApplicationWrapper.createComponent(ApplicationWrapper.java:129)
        at org.apache.myfaces.extensions.validator.core.factory.ExtValApplicationWrapper.createComponent(ExtValApplicationWrapper.java:84)
        at javax.faces.application.ApplicationWrapper.createComponent(ApplicationWrapper.java:129)
        at org.apache.myfaces.view.facelets.compiler.FaceletsCompilerSupport.loadLibraries(FaceletsCompilerSupport.java:141)
        at org.apache.myfaces.view.facelets.FaceletViewDeclarationLanguage.loadLibraries(FaceletViewDeclarationLanguage.java:2526)
        at org.apache.myfaces.view.facelets.FaceletViewDeclarationLanguage.createCompiler(FaceletViewDeclarationLanguage.java:2172)
        at org.apache.myfaces.view.facelets.FaceletViewDeclarationLanguage.initialize(FaceletViewDeclarationLanguage.java:2464)
        at org.apache.myfaces.view.facelets.FaceletViewDeclarationLanguage.<init>(FaceletViewDeclarationLanguage.java:309)
        at org.apache.myfaces.view.facelets.FaceletViewDeclarationLanguageStrategy.<init>(FaceletViewDeclarationLanguageStrategy.java:52)
        at org.apache.myfaces.view.ViewDeclarationLanguageFactoryImpl.initialize(ViewDeclarationLanguageFactoryImpl.java:104)
        at org.apache.myfaces.view.ViewDeclarationLanguageFactoryImpl.getViewDeclarationLanguage(ViewDeclarationLanguageFactoryImpl.java:73)
        at org.apache.myfaces.application.ViewHandlerImpl.getViewDeclarationLanguage(ViewHandlerImpl.java:183)
        at javax.faces.application.ViewHandlerWrapper.getViewDeclarationLanguage(ViewHandlerWrapper.java:133)
        at org.apache.myfaces.shared.application.DefaultViewHandlerSupport.checkResourceExists(DefaultViewHandlerSupport.java:569)
        at org.apache.myfaces.shared.application.DefaultViewHandlerSupport.handleSuffixMapping(DefaultViewHandlerSupport.java:507)

In my jar file, i need to access to ivy project class loader, so i have this line:

 ClassLoader cl = Ivy.request().getProject().getProjectClassLoader();

I have a interface in this jar so i need to get class loader to find which class (from ivy project) is implementing my interface (vis ServiceLoader)

I guess my jar is started before ivy initialize its environment. So how can i solve it ?

P/S: when i try to start some more times, my engine can start but this exception is quite annoying imo

Thanks

asked 29.12.2016 at 12:03

trungdv's gravatar image

trungdv
(suspended)
accept rate: 52%


Ivy.request() is only available in a http-request. As you probably know. On engine start the context is not set up.

Maybe you could initialize your state(s) within the first request. Please keep in mind that the jsf-initialization is NOT done for each project/pmv - just one for the engine.

Anyway, it's hard with just the snipped of a Stacktrace to give valuable feedback. Therefore, could you create a demo project?

Ps. There are investigations (tech stories) to provide contexts for each pmv-set, see here (public) and here (internal). I think this would help a lot to create custom features for ivy...

link

answered 29.12.2016 at 14:27

Flavio%20Sadeghi's gravatar image

Flavio Sadeghi ♦♦
(suspended)
accept rate: 75%

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:

×79

Asked: 29.12.2016 at 12:03

Seen: 2,395 times

Last updated: 29.12.2016 at 14:27