0

I have a maven enterprise project (skinny) with omnifaces 1.4.1 glassfish 3.1.2.2 primefaces 3.5 primefaces extensions 0.6.3 myfaces extcdi 1.0.5

When i deploy the ear, the error is:

remote failure: Error occurred during deployment: Exception while loading the app : java.lang.IllegalStateException: ContainerBase.addChild: start: org.apache.catalina.LifecycleException: java.lang.IllegalArgumentException: javax.servlet.ServletException: com.sun.enterprise.container.common.spi.util.InjectionException: Error creating managed object for class: class org.omnifaces.component.output.cache.CacheInitializerListener. Please see server.log for more details.

If i deploy the omniface jar into glassfish lib directory, the application deployes OK.

It also loads OK if I i make a war including all ejb's, jars and wars.

Does anyone have a clue where to start debugging this issue?

I can provide stacktrace if needed.

EAR structure:

PROJECT-EAR
  |
  -META-INF
  |
  -lib
      |
      - omnifaces-1.4.1.jar
      - myfaces-extcdi-bundle-jsf20-1.0.5.jar
      - primefaces-3.5.jar
      - PROJECT-lib.jar
  |
  - PROJECT-WEB1.war
  - PROJECT-EJB.jar
  - PROJECT-WEB2.war

Best regards, hw

EDIT: some stackinfo:

SEVERE: ContainerBase.addChild: start: 
    org.apache.catalina.LifecycleException: java.lang.IllegalArgumentException:    javax.servlet.ServletException: com.sun.enterprise.container.common.spi.util.InjectionException: Error creating managed object for class: class org.omnifaces.component.output.cache.CacheInitializerListener
at org.apache.catalina.core.StandardContext.start(StandardContext.java:5332)
at com.sun.enterprise.web.WebModule.start(WebModule.java:498)
at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:917)
at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:901)
at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:733)
at com.sun.enterprise.web.WebContainer.loadWebModule(WebContainer.java:2019)
at com.sun.enterprise.web.WebContainer.loadWebModule(WebContainer.java:1669)
at com.sun.enterprise.web.WebApplication.start(WebApplication.java:109)
at org.glassfish.internal.data.EngineRef.start(EngineRef.java:130)
at org.glassfish.internal.data.ModuleInfo.start(ModuleInfo.java:269)
at org.glassfish.internal.data.ApplicationInfo.start(ApplicationInfo.java:301)
at com.sun.enterprise.v3.server.ApplicationLifecycle.deploy(ApplicationLifecycle.java:461)
at com.sun.enterprise.v3.server.ApplicationLifecycle.deploy(ApplicationLifecycle.java:240)
at org.glassfish.deployment.admin.DeployCommand.execute(DeployCommand.java:389)
at com.sun.enterprise.v3.admin.CommandRunnerImpl$1.execute(CommandRunnerImpl.java:348)
at com.sun.enterprise.v3.admin.CommandRunnerImpl.doCommand(CommandRunnerImpl.java:363)
at com.sun.enterprise.v3.admin.CommandRunnerImpl.doCommand(CommandRunnerImpl.java:1085)
at com.sun.enterprise.v3.admin.CommandRunnerImpl.access$1200(CommandRunnerImpl.java:95)
at com.sun.enterprise.v3.admin.CommandRunnerImpl$ExecutionContext.execute(CommandRunnerImpl.java:1291)
at com.sun.enterprise.v3.admin.CommandRunnerImpl$ExecutionContext.execute(CommandRunnerImpl.java:1259)
at com.sun.enterprise.v3.admin.AdminAdapter.doCommand(AdminAdapter.java:461)
at com.sun.enterprise.v3.admin.AdminAdapter.service(AdminAdapter.java:212)
at com.sun.grizzly.tcp.http11.GrizzlyAdapter.service(GrizzlyAdapter.java:179)
at com.sun.enterprise.v3.server.HK2Dispatcher.dispath(HK2Dispatcher.java:117)
at com.sun.enterprise.v3.services.impl.ContainerMapper$Hk2DispatcherCallable.call(ContainerMapper.java:354)
at com.sun.enterprise.v3.services.impl.ContainerMapper.service(ContainerMapper.java:195)
at com.sun.grizzly.http.ProcessorTask.invokeAdapter(ProcessorTask.java:860)
at com.sun.grizzly.http.ProcessorTask.doProcess(ProcessorTask.java:757)
at com.sun.grizzly.http.ProcessorTask.process(ProcessorTask.java:1056)
at com.sun.grizzly.http.DefaultProtocolFilter.execute(DefaultProtocolFilter.java:229)
at com.sun.grizzly.DefaultProtocolChain.executeProtocolFilter(DefaultProtocolChain.java:137)
at com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:104)
at com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:90)
at com.sun.grizzly.http.HttpProtocolChain.execute(HttpProtocolChain.java:79)
at com.sun.grizzly.ProtocolChainContextTask.doCall(ProtocolChainContextTask.java:54)
at com.sun.grizzly.SelectionKeyContextTask.call(SelectionKeyContextTask.java:59)
at com.sun.grizzly.ContextTask.run(ContextTask.java:71)
at com.sun.grizzly.util.AbstractThreadPool$Worker.doWork(AbstractThreadPool.java:532)
at com.sun.grizzly.util.AbstractThreadPool$Worker.run(AbstractThreadPool.java:513)
at java.lang.Thread.run(Thread.java:722)
    Caused by: java.lang.IllegalArgumentException: javax.servlet.ServletException: com.sun.enterprise.container.common.spi.util.InjectionException: Error creating managed object for class: class org.omnifaces.component.output.cache.CacheInitializerListener
