Hi Ivan,

I did not check whether a sample principal class and login module work from shared library - will try that out.

Liferay can be downloaded from http://www.liferay.com/downloads/liferay-portal/available-releases.
Select Liferay 6.1 community edition GA1 > "Bundled with Geronimo".
That bundle contains Geronimo v2.2.1.
I copied /var/shared/lib/*.jar from that bundle into Geronimov3/var/shared/lib
and /deploy/*.war from that bundle into Geronimov3/deploy.

Regards
kshiraly


Ivan wrote:
Hmm, just write a simple sample to use principal class from shared library, it seems to work for me. Could your sample be downloaded from the liferay website or other place ? So that I could try that.

2012/4/11 kshiraly <[email protected] <mailto:[email protected]>>

    Hi Ivan,

    I built geronimo/server/branches/3.0-beta
    <http://svn.apache.org/viewvc/geronimo/server/branches/3.0-beta>
    branch, and retried the same configuration in
    "geronimo-tomcat7-javaee6-3.0-beta-2" and
    "geronimo-tomcat7-javaee6-web-3.0-beta-2" assemblies.
    As before, the shared jars are in var/shared/lib, and the WAR is
    in /deploy

    I still get the ClassNotFoundException, but this time with a
    different stack trace. I started server with "-verbose:class" and
    I can see that now
    /com.liferay.portal.kernel.security.jaas.PortalRole is/ getting
    loaded from /var/shared/lib/portal-service.jar.

    Any ideas what could be wrong?

      /2012-04-10 22:32:36,298 ERROR [GBeanInstanceState] Error while
      starting; GBean is now in the FAILED state:
abstractName="liferay/liferay-portal/6.1.0/car?configurationName=liferay/liferay-portal/6.1.0/car"
      org.apache.geronimo.kernel.config.InvalidConfigException: Class not
      loadable in classloader: liferay.liferay-portal_6.1.0 [378]
          at
org.apache.geronimo.kernel.config.SerializedGBeanState.loadGBeans(SerializedGBeanState.java:134)
          at
org.apache.geronimo.kernel.config.SerializedGBeanState.getGBeans(SerializedGBeanState.java:65)
          at
org.apache.geronimo.kernel.config.ConfigurationData.getGBeans(ConfigurationData.java:186)
          at
org.apache.geronimo.kernel.config.Configuration.<init>(Configuration.java:216)
          at
      sun.reflect.GeneratedConstructorAccessor51.newInstance(Unknown
    Source)
          at
sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
          at
    java.lang.reflect.Constructor.newInstance(Constructor.java:513)
          at
org.apache.xbean.recipe.ReflectionUtil$ConstructorFactory.create(ReflectionUtil.java:958)
          at
org.apache.xbean.recipe.ObjectRecipe.internalCreate(ObjectRecipe.java:276)
          at
org.apache.xbean.recipe.AbstractRecipe.create(AbstractRecipe.java:96)
          at
org.apache.xbean.recipe.AbstractRecipe.create(AbstractRecipe.java:61)
          at
org.apache.geronimo.gbean.runtime.GBeanInstance.createInstance(GBeanInstance.java:958)
          at
org.apache.geronimo.gbean.runtime.GBeanInstanceState.attemptFullStart(GBeanInstanceState.java:271)
          at
org.apache.geronimo.gbean.runtime.GBeanInstanceState.start(GBeanInstanceState.java:105)
          at
org.apache.geronimo.gbean.runtime.GBeanInstance.start(GBeanInstance.java:555)
          at
org.apache.geronimo.kernel.basic.BasicKernel.startGBean(BasicKernel.java:368)
          at
org.apache.geronimo.kernel.config.KernelConfigurationManager.load(KernelConfigurationManager.java:191)
          at
org.apache.geronimo.kernel.config.SimpleConfigurationManager.loadConfiguration(SimpleConfigurationManager.java:359)
          at
org.apache.geronimo.kernel.config.SimpleConfigurationManager.loadConfiguration(SimpleConfigurationManager.java:332)
          at
org.apache.geronimo.kernel.osgi.ConfigurationActivator.start(ConfigurationActivator.java:62)
          at
org.eclipse.osgi.framework.internal.core.BundleContextImpl$1.run(BundleContextImpl.java:711)
          at java.security.AccessController.doPrivileged(Native Method)
          at
org.eclipse.osgi.framework.internal.core.BundleContextImpl.startActivator(BundleContextImpl.java:702)
          at
org.eclipse.osgi.framework.internal.core.BundleContextImpl.start(BundleContextImpl.java:683)
          at
org.eclipse.osgi.framework.internal.core.BundleHost.startWorker(BundleHost.java:381)
          at
org.eclipse.osgi.framework.internal.core.AbstractBundle.start(AbstractBundle.java:299)
          at
org.apache.geronimo.kernel.config.SimpleConfigurationManager.loadConfiguration(SimpleConfigurationManager.java:312)
          at
org.apache.geronimo.kernel.config.SimpleConfigurationManager.loadConfiguration(SimpleConfigurationManager.java:291)
          at
org.apache.geronimo.kernel.config.KernelConfigurationManager.loadConfiguration(KernelConfigurationManager.java:125)
          at
org.apache.geronimo.deployment.plugin.local.StartCommand.run(StartCommand.java:63)
          at java.lang.Thread.run(Thread.java:662)
      Caused by: java.lang.ClassNotFoundException: Unable to find class
      used in GBeanData
liferay/liferay-portal/6.1.0/car?J2EEApplication=null,WebModule=liferay/liferay-portal/6.1.0/car,j2eeType=RoleMapper,name=RoleMapper
          at
org.apache.geronimo.gbean.GBeanData$V0Externalizable.readExternal(GBeanData.java:404)
          at
      org.apache.geronimo.gbean.GBeanData.readExternal(GBeanData.java:320)
          at
org.apache.geronimo.kernel.config.SerializedGBeanState.loadGBeans(SerializedGBeanState.java:125)
          ... 30 more
      Caused by: java.lang.ClassNotFoundException: Unable to find class
      used in GBeanData
liferay/liferay-portal/6.1.0/car?J2EEApplication=null,WebModule=liferay/liferay-portal/6.1.0/car,j2eeType=RoleMapper,name=RoleMapper,
      attribute: principalRoleMap
          at
org.apache.geronimo.gbean.GBeanData$V0Externalizable.readExternal(GBeanData.java:370)
          ... 32 more
      Caused by: java.lang.ClassNotFoundException: Could not load class
      com.liferay.portal.kernel.security.jaas.PortalRole from unknown
      classloader; liferay.liferay-portal_6.1.0 [378]
          at
org.apache.geronimo.kernel.ClassLoading.loadClass(ClassLoading.java:320)
          at
org.apache.geronimo.kernel.ObjectInputStreamExt.resolveClass(ObjectInputStreamExt.java:40)
          at
java.io.ObjectInputStream.readNonProxyDesc(ObjectInputStream.java:1574)
          at
      java.io.ObjectInputStream.readClassDesc(ObjectInputStream.java:1495)
          at
java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1731)
          at
      java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1328)
          at
    java.io.ObjectInputStream.readObject(ObjectInputStream.java:350)
          at java.util.HashMap.readObject(HashMap.java:1029)
          at sun.reflect.GeneratedMethodAccessor3.invoke(Unknown Source)

          at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
          at java.lang.reflect.Method.invoke(Method.java:597)
          at
java.io.ObjectStreamClass.invokeReadObject(ObjectStreamClass.java:974)
          at
java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:1848)
          at
java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1752)
          at
      java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1328)
          at
    java.io.ObjectInputStream.readObject(ObjectInputStream.java:350)
          at
org.apache.geronimo.gbean.GBeanData$V0Externalizable.readExternal(GBeanData.java:368)
          ... 32 more
      2012-04-10 22:32:36,357 WARN  [ModuleHandler] Unable to start some
      modules for
D:\developer\geronimo\geronimo-tomcat7-javaee6-3.0-beta-2-SNAPSHOT\deploy\liferay-portal.war
      /



    geronimo.out with -verbose:class:
    -----------------------------------------
    [Loaded com.liferay.portal.kernel.servlet.ProtectedPrincipal from
    
file:/D:/developer/geronimo/geronimo-tomcat7-javaee6-3.0-beta-2-SNAPSHOT/var/shared/lib/portal-service.jar]
    [Loaded com.liferay.portal.kernel.security.jaas.PortalPrincipal
    from
    
file:/D:/developer/geronimo/geronimo-tomcat7-javaee6-3.0-beta-2-SNAPSHOT/var/shared/lib/portal-service.jar]
    [Loaded com.liferay.portal.kernel.security.jaas.PortalRole from
    
file:/D:/developer/geronimo/geronimo-tomcat7-javaee6-3.0-beta-2-SNAPSHOT/var/shared/lib/portal-service.jar]


    config.xml:
    ------------
      <module
    
name="org.apache.geronimo.configs/sharedlib-extender/3.0-beta-2-SNAPSHOT/car"/>
      <module
    name="org.apache.geronimo.configs/sharedlib/3.0-beta-2-SNAPSHOT/car"/>


    var/shared/META-INF/MANIFEST.MF:
    -----------------------------------------------


      Manifest-Version: 1.0
      Bundle-ManifestVersion: 2
      Bundle-SymbolicName: org.apache.geronimo.configs.sharedlib.SharedLib
      Bundle-Version: 3.0.0.beta-2-SNAPSHOT

      Bundle-ClassPath:
    classes,lib/hsql.jar,lib/jtds.jar,lib/mysql.jar,lib/
       portal-service.jar,lib/portlet.jar,lib/postgresql.jar
      Import-Package:
    org.apache.geronimo.kernel.osgi,org.apache.geronimo.sy
    <http://org.apache.geronimo.sy>
stem.sharedlib,org.apache.geronimo.gbean,org.osgi.framework,org.apach
       e.geronimo.system.serverinfo
      DynamicImport-Package: *


    Thanks
    kshiraly


    kshiraly wrote:

        Hi Ivan,

        Thanks for reply. I'll give it a try and get back to you.

        kshiraly

        Ivan wrote:

            Hmm, think I have fixed that in
             https://issues.apache.org/jira/browse/GERONIMO-6254 Is it
            OK for you to build that components by yourself, or I
            could provide the patched jar files somewhere.


            2012/4/9 Karthik Mailing <[email protected]
            <mailto:[email protected]>
            <mailto:[email protected]
            <mailto:[email protected]>>>


               Hi Ivan,

               Thanks for your reply.
               I had already placed the jars in
            GERONIMO_HOME/var/shared/lib
               prior to starting Geronimo.


               Content of var/shared/META-INF:
               ---------------------------------------
               Manifest-Version: 1.0
               Bundle-ManifestVersion: 2
               Bundle-SymbolicName:
            org.apache.geronimo.configs.sharedlib.SharedLib
               Bundle-Version: 3.0.0.beta-1
               Bundle-ClassPath:
               classes,lib/hsql.jar,lib/jtds.jar,lib/mysql.jar,lib/
                portal-service.jar,lib/portlet.jar,lib/postgresql.jar
               Import-Package:
               org.apache.geronimo.kernel.osgi,org.apache.geronimo.sy
            <http://org.apache.geronimo.sy>
               <http://org.apache.geronimo.sy>

stem.sharedlib,org.osgi.framework,org.apache.geronimo.gbean,org.apach
                e.geronimo.system.serverinfo

               The jar names are all correct and no jars have been
            missed in the
               above list. The  class that could not be found is
            actually in
               portal-service.jar.

               Karthik


               On Mon, Apr 9, 2012 at 9:38 AM, Ivan <[email protected]
            <mailto:[email protected]>
               <mailto:[email protected] <mailto:[email protected]>>> wrote:

                   The configurations look fine to me, after copying
            those jar
                   files in the var/shared library, do you restart the
            server ?
                   Could you show me the content of the
                   file var\shared\META-INF/MANIFEST.MF file ?


                   2012/4/9 kshiraly <[email protected]
            <mailto:[email protected]>
                   <mailto:[email protected]
            <mailto:[email protected]>>>


                       Hi,

                       I'm trying to deploy a WAR file in Geronimo v3
            JavaEE6
                       web profile release
                       (geronimo-tomcat7-javaee6-3.0-beta-1).
                       The WAR file's descriptors contain references
            to JAAS
                       related classes
                       (roles, principals, login modules) which are
            available in
                       a JAR file in
                       GERONIMO_HOME/var/shared/lib.

                       This same configuration works in a Geronimo 2.2.1
                       installation, but shows
                       the following exception and stack trace in v3
            when I copy
                       the WAR file into
                       Geronimo's hot deployment directory
            (GERONIMO_HOME/deploy):

=============================================================================
                       [Loaded
org.apache.geronimo.xbeans.geronimo.security.impl.GerRoleTypeImpl
                       from
file:/D:/developer/geronimo/geronimo-tomcat7-javaee6-3.0-beta-1/var/cache/org.eclipse.osgi/bundles/124/1/bundlefile]
                       [Loaded
org.apache.geronimo.xbeans.geronimo.security.GerPrincipalType
                       from
file:/D:/developer/geronimo/geronimo-tomcat7-javaee6-3.0-beta-1/var/cache/org.eclipse.osgi/bundles/124/1/bundlefile]
                       [Loaded
org.apache.geronimo.xbeans.geronimo.security.impl.GerPrincipalTypeImpl
                       from
file:/D:/developer/geronimo/geronimo-tomcat7-javaee6-3.0-beta-1/var/cache/org.eclipse.osgi/bundles/124/1/bundlefile]
                       [Loaded
org.apache.geronimo.security.util.ConfigurationUtil$1 from file:/D:/developer/geronimo/geronimo-tomcat7-javaee6-3.0-beta-1/var/cache/org.eclipse.osgi/bundles/87/1/bundlefile]
                       java.security.PrivilegedActionException:
                       java.lang.ClassNotFoundException:
                       com.liferay.portal.kernel.security.jaas.PortalRole
                              at
java.security.AccessController.doPrivileged(Native Method)
                              at
org.apache.geronimo.security.util.ConfigurationUtil.generatePrincipal(ConfigurationUtil.java:77)
                              at
org.apache.geronimo.security.deployment.GeronimoSecurityBuilderImpl.buildPrincipal(GeronimoSecurityBuilderImpl.java:280)
                              at
org.apache.geronimo.security.deployment.GeronimoSecurityBuilderImpl.configureRoleMapper(GeronimoSecurityBuilderImpl.java:314)
                              at
org.apache.geronimo.security.deployment.GeronimoSecurityBuilderImpl.build(GeronimoSecurityBuilderImpl.java:184)
                              at
org.apache.geronimo.deployment.NamespaceDrivenBuilderCollection.build(NamespaceDrivenBuilderCollection.java:43)
                              at
org.apache.geronimo.web25.deployment.AbstractWebModuleBuilder.basicInitContext(AbstractWebModuleBuilder.java:496)
                              at
org.apache.geronimo.web25.deployment.AbstractWebModuleBuilder.initContext(AbstractWebModuleBuilder.java:436)
                              at
org.apache.geronimo.j2ee.deployment.SwitchingModuleBuilder.initContext(SwitchingModuleBuilder.java:168)
                              at
org.apache.geronimo.j2ee.deployment.EARConfigBuilder.buildConfiguration(EARConfigBuilder.java:685)
                              at
org.apache.geronimo.deployment.Deployer.deploy(Deployer.java:255)
                              at
org.apache.geronimo.deployment.Deployer.deploy(Deployer.java:140)
                              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:597)
                              at
org.apache.geronimo.gbean.runtime.ReflectionMethodInvoker.invoke(ReflectionMethodInvoker.java:34)
                              at
org.apache.geronimo.gbean.runtime.GBeanOperation.invoke(GBeanOperation.java:131)
                              at
org.apache.geronimo.gbean.runtime.GBeanInstance.invoke(GBeanInstance.java:883)
                              at
org.apache.geronimo.kernel.basic.BasicKernel.invoke(BasicKernel.java:245)
                              at
org.apache.geronimo.deployment.plugin.local.AbstractDeployCommand.doDeploy(AbstractDeployCommand.java:116)
                              at
org.apache.geronimo.deployment.plugin.local.DistributeCommand.run(DistributeCommand.java:61)
                              at java.lang.Thread.run(Thread.java:662)
                       Caused by: java.lang.ClassNotFoundException:
                       com.liferay.portal.kernel.security.jaas.PortalRole
                              at
org.eclipse.osgi.internal.loader.BundleLoader.findClassInternal(BundleLoader.java:513)
                              at
org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:429)
                              at
org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:417)
                              at
org.apache.geronimo.hook.equinox.GeronimoClassLoader.loadClass(GeronimoClassLoader.java:85)
                              at
java.lang.ClassLoader.loadClass(ClassLoader.java:248)
                              at
org.eclipse.osgi.internal.loader.BundleLoader.loadClass(BundleLoader.java:345)
                              at
org.eclipse.osgi.framework.internal.core.BundleHost.loadClass(BundleHost.java:229)
                              at
org.eclipse.osgi.framework.internal.core.AbstractBundle.loadClass(AbstractBundle.java:1207)
                              at
org.apache.geronimo.security.util.ConfigurationUtil$1.run(ConfigurationUtil.java:79)
                              at
org.apache.geronimo.security.util.ConfigurationUtil$1.run(ConfigurationUtil.java:77)
                              ... 23 more

=============================================================================



                       *var/config/config.xml has entries for sharedlib:*

                          <module
name="org.apache.geronimo.configs/sharedlib-extender/3.0-beta-1/car"/>
                          <module
name="org.apache.geronimo.configs/sharedlib/3.0-beta-1/car"/>


                       *WAR file's geronimo-web.xml:*

                       <?xml version="1.0"?>

                       <web-app
xmlns="http://geronimo.apache.org/xml/ns/j2ee/web-1.1";>
                              <environment>
                                      <moduleId>
                                              <groupId>liferay</groupId>
<artifactId>liferay-portal</artifactId>
                                              <version>6.1.0</version>
                                              <type>car</type>
                                      </moduleId>
                                      <dependencies>
                                              <dependency>
<groupId>org.apache.geronimo.configs</groupId> <artifactId>j2ee-server</artifactId>
                                                      <type>car</type>
                                              </dependency>
                                              <dependency>
<groupId>org.apache.geronimo.configs</groupId> <artifactId>sharedlib</artifactId>
                                                      <type>car</type>
                                              </dependency>
                                              <dependency>
<groupId>org.apache.geronimo.framework</groupId> <artifactId>j2ee-security</artifactId>
                                                      <type>car</type>
                                              </dependency>
                                              <dependency>
<groupId>org.apache.geronimo.framework</groupId> <artifactId>rmi-naming</artifactId>
                                                      <type>car</type>
                                              </dependency>
                                      </dependencies>

                              </environment>
                              <context-root>/</context-root>
<security-realm-name>PortalRealm</security-realm-name>
                              <security>
                                      <default-principal>
                                              <principal name="anonymous"
class="com.liferay.portal.kernel.security.jaas.PortalPrincipal"
                       />
                                      </default-principal>
                                      <role-mappings>
                                              <role role-name="users">
                                                      <principal
class="com.liferay.portal.kernel.security.jaas.PortalRole"
                       name="users" />
                                              </role>
                                      </role-mappings>
                              </security>
                              <gbean name="PortalRealm"
class="org.apache.geronimo.security.realm.GenericSecurityRealm">
                                      <attribute
                       name="realmName">PortalRealm</attribute>
                                      <reference name="ServerInfo">
                                              <name>ServerInfo</name>
                                      </reference>

                                      <xml-reference
                       name="LoginModuleConfiguration">
                                              <log:login-config
xmlns:log="http://geronimo.apache.org/xml/ns/loginconfig-2.0";>
                                                      <log:login-module
                       control-flag="REQUIRED" wrap-principals="false">
<log:login-domain-name>PortalRealm</log:login-domain-name>

<log:login-module-class>com.liferay.portal.security.jaas.ext.tomcat.PortalLoginModule</log:login-module-class>
                                                      </log:login-module>
                                              </log:login-config>
                                      </xml-reference>
                              </gbean>
                       </web-app>

                       *Other information: *
                       For the record, the WAR file I'm trying to
            deploy is
                       liferay-portal.war.
                       Liferay comes with a Geronimo bundle for
            Geronimo v2.2.1.
                       I wanted to try out a similar deployment on
            Geronimo v3.
                       A diff utility run on liferay+geronimo2.2.1
            bundle and a
                       normal
                       geronimo2.2.1 download showed that Liferay has
            made only
                       2 additions - 1)
                       Added all liferay WARs in /deploy 2) Added all
            shared JARs in
                       /var/shared/lib. All other changes are
            disabling and
                       removal of services
                       like openejb which liferay does not use.
                       The same deployment in Geronimo v3 throws
                       ClassNotFoundException. Does the
                       OSGI support in v3 require some additional
            configuration
                       for sharedlib?

                       Thanks
                       kshiraly

                       --
                       View this message in context:
http://apache-geronimo.328035.n3.nabble.com/Geronimo-v3-ClassNotFoundException-for-class-available-in-sharedlib-tp3895754p3895754.html
                       Sent from the Users mailing list archive at
            Nabble.com.




                   --         Ivan





-- Ivan






--
Ivan

Reply via email to