[opencms-dev] Starting CmsShell programatically
Florian Hopf
hopf at synyx.de
Thu Jul 15 20:13:22 CEST 2010
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
*/
More information about the opencms-dev
mailing list