0 Replies Latest reply on Aug 6, 2007 4:12 AM by Alexander Sparkowsky

    Classpath location of config files in glassfish projects

    Alexander Sparkowsky Newbie


      I'm started playing around with Seam 1.2.1.GA and Glassfisch (v2-b57) and I have a question regarding the location of the config files.

      I started with a seam-gen generated project and modified it to work with glassfish (added/removed jars, configured web.xml and faces.xml). seam-gen also automatically added drools based security rules and also added the file "security.drl" directly into the EAR.

      When I tried to access any page (e.g. /home.seam) I got the following error:

      org.jboss.seam.InstantiationException: Could not instantiate Seam component: org.jboss.seam.security.identity
       at org.jboss.seam.Component.newInstance(Component.java:1740)
       at org.jboss.seam.Component.getInstance(Component.java:1643)
       at org.jboss.seam.Component.getInstance(Component.java:1610)
       at org.jboss.seam.Namespace.get(Namespace.java:42)
       at javax.el.MapELResolver.getValue(MapELResolver.java:164)
       at javax.el.CompositeELResolver.getValue(CompositeELResolver.java:143)
       at com.sun.faces.el.FacesCompositeELResolver.getValue(FacesCompositeELResolver.java:64)
      Caused by: java.lang.IllegalArgumentException: could not set property value: org.jboss.seam.security.identity.setSecurityRules
       at org.jboss.seam.Component.setPropertyValue(Component.java:1547)
       at org.jboss.seam.Component.initialize(Component.java:1169)
       at org.jboss.seam.Component.instantiateJavaBean(Component.java:1128)
       at org.jboss.seam.Component.instantiate(Component.java:1088)
       at org.jboss.seam.Component.newInstance(Component.java:1736)
       ... 82 more
      Caused by: java.lang.IllegalArgumentException: Could not invoke method by reflection: RuleBasedIdentity.setSecurityRules(org.drools.RuleBase) with parameters: (org.jboss.seam.drools.RuleBase) on: org.jboss.seam.security.RuleBasedIdentity
       at org.jboss.seam.util.Reflections.invoke(Reflections.java:30)
       at org.jboss.seam.Component.setPropertyValue(Component.java:1543)
       ... 86 more
      Caused by: java.lang.IllegalArgumentException: argument type mismatch
       at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
       at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
       at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
       at java.lang.reflect.Method.invoke(Method.java:585)
       at org.jboss.seam.util.Reflections.invoke(Reflections.java:20)
       ... 87 more

      After moving "security.drl" into my ejb-jar file the error disappeard.

      So it seems to me as if glassfish won't find any (config)files that are located directly inside the ear since the ear itself is not part of the classpath.

      My question here is what the correct behaviour should be? Shold an JEE conform appserver find the file directly inside the EAR (so glassfish has to be fixed) or would it be better to put this and all the other files into an ejb-jar?

      And why didn't I get some message like "Could not find /security.drl" but got an java.lang.IllegalArgumentException? Maybe I forgot to (re)configure something else?