[opencms-dev] Starting CmsShell programatically

Thomas Göttlich guo.tuomi at googlemail.com
Fri Jul 16 08:54:02 CEST 2010


Hi Florian,

I tried that approach, too.
You're right, that doesn't make a difference.

The actual code was:

CmsShell tCmsShell = new CmsShell( webInfPath, servletMapping,
defaultWebAppName, prompt, null );

with the parameters provided by the calling ant target.

I checked the parameters before calling and they were correct, so in essence
it comes down to your suggestion.

2010/7/15 Florian Hopf <hopf at synyx.de>

> Hi,
>
>
> you might want to try
>
> CmsShell shell = new CmsShell(webappfolder, "opencms", "opencms", "",
> null);
>
> but I am not sure if this will make a difference.
>
> Regards
> Florian
>
> Thomas Göttlich schrieb:
> > Hi,
> >
> > I want to call CmsShell from from a custom ant task, like this:
> >
> > String tArgs[] = new String[3];
> > tArgs[0] = "-base=" + webInfPath;
> > tArgs[1] = "-defaultWebApp=opencms";
> > tArgs[2] = "-servletMapping=opencms";
> >
> > CmsShell.main( tArgs );
> >
> >
> > The class path for the task is set to the OpenCMS WEB-INF/lib folder and
> > the JBoss lib folder (for servlet-api.jar etc.).
> >
> > The parameters seem to work, since the opencms.properties file is read,
> > for example.
> >
> > However, there is a class loading problem:
> >
> > java.lang.ClassNotFoundException:
> > org.opencms.configuration.CmsSystemConfiguration
> >         at java.net.URLClassLoader$1.run(URLClassLoader.java:200)
> >         at java.security.AccessController.doPrivileged(Native Method)
> >         at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
> >         at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
> >         at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:268)
> >         at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
> >         at
> >
> org.apache.commons.digester.ObjectCreateRule.begin(ObjectCreateRule.java:205)
> >         at org.apache.commons.digester.Rule.begin(Rule.java:175)
> >         at
> > org.apache.commons.digester.Digester.startElement(Digester.java:1453)
> >         at
> > org.apache.xerces.parsers.AbstractSAXParser.startElement(Unknown Source)
> >         at
> > org.apache.xerces.parsers.AbstractXMLDocumentParser.emptyElement(Unknown
> > Source)
> >         at
> > org.apache.xerces.impl.dtd.XMLDTDValidator.emptyElement(Unknown Source)
> >         at
> >
> org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanStartElement(Unknown
> > Source)
> >         at
> >
> org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(Unknown
> > Source)
> >         at
> >
> org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown
> > Source)
> >         at org.apache.xerces.parsers.XML11Configuration.parse(Unknown
> > Source)
> >         at org.apache.xerces.parsers.XML11Configuration.parse(Unknown
> > Source)
> >         at org.apache.xerces.parsers.XMLParser.parse(Unknown Source)
> >         at org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown
> Source)
> >         at
> > org.apache.xerces.jaxp.SAXParserImpl$JAXPSAXParser.parse(Unknown Source)
> >         at org.apache.commons.digester.Digester.parse(Digester.java:1765)
> >         at
> >
> org.opencms.configuration.CmsConfigurationManager.loadXmlConfiguration(CmsConfigurationManager.java:507)
> >         at
> >
> org.opencms.configuration.CmsConfigurationManager.loadXmlConfiguration(CmsConfigurationManager.java:342)
> >         at
> > org.opencms.main.OpenCmsCore.initConfiguration(OpenCmsCore.java:970)
> >         at
> > org.opencms.main.OpenCmsCore.upgradeRunlevel(OpenCmsCore.java:1699)
> >         at org.opencms.main.CmsShell.<init>(CmsShell.java:458)
> >
> >
> > Calling CmsShell from an ant task with the very same classpath works:
> >
> > <java classname="org.opencms.main.CmsShell" fork="true"
> input="shell.input">
> >       <classpath>
> >         <fileset dir="${opencms.lib.dir}">
> >           <include name="**/*.jar"/>
> >         </fileset>
> >         <fileset dir="${jboss.server.dir}/lib">
> >           <include name="**/*.jar"/>
> >         </fileset>
> >       </classpath>
> >       <arg value="-base=${opencms.web.dir}" />
> >       <arg value="-defaultWebApp=opencms" />
> >       <arg value="-servletMapping=opencms" />
> >     </java>
> >
> > Any ideas why it doesn't work from a custom task?
> >
> > Thanks in advance.
> >
> >
> > ------------------------------------------------------------------------
> >
> >
> > _______________________________________________
> > 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
> > http://lists.opencms.org/mailman/listinfo/opencms-dev
>
>
> --
> /**
>  * Florian Hopf
>  * Synyx GmbH & Co. KG
>  * OpenSource Solutions
>  * Karlstr. 68
>  * 76137 Karlsruhe
>  * phone  +49(0)721 911 83 03
>  * fax   +49(0)721 66 48 877
>  * www   http://www.synyx.de
>  * blog  http://blog.synyx.de
>  * blog  http://mobile.synyx.de
>  * forum http://www.opencms-forum.de
>  * irc   irc://irc.synyx.de
>  *
>  * Sitz der Gesellschaft: Karlsruhe
>  * Registergericht: Mannheim
>  * Handelsregisternummer: HRA 4793
>  * USt-IdNr.: DE249264296
>  *
>  * Komplementärin: Elatech Verwaltungs GmbH
>  * Sitz der Gesellschaft: Karlsruhe
>  * Geschäftsführer: Markus Daniel
>  * Registergericht: Mannheim
>  * Handelsregisternummer: HRB 7250
>  */
>
> _______________________________________________
> 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
> http://lists.opencms.org/mailman/listinfo/opencms-dev
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://webmail.opencms.org/pipermail/opencms-dev/attachments/20100716/80ee2e04/attachment.htm>


More information about the opencms-dev mailing list