Re: How to package java classes in an opencms module

"laurent.druart via opencms-dev" <[email protected]> Tue, 12 Aug 2025 15:05:51 +0200
Newsgroups gmane.comp.cms.opencms.devel
Message-ID <[email protected]>
--===============9206763158331239805==
Content-Type: multipart/alternative;
	boundary="Apple-Mail=_FF6640D9-3C47-4D41-B0E4-DA2BE5015C0E"


--Apple-Mail=_FF6640D9-3C47-4D41-B0E4-DA2BE5015C0E
Content-Transfer-Encoding: quoted-printable
Content-Type: text/plain;
	charset=utf-8

Hello Michael,

Ok, thank you. I=E2=80=99ll test it.

Kind regards,

Laurent

> Le 12 ao=C3=BBt 2025 =C3=A0 14:56, Michael Emmerich via opencms-dev =
<[email protected]> a =C3=A9crit :
>=20
> Hello Laurent,
>=20
> the <resources> node in the manifest file tells the system which files =
or folders should be exported when the module is exported in OpenCms
>=20
> All exported resources of a module can be found as individual <file> =
sub-nodes in the <files> node. In those nodes, all resource metadata, =
like type, date and user created, path, permissions, properties are =
stored.
>=20
> Only those resources that are listed in those <file> nodes are =
imported when you import a module using this manifest file.
>=20
>=20
>=20
> The easiest to do would be:
>=20
> - Create a new module inside of OpenCms. During Module creation you =
can select which folders inside the /system/modules/[your-module-name]/ =
should be created. By default, your module folder is part of the module =
(and everything inside of it).
>=20
> - Then upload your .jar and .class files in the corresponding /lib and =
/classes folder of your module. Make sure that you have set the export =
points for the /lib and /classes folder in the module configuration
>=20
> - Export the module from OpenCms and download it. Not extract it and =
take a look at he manifest file to see what is in there.
>=20
> The format of those <file> nodes is the same that is used in the =
manifest files of a database export in OpenCms.
>=20
>=20
>=20
> Kind regards,
>=20
> Michael
>=20
>=20
>=20
> Am 08.08.25 um 15:27 schrieb laurent.druart via opencms-dev:
>> Hello Michael,
>>=20
>> Thank you for your answer.
>>=20
>> The goal of java classes in a module is automatic creation of my =
context on OpenCMS startup, that=E2=80=99s why I implemented=20
>>=20
>> LibraryInitializer extends A_CmsModuleAction implements =
I_CmsEventListener
>>=20
>> In a previous test I had a section =C2=AB resources =C2=BB like this
>>=20
>>         <resources>
>>             <resource uri=3D"/system/modules/com.opencms.library/"/>
>>         </resources>
>>=20
>> but not working at all.
>>=20
>> So I=E2=80=99ve to create a file section per class in my module? =
Documentation is not clear on manifest.xml. Do you have an exemple with =
java classes and lib dependencies?
>>=20
>> Thanks a lot.
>>=20
>> Kind regards,
>>=20
>> Laurent
>>=20
>>> Le 8 ao=C3=BBt 2025 =C3=A0 14:30, Michael Emmerich via opencms-dev =
<[email protected]> <mailto:[email protected]> a =C3=A9crit =
:
>>>=20
>>> Laurent,
>>>=20
>>> from you manifest, I see that you have not assigned any resources to =
your module. So no resources are imported when you import the module, =
therefore the .jar and .classes are missing.  I see that you have =
defined the export points, but without the imported file, this will not =
work.
>>>=20
>>> However, we usually do not put .jar or .class files in our modules, =
we deploy them separately on the server as yo have to restart it anyway =
after deploying some .jar and .class files.
>>>=20
>>>=20
>>> Kind regards,
>>>=20
>>> Michael
>>>=20
>>>=20
>>>=20
>>> Am 08.08.25 um 11:22 schrieb laurent.druart via opencms-dev:
>>>> Hello,
>>>>=20
>>>> In add-on to my previous e-mail, here is the content/structure of =
my zip files :
>>>>=20
>>>>=20
>>>> And the content of my manifest.xml :
>>>>=20
>>>> <?xml version=3D"1.0" encoding=3D"UTF-8"?>
>>>> <export>
>>>>     <info>
>>>>         <creator>OpenCMS Module Builder</creator>
>>>>         <opencms_version>19.0</opencms_version>
>>>>         <createdate>Wed, 07 Aug 2025 10:00:00 GMT</createdate>
>>>>         <project>Offline</project>
>>>>         <export_version>7</export_version>
>>>>     </info>
>>>>=20
>>>>     <module>
>>>>         <name>com.opencms.library</name>
>>>>         <nicename>OpenCMS Spring Data JDBC Library</nicename>
>>>>         <group>Custom Libraries</group>
>>>>         =
<class>com.opencms.library.integration.LibraryInitializer</class>
>>>>         <description>Librairie Spring classique pour OpenCMS avec =
acc=C3=A8s aux donn=C3=A9es PostgreSQL</description>
>>>>         <version>1.0.0</version>
>>>>         <authorname>Laurent Druart</authorname>
>>>>         <authoremail>[email protected] =
<mailto:[email protected]></authoremail>
>>>>         <datecreated>Wed, 07 Aug 2025 10:00:00 GMT</datecreated>
>>>>         <userinstalled>Admin</userinstalled>
>>>>         <dateinstalled>Wed, 07 Aug 2025 10:00:00 =
GMT</dateinstalled>
>>>>=20
>>>>         <dependencies/>
>>>>=20
>>>>         <exportpoints>
>>>>             <exportpoint =
uri=3D"/system/modules/com.opencms.library/classes/" =
destination=3D"WEB-INF/classes/"/>
>>>>             <exportpoint =
uri=3D"/system/modules/com.opencms.library/lib/" =
destination=3D"WEB-INF/lib/"/>
>>>>         </exportpoints>
>>>>         <resources/>
>>>>         <parameters>
>>>>             <param name=3D"spring.auto.init">true</param>
>>>>         </parameters>
>>>>     </module>
>>>>=20
>>>>     <files/>
>>>> </export>
>>>>=20
>>>> I tried to import the zip in the modules app, module is created but =
classes and lib are not copied in WEB-INF folders and in the explorer =
app there are no =C2=AB com.opencms.library =C2=BB entries in =
/system/modules
>>>>=20
>>>> Thanks for your help.
>>>>=20
>>>> Regards,
>>>>=20
>>>> Laurent
>>>>=20
>>>>> Le 7 ao=C3=BBt 2025 =C3=A0 16:41, laurent.druart via opencms-dev =
<[email protected]> <mailto:[email protected]> a =C3=A9crit =
:
>>>>>=20
>>>>> Hello,
>>>>>=20
>>>>> I=E2=80=99m still testing OpenCMS and i wrote a very small =
library, a spring based library. I want to use the beans in my jsp so i =
wrote 2 classes:
>>>>>=20
>>>>> SpringBeanUtils :
>>>>>=20
>>>>> public class SpringBeanUtils {
>>>>>=20
>>>>>    private static final Log LOG =3D =
CmsLog.getLog(SpringBeanUtils.class);
>>>>>=20
>>>>>    /**
>>>>>     * R=C3=A9cup=C3=A8re le service utilisateur
>>>>>     * Exemple d'utilisation dans une page JSP :
>>>>>     * <%
>>>>>     *   UserService userService =3D =
SpringBeanUtils.getUserService();
>>>>>     *   List<User> users =3D userService.getAllActiveUsers();
>>>>>     * %>
>>>>>     */
>>>>>    public static UserService getUserService() {
>>>>>        try {
>>>>>            return LibraryInitializer.getBean(UserService.class);
>>>>>        } catch (Exception e) {
>>>>>            LOG.error("Erreur lors de la r=C3=A9cup=C3=A9ration du =
UserService", e);
>>>>>            throw new RuntimeException("Service utilisateur non =
disponible", e);
>>>>>        }
>>>>>    }
>>>>>=20
>>>>>    /**
>>>>>     * M=C3=A9thode g=C3=A9n=C3=A9rique pour r=C3=A9cup=C3=A9rer =
n'importe quel service
>>>>>     * Exemple :
>>>>>     * MyService service =3D =
SpringBeanUtils.getService(MyService.class);
>>>>>     */
>>>>>    public static <T> T getService(Class<T> serviceClass) {
>>>>>        try {
>>>>>            return LibraryInitializer.getBean(serviceClass);
>>>>>        } catch (Exception e) {
>>>>>            LOG.error("Erreur lors de la r=C3=A9cup=C3=A9ration du =
service: " + serviceClass.getSimpleName(), e);
>>>>>            throw new RuntimeException("Service non disponible: " + =
serviceClass.getSimpleName(), e);
>>>>>        }
>>>>>    }
>>>>>=20
>>>>>    /**
>>>>>     * R=C3=A9cup=C3=A8re un bean par son nom
>>>>>     * Exemple :
>>>>>     * Object bean =3D SpringBeanUtils.getBean("userService");
>>>>>     */
>>>>>    public static Object getBean(String beanName) {
>>>>>        try {
>>>>>            return LibraryInitializer.getBean(beanName);
>>>>>        } catch (Exception e) {
>>>>>            LOG.error("Erreur lors de la r=C3=A9cup=C3=A9ration du =
bean: " + beanName, e);
>>>>>            throw new RuntimeException("Bean non disponible: " + =
beanName, e);
>>>>>        }
>>>>>    }
>>>>>=20
>>>>>    /**
>>>>>     * V=C3=A9rifie si le contexte Spring est disponible
>>>>>     */
>>>>>    public static boolean isAvailable() {
>>>>>        return LibraryInitializer.isSpringContextAvailable();
>>>>>    }
>>>>>=20
>>>>>    /**
>>>>>     * M=C3=A9thode utilitaire pour v=C3=A9rifier la disponibilit=C3=A9=
 avant utilisation
>>>>>     */
>>>>>    public static void ensureAvailable() {
>>>>>        if (!isAvailable()) {
>>>>>            throw new IllegalStateException(
>>>>>                    "Le contexte Spring n'est pas disponible. " +
>>>>>                            "V=C3=A9rifiez que le module est =
correctement initialis=C3=A9."
>>>>>            );
>>>>>        }
>>>>>    }
>>>>> }
>>>>>=20
>>>>> with static method getUserService() I can call the userService =
bean. No problem with it.
>>>>>=20
>>>>> And second class LibraryInitializer wich must initialise the =
spring context and configure it:
>>>>>=20
>>>>> public class LibraryInitializer extends A_CmsModuleAction =
implements I_CmsEventListener {
>>>>>=20
>>>>>    private static final String MODULE_NAME =3D =
"opencms-spring-library";
>>>>>    private static ApplicationContext springContext;
>>>>>    private static final org.apache.commons.logging.Log LOG =3D =
CmsLog.getLog(LibraryInitializer.class);
>>>>>=20
>>>>>    /**
>>>>>     * Initialisation du module
>>>>>     */
>>>>>    @Override
>>>>>    public void initialize(org.opencms.file.CmsObject adminCms,
>>>>>                           =
org.opencms.configuration.CmsConfigurationManager configurationManager,
>>>>>                           CmsModule module) {
>>>>>=20
>>>>>        LOG.info("Initialisation de la librairie Spring classique =
pour OpenCMS");
>>>>>=20
>>>>>        try {
>>>>>            // Configuration des propri=C3=A9t=C3=A9s syst=C3=A8me
>>>>>            configureSystemProperties();
>>>>>=20
>>>>>            // Cr=C3=A9ation du contexte Spring CLASSIQUE
>>>>>            AnnotationConfigApplicationContext context =3D new =
AnnotationConfigApplicationContext();
>>>>>            =
context.register(com.opencms.library.config.LibraryConfiguration.class);
>>>>>            context.refresh();
>>>>>=20
>>>>>            springContext =3D context;
>>>>>=20
>>>>>            // Enregistrement des listeners OpenCMS
>>>>>            OpenCms.addCmsEventListener(this);
>>>>>=20
>>>>>            LOG.info("Librairie Spring classique initialis=C3=A9e =
avec succ=C3=A8s");
>>>>>=20
>>>>>        } catch (Exception e) {
>>>>>            LOG.error("Erreur lors de l'initialisation de la =
librairie Spring", e);
>>>>>            throw new RuntimeException("Impossible d'initialiser la =
librairie Spring", e);
>>>>>        }
>>>>>    }
>>>>>=20
>>>>>    /**
>>>>>     * Arr=C3=AAt du module
>>>>>     */
>>>>>    @Override
>>>>>    public void shutDown(CmsModule module) {
>>>>>        LOG.info("Arr=C3=AAt de la librairie Spring classique");
>>>>>=20
>>>>>        if (springContext !=3D null) {
>>>>>            try {
>>>>>                if (springContext instanceof =
AnnotationConfigApplicationContext) {
>>>>>                    ((AnnotationConfigApplicationContext) =
springContext).close();
>>>>>                }
>>>>>                LOG.info("Contexte Spring ferm=C3=A9 avec =
succ=C3=A8s");
>>>>>            } catch (Exception e) {
>>>>>                LOG.error("Erreur lors de l'arr=C3=AAt du contexte =
Spring", e);
>>>>>            } finally {
>>>>>                springContext =3D null;
>>>>>            }
>>>>>        }
>>>>>    }
>>>>>=20
>>>>>    /**
>>>>>     * Gestion des =C3=A9v=C3=A9nements OpenCMS
>>>>>     */
>>>>>    @Override
>>>>>    public void cmsEvent(CmsEvent event) {
>>>>>        switch (event.getType()) {
>>>>>            case I_CmsEventListener.EVENT_PUBLISH_PROJECT:
>>>>>                LOG.debug("=C3=89v=C3=A9nement de publication =
d=C3=A9tect=C3=A9");
>>>>>                break;
>>>>>            case I_CmsEventListener.EVENT_CLEAR_CACHES:
>>>>>                LOG.debug("=C3=89v=C3=A9nement de nettoyage des =
caches d=C3=A9tect=C3=A9");
>>>>>                break;
>>>>>        }
>>>>>    }
>>>>>=20
>>>>>    /**
>>>>>     * Configuration des propri=C3=A9t=C3=A9s syst=C3=A8me
>>>>>     */
>>>>>    private void configureSystemProperties() {
>>>>>        // Configuration de base de donn=C3=A9es (valeurs par =
d=C3=A9faut)
>>>>>        if (System.getProperty("spring.datasource.url") =3D=3D =
null) {
>>>>>            System.setProperty("spring.datasource.url", =
"jdbc:postgresql://postgres-db:5432/libdb");
>>>>>        }
>>>>>        if (System.getProperty("spring.datasource.username") =3D=3D =
null) {
>>>>>            System.setProperty("spring.datasource.username", =
"appuser");
>>>>>        }
>>>>>        if (System.getProperty("spring.datasource.password") =3D=3D =
null) {
>>>>>            System.setProperty("spring.datasource.password", =
"apppassword");
>>>>>        }
>>>>>=20
>>>>>        LOG.info("Propri=C3=A9t=C3=A9s syst=C3=A8me configur=C3=A9es"=
);
>>>>>    }
>>>>>=20
>>>>>    /**
>>>>>     * Acc=C3=A8s aux beans Spring
>>>>>     */
>>>>>    public static <T> T getBean(Class<T> beanClass) {
>>>>>        if (springContext =3D=3D null) {
>>>>>            throw new IllegalStateException("Le contexte Spring =
n'est pas initialis=C3=A9");
>>>>>        }
>>>>>        return springContext.getBean(beanClass);
>>>>>    }
>>>>>=20
>>>>>    public static Object getBean(String beanName) {
>>>>>        if (springContext =3D=3D null) {
>>>>>            throw new IllegalStateException("Le contexte Spring =
n'est pas initialis=C3=A9");
>>>>>        }
>>>>>        return springContext.getBean(beanName);
>>>>>    }
>>>>>=20
>>>>>    public static boolean isSpringContextAvailable() {
>>>>>        return springContext !=3D null;
>>>>>    }
>>>>> }
>>>>>=20
>>>>> If i build this lib as a jar and put it in WEB-INF/lib i can =
access my beans in jsp pages but i must do this call first:
>>>>>=20
>>>>>           com.opencms.library.integration.LibraryInitializer =
initializer =3D
>>>>>                new =
com.opencms.library.integration.LibraryInitializer();
>>>>>=20
>>>>>            // Appel direct de initialize avec des param=C3=A8tres =
nulls (notre version simplifi=C3=A9e les g=C3=A8re)
>>>>>            initializer.initialize(null, null, null);
>>>>> after that my context is initialized and configured and my jsp are =
running fine. But the way to automatic loading of my context seems to be =
an opencms module.
>>>>>=20
>>>>> I tried to adapt my lib with opencms-module.xml, manifest.xml,... =
but nothing works: at startup =
com.opencms.library.integration.LibraryInitializer is not found by =
opencms.
>>>>>=20
>>>>> Can you help me?
>>>>> Does it exist a tutorial or how-to?
>>>>>=20
>>>>> Am i wrong with public class LibraryInitializer extends =
A_CmsModuleAction implements I_CmsEventListener ?
>>>>>=20
>>>>> Thank you
>>>>>=20
>>>>> Kind regards,
>>>>>=20
>>>>> Laurent
>>>>>=20
>>>>>=20
>>>>> _______________________________________________
>>>>> This mail is sent to you from the opencms-dev mailing list
>>>>> To change your list options, or to unsubscribe from the list, =
please visit
>>>>> https://lists.opencms.org/mailman/listinfo/opencms-dev
>>>>>=20
>>>>>=20
>>>>>=20
>>>>=20
>>>> _______________________________________________
>>>> This mail is sent to you from the opencms-dev mailing list
>>>> To change your list options, or to unsubscribe from the list, =
please visit
>>>> https://lists.opencms.org/mailman/listinfo/opencms-dev
>>>>=20
>>>>=20
>>>>=20
>>> --=20
>>> Michael Emmerich
>>> Alkacon Software GmbH & Co. KG - The OpenCms Experts
>>> http://www.alkacon.com <http://www.alkacon.com/>
>>> http://www.opencms.org <http://www.opencms.org/>
>>>=20
>>> _______________________________________________
>>> This mail is sent to you from the opencms-dev mailing list
>>> To change your list options, or to unsubscribe from the list, please =
visit
>>> https://lists.opencms.org/mailman/listinfo/opencms-dev
>>>=20
>>>=20
>>>=20
>>=20
>>=20
>>=20
>> _______________________________________________
>> This mail is sent to you from the opencms-dev mailing list
>> To change your list options, or to unsubscribe from the list, please =
visit
>> https://lists.opencms.org/mailman/listinfo/opencms-dev
>>=20
>>=20
>>=20
> --=20
> Michael Emmerich
> =20
> -------------------
>=20
> Alkacon Software GmbH & Co. KG - The OpenCms Experts
> Michael Emmerich
> An der Wachsfabrik 13
> 50996 Koeln, DE
> =20
> Tel: +49 (0)2236 3826-14
> Fax: +49 (0)2236 3826-20
> Email: [email protected] <mailto:[email protected]>
>=20
> http://www.alkacon.com <http://www.alkacon.com/>
> http://www.opencms.org <http://www.opencms.org/>
>=20
> Amtsgericht K=C3=B6ln, HRA 32185, USt-IdNr.: DE259882372
> Vertreten durch: Alkacon Verwaltungs GmbH
> Gesch=C3=A4ftsf=C3=BChrer: Alexander Kandzior, Amtsgericht K=C3=B6ln, =
HRB 88218
> _______________________________________________
> This mail is sent to you from the opencms-dev mailing list
> To change your list options, or to unsubscribe from the list, please =
visit
> https://lists.opencms.org/mailman/listinfo/opencms-dev
>=20
>=20
>=20


--Apple-Mail=_FF6640D9-3C47-4D41-B0E4-DA2BE5015C0E
Content-Transfer-Encoding: quoted-printable
Content-Type: text/html;
	charset=utf-8

<html><head><meta http-equiv=3D"content-type" content=3D"text/html; =
charset=3Dutf-8"></head><body style=3D"overflow-wrap: break-word; =
-webkit-nbsp-mode: space; line-break: after-white-space;">Hello =
Michael,<div><br></div><div>Ok, thank you. I=E2=80=99ll test =
it.</div><div><br></div><div>Kind =
regards,</div><div><br></div><div>Laurent<br =
id=3D"lineBreakAtBeginningOfMessage"><div><br><blockquote =
type=3D"cite"><div>Le 12 ao=C3=BBt 2025 =C3=A0 14:56, Michael Emmerich =
via opencms-dev &lt;[email protected]&gt; a =C3=A9crit :</div><br =
class=3D"Apple-interchange-newline"><div>

 =20
    <meta http-equiv=3D"Content-Type" content=3D"text/html; =
charset=3DUTF-8">
 =20
  <div><p>Hello Laurent,</p><p>the &lt;resources&gt; node in the =
manifest file tells the system
      which files or folders should be exported when the module is
      exported in OpenCms</p><p>All exported resources of a module can =
be found as individual
      &lt;file&gt; sub-nodes in the &lt;files&gt; node. In those nodes,
      all resource metadata, like type, date and user created, path,
      permissions, properties are stored.</p><p>Only those resources =
that are listed in those &lt;file&gt; nodes
      are imported when you import a module using this manifest =
file.</p><p><br>
    </p><p>The easiest to do would be:</p><p>- Create a new module =
inside of OpenCms. During Module creation
      you can select which folders inside the
      /system/modules/[your-module-name]/ should be created. By default,
      your module folder is part of the module (and everything inside of
      it).</p><p>- Then upload your .jar and .class files in the =
corresponding
      /lib and /classes folder of your module. Make sure that you have
      set the export points for the /lib and /classes folder in the
      module configuration</p><p>- Export the module from OpenCms and =
download it. Not extract it
      and take a look at he manifest file to see what is in =
there.</p><p>The format of those &lt;file&gt; nodes is the same that is =
used
      in the manifest files of a database export in OpenCms.</p><p><br>
    </p><p>Kind regards,</p><p>Michael</p><p><br>
    </p>
    <div class=3D"moz-cite-prefix">Am 08.08.25 um 15:27 schrieb
      laurent.druart via opencms-dev:<br>
    </div>
    <blockquote type=3D"cite" =
cite=3D"mid:[email protected]">
      <meta http-equiv=3D"content-type" content=3D"text/html; =
charset=3DUTF-8">
      Hello Michael,
      <div><br>
      </div>
      <div>Thank you for your answer.</div>
      <div><br>
      </div>
      <div>The goal of java classes in a module is automatic creation of
        my context on OpenCMS startup, that=E2=80=99s why I =
implemented&nbsp;</div>
      <div><br>
      </div>
      <div>
        <pre style=3D"background-color: rgb(43, 43, 43); color: rgb(169, =
183, 198); font-family: &quot;JetBrains Mono&quot;, =
monospace;">LibraryInitializer <span style=3D"color: rgb(204, 120, =
50);">extends </span>A_CmsModuleAction <span style=3D"color: rgb(204, =
120, 50);">implements </span>I_CmsEventListener</pre>
      </div>
      <div><br>
      </div>
      <div>In a previous test I had a section =C2=AB&nbsp;resources&nbsp;=C2=
=BB like this</div>
      <div><br>
      </div>
      <div>
        <div>&nbsp; &nbsp; &nbsp; &nbsp; &lt;resources&gt;</div>
        <div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;resource
          uri=3D"/system/modules/com.opencms.library/"/&gt;</div>
        <div>&nbsp; &nbsp; &nbsp; &nbsp; &lt;/resources&gt;</div>
        <div><br>
        </div>
        <div>but not working at all.</div>
        <div><br>
        </div>
        <div>So I=E2=80=99ve to create a file section per class in my =
module?
          Documentation is not clear on manifest.xml. Do you have an
          exemple with java classes and lib dependencies?</div>
        <div><br>
        </div>
        <div>Thanks a lot.</div>
        <div><br>
        </div>
        <div>Kind regards,</div>
        <div><br>
        </div>
        <div>Laurent</div>
        <div><br>
          <blockquote type=3D"cite">
            <div>Le 8 ao=C3=BBt 2025 =C3=A0 14:30, Michael Emmerich via
              opencms-dev <a class=3D"moz-txt-link-rfc2396E" =
href=3D"mailto:[email protected]">&lt;[email protected]&gt;</a=
> a =C3=A9crit :</div>
            <br class=3D"Apple-interchange-newline">
            <div>
              <div>Laurent,<br>
                <br>
                from you manifest, I see that you have not assigned any
                resources to your module. So no resources are imported
                when you import the module, therefore the .jar and
                .classes are missing.&nbsp; I see that you have defined =
the
                export points, but without the imported file, this will
                not work.<br>
                <br>
                However, we usually do not put .jar or .class files in
                our modules, we deploy them separately on the server as
                yo have to restart it anyway after deploying some .jar
                and .class files.<br>
                <br>
                <br>
                Kind regards,<br>
                <br>
                Michael<br>
                <br>
                <br>
                <br>
                Am 08.08.25 um 11:22 schrieb laurent.druart via
                opencms-dev:<br>
                <blockquote type=3D"cite">Hello,<br>
                  <br>
                  In add-on to my previous e-mail, here is the
                  content/structure of my zip files :<br>
                  <br>
                  <br>
                  And the content of my manifest.xml :<br>
                  <br>
                  &lt;?xml version=3D"1.0" encoding=3D"UTF-8"?&gt;<br>
                  &lt;export&gt;<br>
                  &nbsp;&nbsp;&nbsp;&nbsp;&lt;info&gt;<br>
                  =
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;OpenCMS =
Module
                  Builder&lt;/creator&gt;<br>
=
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;opencms_version&gt;19.=
0&lt;/opencms_version&gt;<br>
                  =
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;createdate&gt;Wed, =
07 Aug 2025 10:00:00
                  GMT&lt;/createdate&gt;<br>
                  =
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;project&gt;Offline&lt;=
/project&gt;<br>
                  =
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;export_version&gt;7&lt=
;/export_version&gt;<br>
                  &nbsp;&nbsp;&nbsp;&nbsp;&lt;/info&gt;<br>
                  <br>
                  &nbsp;&nbsp;&nbsp;&nbsp;&lt;module&gt;<br>
                  =
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;name&gt;com.opencms.li=
brary&lt;/name&gt;<br>
                  =
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;nicename&gt;OpenCMS =
Spring Data JDBC
                  Library&lt;/nicename&gt;<br>
                  =
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;group&gt;Custom =
Libraries&lt;/group&gt;<br>
=
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;class&gt;com.opencms.l=
ibrary.integration.LibraryInitializer&lt;/class&gt;<br>
                  =
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;Librair=
ie Spring classique
                  pour OpenCMS avec acc=C3=A8s aux donn=C3=A9es
                  PostgreSQL&lt;/description&gt;<br>
                  =
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;version&gt;1.0.0&lt;/v=
ersion&gt;<br>
                  =
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;authorname&gt;Laurent
                  Druart&lt;/authorname&gt;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;authoremail&gt;<a =
class=3D"moz-txt-link-abbreviated" =
href=3D"mailto:[email protected]">[email protected]</a>&lt;/au=
thoremail&gt;<br>
                  =
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;datecreated&gt;Wed, =
07 Aug 2025 10:00:00
                  GMT&lt;/datecreated&gt;<br>
=
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;userinstalled&gt;Admin=
&lt;/userinstalled&gt;<br>
                  =
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;dateinstalled&gt;Wed, =
07 Aug 2025 10:00:00
                  GMT&lt;/dateinstalled&gt;<br>
                  <br>
                  =
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;dependencies/&gt;<br>
                  <br>
                  =
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;exportpoints&gt;<br>
                  =
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&l=
t;exportpoint
                  uri=3D"/system/modules/com.opencms.library/classes/"
                  destination=3D"WEB-INF/classes/"/&gt;<br>
                  =
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&l=
t;exportpoint
                  uri=3D"/system/modules/com.opencms.library/lib/"
                  destination=3D"WEB-INF/lib/"/&gt;<br>
                  =
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;/exportpoints&gt;<br>
                  =
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;resources/&gt;<br>
                  =
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;parameters&gt;<br>
                  =
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&l=
t;param
                  name=3D"spring.auto.init"&gt;true&lt;/param&gt;<br>
                  =
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;/parameters&gt;<br>
                  &nbsp;&nbsp;&nbsp;&nbsp;&lt;/module&gt;<br>
                  <br>
                  &nbsp;&nbsp;&nbsp;&nbsp;&lt;files/&gt;<br>
                  &lt;/export&gt;<br>
                  <br>
                  I tried to import the zip in the modules app, module
                  is created but classes and lib are not copied in
                  WEB-INF folders and in the explorer app there are no =
=C2=AB
                  com.opencms.library =C2=BB entries in =
/system/modules<br>
                  <br>
                  Thanks for your help.<br>
                  <br>
                  Regards,<br>
                  <br>
                  Laurent<br>
                  <br>
                  <blockquote type=3D"cite">Le 7 ao=C3=BBt 2025 =C3=A0 =
16:41,
                    laurent.druart via opencms-dev
                    <a class=3D"moz-txt-link-rfc2396E" =
href=3D"mailto:[email protected]">&lt;[email protected]&gt;</a=
> a =C3=A9crit :<br>
                    <br>
                    Hello,<br>
                    <br>
                    I=E2=80=99m still testing OpenCMS and i wrote a very =
small
                    library, a spring based library. I want to use the
                    beans in my jsp so i wrote 2 classes:<br>
                    <br>
                    SpringBeanUtils :<br>
                    <br>
                    public class SpringBeanUtils {<br>
                    <br>
                    &nbsp;&nbsp;&nbsp;private static final Log LOG =3D
                    CmsLog.getLog(SpringBeanUtils.class);<br>
                    <br>
                    &nbsp;&nbsp;&nbsp;/**<br>
                    &nbsp;&nbsp;&nbsp;&nbsp;* R=C3=A9cup=C3=A8re le =
service utilisateur<br>
                    &nbsp;&nbsp;&nbsp;&nbsp;* Exemple d'utilisation dans =
une page JSP :<br>
                    &nbsp;&nbsp;&nbsp;&nbsp;* &lt;%<br>
                    &nbsp;&nbsp;&nbsp;&nbsp;* &nbsp;&nbsp;UserService =
userService =3D
                    SpringBeanUtils.getUserService();<br>
                    &nbsp;&nbsp;&nbsp;&nbsp;* =
&nbsp;&nbsp;List&lt;User&gt; users =3D
                    userService.getAllActiveUsers();<br>
                    &nbsp;&nbsp;&nbsp;&nbsp;* %&gt;<br>
                    &nbsp;&nbsp;&nbsp;&nbsp;*/<br>
                    &nbsp;&nbsp;&nbsp;public static UserService =
getUserService() {<br>
                    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;try {<br>
                    =
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;return
                    LibraryInitializer.getBean(UserService.class);<br>
                    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;} catch =
(Exception e) {<br>
                    =
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;LOG.erro=
r("Erreur lors de la r=C3=A9cup=C3=A9ration
                    du UserService", e);<br>
                    =
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;throw =
new RuntimeException("Service
                    utilisateur non disponible", e);<br>
                    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br>
                    &nbsp;&nbsp;&nbsp;}<br>
                    <br>
                    &nbsp;&nbsp;&nbsp;/**<br>
                    &nbsp;&nbsp;&nbsp;&nbsp;* M=C3=A9thode g=C3=A9n=C3=A9r=
ique pour r=C3=A9cup=C3=A9rer n'importe
                    quel service<br>
                    &nbsp;&nbsp;&nbsp;&nbsp;* Exemple :<br>
                    &nbsp;&nbsp;&nbsp;&nbsp;* MyService service =3D
                    SpringBeanUtils.getService(MyService.class);<br>
                    &nbsp;&nbsp;&nbsp;&nbsp;*/<br>
                    &nbsp;&nbsp;&nbsp;public static &lt;T&gt; T
                    getService(Class&lt;T&gt; serviceClass) {<br>
                    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;try {<br>
                    =
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;return
                    LibraryInitializer.getBean(serviceClass);<br>
                    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;} catch =
(Exception e) {<br>
                    =
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;LOG.erro=
r("Erreur lors de la r=C3=A9cup=C3=A9ration
                    du service: " + serviceClass.getSimpleName(), =
e);<br>
                    =
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;throw =
new RuntimeException("Service non
                    disponible: " + serviceClass.getSimpleName(), =
e);<br>
                    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br>
                    &nbsp;&nbsp;&nbsp;}<br>
                    <br>
                    &nbsp;&nbsp;&nbsp;/**<br>
                    &nbsp;&nbsp;&nbsp;&nbsp;* R=C3=A9cup=C3=A8re un bean =
par son nom<br>
                    &nbsp;&nbsp;&nbsp;&nbsp;* Exemple :<br>
                    &nbsp;&nbsp;&nbsp;&nbsp;* Object bean =3D
                    SpringBeanUtils.getBean("userService");<br>
                    &nbsp;&nbsp;&nbsp;&nbsp;*/<br>
                    &nbsp;&nbsp;&nbsp;public static Object =
getBean(String beanName) {<br>
                    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;try {<br>
                    =
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;return
                    LibraryInitializer.getBean(beanName);<br>
                    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;} catch =
(Exception e) {<br>
                    =
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;LOG.erro=
r("Erreur lors de la r=C3=A9cup=C3=A9ration
                    du bean: " + beanName, e);<br>
                    =
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;throw =
new RuntimeException("Bean non
                    disponible: " + beanName, e);<br>
                    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br>
                    &nbsp;&nbsp;&nbsp;}<br>
                    <br>
                    &nbsp;&nbsp;&nbsp;/**<br>
                    &nbsp;&nbsp;&nbsp;&nbsp;* V=C3=A9rifie si le =
contexte Spring est disponible<br>
                    &nbsp;&nbsp;&nbsp;&nbsp;*/<br>
                    &nbsp;&nbsp;&nbsp;public static boolean =
isAvailable() {<br>
                    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;return
                    LibraryInitializer.isSpringContextAvailable();<br>
                    &nbsp;&nbsp;&nbsp;}<br>
                    <br>
                    &nbsp;&nbsp;&nbsp;/**<br>
                    &nbsp;&nbsp;&nbsp;&nbsp;* M=C3=A9thode utilitaire =
pour v=C3=A9rifier la
                    disponibilit=C3=A9 avant utilisation<br>
                    &nbsp;&nbsp;&nbsp;&nbsp;*/<br>
                    &nbsp;&nbsp;&nbsp;public static void =
ensureAvailable() {<br>
                    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if =
(!isAvailable()) {<br>
                    =
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;throw =
new IllegalStateException(<br>
                    =
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&n=
bsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;"Le contexte Spring n'est pas
                    disponible. " +<br>
                    =
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&n=
bsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbs=
p;&nbsp;&nbsp;"V=C3=A9rifiez que le module
                    est correctement initialis=C3=A9."<br>
                    =
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;);<br>
                    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br>
                    &nbsp;&nbsp;&nbsp;}<br>
                    }<br>
                    <br>
                    with static method getUserService() I can call the
                    userService bean. No problem with it.<br>
                    <br>
                    And second class LibraryInitializer wich must
                    initialise the spring context and configure it:<br>
                    <br>
                    public class LibraryInitializer extends
                    A_CmsModuleAction implements I_CmsEventListener =
{<br>
                    <br>
                    &nbsp;&nbsp;&nbsp;private static final String =
MODULE_NAME =3D
                    "opencms-spring-library";<br>
                    &nbsp;&nbsp;&nbsp;private static ApplicationContext =
springContext;<br>
                    &nbsp;&nbsp;&nbsp;private static final
                    org.apache.commons.logging.Log LOG =3D
                    CmsLog.getLog(LibraryInitializer.class);<br>
                    <br>
                    &nbsp;&nbsp;&nbsp;/**<br>
                    &nbsp;&nbsp;&nbsp;&nbsp;* Initialisation du =
module<br>
                    &nbsp;&nbsp;&nbsp;&nbsp;*/<br>
                    &nbsp;&nbsp;&nbsp;@Override<br>
                    &nbsp;&nbsp;&nbsp;public void =
initialize(org.opencms.file.CmsObject
                    adminCms,<br>
=
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&n=
bsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbs=
p;&nbsp;org.opencms.configuration.CmsConfigurationManager
                    configurationManager,<br>
                    =
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&n=
bsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbs=
p;&nbsp;CmsModule module) {<br>
                    <br>
                    =
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;LOG.info("Initialisation de la =
librairie
                    Spring classique pour OpenCMS");<br>
                    <br>
                    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;try {<br>
                    =
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;// =
Configuration des propri=C3=A9t=C3=A9s syst=C3=A8me<br>
                    =
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;configur=
eSystemProperties();<br>
                    <br>
                    =
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;// =
Cr=C3=A9ation du contexte Spring CLASSIQUE<br>
                    =
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Annotati=
onConfigApplicationContext
                    context =3D new =
AnnotationConfigApplicationContext();<br>
=
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;context.=
register(com.opencms.library.config.LibraryConfiguration.class);<br>
                    =
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;context.=
refresh();<br>
                    <br>
                    =
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;springCo=
ntext =3D context;<br>
                    <br>
                    =
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;// =
Enregistrement des listeners OpenCMS<br>
                    =
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;OpenCms.=
addCmsEventListener(this);<br>
                    <br>
                    =
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;LOG.info=
("Librairie Spring classique
                    initialis=C3=A9e avec succ=C3=A8s");<br>
                    <br>
                    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;} catch =
(Exception e) {<br>
                    =
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;LOG.erro=
r("Erreur lors de
                    l'initialisation de la librairie Spring", e);<br>
                    =
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;throw =
new RuntimeException("Impossible
                    d'initialiser la librairie Spring", e);<br>
                    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br>
                    &nbsp;&nbsp;&nbsp;}<br>
                    <br>
                    &nbsp;&nbsp;&nbsp;/**<br>
                    &nbsp;&nbsp;&nbsp;&nbsp;* Arr=C3=AAt du module<br>
                    &nbsp;&nbsp;&nbsp;&nbsp;*/<br>
                    &nbsp;&nbsp;&nbsp;@Override<br>
                    &nbsp;&nbsp;&nbsp;public void shutDown(CmsModule =
module) {<br>
                    =
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;LOG.info("Arr=C3=AAt de la =
librairie Spring
                    classique");<br>
                    <br>
                    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if =
(springContext !=3D null) {<br>
                    =
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;try =
{<br>
                    =
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&n=
bsp;&nbsp;&nbsp;if (springContext instanceof
                    AnnotationConfigApplicationContext) {<br>
=
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&n=
bsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;((AnnotationConfigApplicationConte=
xt)
                    springContext).close();<br>
                    =
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&n=
bsp;&nbsp;&nbsp;}<br>
                    =
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&n=
bsp;&nbsp;&nbsp;LOG.info("Contexte Spring ferm=C3=A9 avec
                    succ=C3=A8s");<br>
                    =
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;} =
catch (Exception e) {<br>
                    =
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&n=
bsp;&nbsp;&nbsp;LOG.error("Erreur lors de l'arr=C3=AAt du
                    contexte Spring", e);<br>
                    =
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;} =
finally {<br>
                    =
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&n=
bsp;&nbsp;&nbsp;springContext =3D null;<br>
                    =
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br>
                    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br>
                    &nbsp;&nbsp;&nbsp;}<br>
                    <br>
                    &nbsp;&nbsp;&nbsp;/**<br>
                    &nbsp;&nbsp;&nbsp;&nbsp;* Gestion des =C3=A9v=C3=A9nem=
ents OpenCMS<br>
                    &nbsp;&nbsp;&nbsp;&nbsp;*/<br>
                    &nbsp;&nbsp;&nbsp;@Override<br>
                    &nbsp;&nbsp;&nbsp;public void cmsEvent(CmsEvent =
event) {<br>
                    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;switch =
(event.getType()) {<br>
                    =
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;case
                    I_CmsEventListener.EVENT_PUBLISH_PROJECT:<br>
                    =
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&n=
bsp;&nbsp;&nbsp;LOG.debug("=C3=89v=C3=A9nement de publication
                    d=C3=A9tect=C3=A9");<br>
                    =
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&n=
bsp;&nbsp;&nbsp;break;<br>
                    =
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;case
                    I_CmsEventListener.EVENT_CLEAR_CACHES:<br>
                    =
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&n=
bsp;&nbsp;&nbsp;LOG.debug("=C3=89v=C3=A9nement de nettoyage des
                    caches d=C3=A9tect=C3=A9");<br>
                    =
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&n=
bsp;&nbsp;&nbsp;break;<br>
                    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br>
                    &nbsp;&nbsp;&nbsp;}<br>
                    <br>
                    &nbsp;&nbsp;&nbsp;/**<br>
                    &nbsp;&nbsp;&nbsp;&nbsp;* Configuration des =
propri=C3=A9t=C3=A9s syst=C3=A8me<br>
                    &nbsp;&nbsp;&nbsp;&nbsp;*/<br>
                    &nbsp;&nbsp;&nbsp;private void =
configureSystemProperties() {<br>
                    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;// =
Configuration de base de donn=C3=A9es (valeurs
                    par d=C3=A9faut)<br>
                    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if
                    (System.getProperty("spring.datasource.url") =3D=3D
                    null) {<br>
=
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;System.s=
etProperty("spring.datasource.url",
                    "jdbc:postgresql://postgres-db:5432/libdb");<br>
                    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br>
                    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if
                    (System.getProperty("spring.datasource.username") =3D=3D=

                    null) {<br>
=
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;System.s=
etProperty("spring.datasource.username", "appuser");<br>
                    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br>
                    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if
                    (System.getProperty("spring.datasource.password") =3D=3D=

                    null) {<br>
=
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;System.s=
etProperty("spring.datasource.password",
                    "apppassword");<br>
                    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br>
                    <br>
                    =
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;LOG.info("Propri=C3=A9t=C3=A9s =
syst=C3=A8me configur=C3=A9es");<br>
                    &nbsp;&nbsp;&nbsp;}<br>
                    <br>
                    &nbsp;&nbsp;&nbsp;/**<br>
                    &nbsp;&nbsp;&nbsp;&nbsp;* Acc=C3=A8s aux beans =
Spring<br>
                    &nbsp;&nbsp;&nbsp;&nbsp;*/<br>
                    &nbsp;&nbsp;&nbsp;public static &lt;T&gt; T =
getBean(Class&lt;T&gt;
                    beanClass) {<br>
                    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if =
(springContext =3D=3D null) {<br>
                    =
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;throw =
new IllegalStateException("Le
                    contexte Spring n'est pas initialis=C3=A9");<br>
                    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br>
                    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;return =
springContext.getBean(beanClass);<br>
                    &nbsp;&nbsp;&nbsp;}<br>
                    <br>
                    &nbsp;&nbsp;&nbsp;public static Object =
getBean(String beanName) {<br>
                    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if =
(springContext =3D=3D null) {<br>
                    =
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;throw =
new IllegalStateException("Le
                    contexte Spring n'est pas initialis=C3=A9");<br>
                    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br>
                    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;return =
springContext.getBean(beanName);<br>
                    &nbsp;&nbsp;&nbsp;}<br>
                    <br>
                    &nbsp;&nbsp;&nbsp;public static boolean =
isSpringContextAvailable()
                    {<br>
                    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;return =
springContext !=3D null;<br>
                    &nbsp;&nbsp;&nbsp;}<br>
                    }<br>
                    <br>
                    If i build this lib as a jar and put it in
                    WEB-INF/lib i can access my beans in jsp pages but i
                    must do this call first:<br>
                    <br>
=
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;com.opencms.li=
brary.integration.LibraryInitializer initializer
                    =3D<br>
                    =
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&n=
bsp;&nbsp;&nbsp;new
                    =
com.opencms.library.integration.LibraryInitializer();<br>
                    <br>
                    =
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;// =
Appel direct de initialize avec des
                    param=C3=A8tres nulls (notre version simplifi=C3=A9e =
les g=C3=A8re)<br>
                    =
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;initiali=
zer.initialize(null, null, null);<br>
                    after that my context is initialized and configured
                    and my jsp are running fine. But the way to
                    automatic loading of my context seems to be an
                    opencms module.<br>
                    <br>
                    I tried to adapt my lib with opencms-module.xml,
                    manifest.xml,... but nothing works: at startup
                    com.opencms.library.integration.LibraryInitializer
                    is not found by opencms.<br>
                    <br>
                    Can you help me?<br>
                    Does it exist a tutorial or how-to?<br>
                    <br>
                    Am i wrong with public class LibraryInitializer
                    extends A_CmsModuleAction implements
                    I_CmsEventListener ?<br>
                    <br>
                    Thank you<br>
                    <br>
                    Kind regards,<br>
                    <br>
                    Laurent<br>
                    <br>
                    <br>
                    _______________________________________________<br>
                    This mail is sent to you from the opencms-dev
                    mailing list<br>
                    To change your list options, or to unsubscribe from
                    the list, please visit<br>
<a class=3D"moz-txt-link-freetext" =
href=3D"https://lists.opencms.org/mailman/listinfo/opencms-dev">https://li=
sts.opencms.org/mailman/listinfo/opencms-dev</a><br>
                    <br>
                    <br>
                    <br>
                  </blockquote>
                  <br>
                  _______________________________________________<br>
                  This mail is sent to you from the opencms-dev mailing
                  list<br>
                  To change your list options, or to unsubscribe from
                  the list, please visit<br>
                  <a class=3D"moz-txt-link-freetext" =
href=3D"https://lists.opencms.org/mailman/listinfo/opencms-dev">https://li=
sts.opencms.org/mailman/listinfo/opencms-dev</a><br>
                  <br>
                  <br>
                  <br>
                </blockquote>
                -- <br>
                Michael Emmerich<br>
                Alkacon Software GmbH &amp; Co. KG - The OpenCms =
Experts<br>
                <a class=3D"moz-txt-link-freetext" =
href=3D"http://www.alkacon.com/">http://www.alkacon.com</a><br>
                <a class=3D"moz-txt-link-freetext" =
href=3D"http://www.opencms.org/">http://www.opencms.org</a><br>
                <br>
                _______________________________________________<br>
                This mail is sent to you from the opencms-dev mailing
                list<br>
                To change your list options, or to unsubscribe from the
                list, please visit<br>
                <a class=3D"moz-txt-link-freetext" =
href=3D"https://lists.opencms.org/mailman/listinfo/opencms-dev">https://li=
sts.opencms.org/mailman/listinfo/opencms-dev</a><br>
                <br>
                <br>
                <br>
              </div>
            </div>
          </blockquote>
        </div>
        <br>
      </div>
      <br>
      <fieldset class=3D"moz-mime-attachment-header"></fieldset>
      <pre wrap=3D"" =
class=3D"moz-quote-pre">_______________________________________________
This mail is sent to you from the opencms-dev mailing list
To change your list options, or to unsubscribe from the list, please =
visit
<a class=3D"moz-txt-link-freetext" =
href=3D"https://lists.opencms.org/mailman/listinfo/opencms-dev">https://li=
sts.opencms.org/mailman/listinfo/opencms-dev</a>



</pre>
    </blockquote>
    <pre class=3D"moz-signature" cols=3D"72">--=20
Michael Emmerich
=20
-------------------

Alkacon Software GmbH &amp; Co. KG - The OpenCms Experts
Michael Emmerich
An der Wachsfabrik 13
50996 Koeln, DE
=20
Tel: +49 (0)2236 3826-14
Fax: +49 (0)2236 3826-20
Email: <a class=3D"moz-txt-link-abbreviated" =
href=3D"mailto:[email protected]">[email protected]</a>

<a class=3D"moz-txt-link-freetext" =
href=3D"http://www.alkacon.com/">http://www.alkacon.com</a>
<a class=3D"moz-txt-link-freetext" =
href=3D"http://www.opencms.org/">http://www.opencms.org</a>

Amtsgericht K=C3=B6ln, HRA 32185, USt-IdNr.: DE259882372
Vertreten durch: Alkacon Verwaltungs GmbH
Gesch=C3=A4ftsf=C3=BChrer: Alexander Kandzior, Amtsgericht K=C3=B6ln, =
HRB 88218</pre>
  </div>

_______________________________________________<br>This mail is sent to =
you from the opencms-dev mailing list<br>To change your list options, or =
to unsubscribe from the list, please =
visit<br>https://lists.opencms.org/mailman/listinfo/opencms-dev<br><br><br=
><br></div></blockquote></div><br></div></body></html>=

--Apple-Mail=_FF6640D9-3C47-4D41-B0E4-DA2BE5015C0E--

--===============9206763158331239805==
Content-Type: text/plain; charset="utf-8"
MIME-Version: 1.0
Content-Transfer-Encoding: base64
Content-Disposition: inline

X19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX18KVGhpcyBtYWls
IGlzIHNlbnQgdG8geW91IGZyb20gdGhlIG9wZW5jbXMtZGV2IG1haWxpbmcgbGlzdApUbyBjaGFu
Z2UgeW91ciBsaXN0IG9wdGlvbnMsIG9yIHRvIHVuc3Vic2NyaWJlIGZyb20gdGhlIGxpc3QsIHBs
ZWFzZSB2aXNpdApodHRwczovL2xpc3RzLm9wZW5jbXMub3JnL21haWxtYW4vbGlzdGluZm8vb3Bl
bmNtcy1kZXYKCgoK

--===============9206763158331239805==--