Helge Waastad
  • 151
  • 1
  • 11
  • OmniFaces JAR is in WAR and not in EAR, right? Further, what exactly do you mean with a WAR including all WARs? This doesn't sound right. – BalusC Apr 09 '13 at 16:32
  • Can you provide the details from the server log? – Peter Mularien Apr 09 '13 at 16:38
  • Sorry, my bad. If make a war with all dependencies (ejb's and jar's), it works fine. I want to bundle several wars in one ear but I've been banging my head for the last couple of days to get the ear deployed on glassfish – Helge Waastad Apr 09 '13 at 16:50
  • As BalusC asked, where did you put the OmniFaces jar? Did you happen to put it in ear/lib? Can you post the structure of your ear? – Arjan Tijms Apr 09 '13 at 18:42
  • Hi, I tried to write down the structure. I can verify that both web modules has empty WEB-INF/lib's. I hope I'm not bothering you too much with my insufficient information. Right now this is all Greek to me :-) – Helge Waastad Apr 09 '13 at 19:44
  • 2
    It seems like you probably want to post the entire stack trace of the root cause exception (starting with `Caused by:`) - this is the concrete explanation of your deployment issues. – Peter Mularien Apr 09 '13 at 20:47

1 Answers1

4

The ear/lib directory is not the ideal place to share web artifacts. It depends a bit on what else you exactly have in your wars (e.g. do you have a beans.xml in your WEB-INF, any Servlets? what's exactly in your web.xml files, etc), but in a lot of cases things just don't work nicely this way.

See for instance:

I have to say that I wasn't able to reproduce your error after creating an ear with two wars and the exact same libraries and same versions in the ear/lib (primefaces and myfaces-extcdi), but with things like classloader conflicts things are never easy to reproduce.

You might wanna try putting all web artifacts (OmniFaces, PrimeFaces, etc) in the WEB-INF/lib of both wars. Personally I think that's a better practice anyway as the EJB module is not supposed to see web types, and stuff you put in ear/lib is visible to classes in the EJB module.

For the moment I think this is primarily an EAR/classloader issue and not something specifically to OmniFaces. If you have some evidence that suggest OmniFaces does do something wrong opening an issue at https://github.com/omnifaces/omnifaces/issues might be a more appropriate place to discuss that further.

BalusC
  • 1,082,665
  • 372
  • 3,610
  • 3,555
Arjan Tijms
  • 37,782
  • 12
  • 108
  • 140
  • Hi, and thanks a lot for your recommendation. I will see if I can do some testing today. – Helge Waastad Apr 10 '13 at 07:52
  • Hi, I have now been reorganizing my project. Still using skinny wars (I will try to keep omnifaces and others in wars after som more testing). In summary, all libraries are scope compile and ejb's are provided. It has to be a classloader issue, since I always have to deploy or enable the application twice to get it running. I always returns: "SEVERE: Exception while loading the app WARNING: Input stream has been finalized or forced closed without being explicitly closed; stream instantiation reported in following stack trace" But this is another issue. Thanks again for all inputs. – Helge Waastad Apr 10 '13 at 19:06
  • There is [another question](http://stackoverflow.com/questions/2987266/why-doesnt-jsf-2-0-ri-mojarra-scan-my-class-annotations) that deals with the problem of JARs not beeing scanned by JSF. One answer suggests adding the JAR twice (in the EAR and in the WAR). Not sure if this is a recommended way. – Martin Höller Feb 26 '14 at 13:16