Hi Florian,<br><br>I tried that approach, too.<br>You're right, that doesn't make a difference.<br><br>The actual code was:<br><br>CmsShell tCmsShell = new CmsShell( webInfPath, servletMapping, defaultWebAppName, prompt, null );<br>
<br>with the parameters provided by the calling ant target.<br><br>I checked the parameters before calling and they were correct, so in essence it comes down to your suggestion.<br><br><div class="gmail_quote">2010/7/15 Florian Hopf <span dir="ltr"><<a href="mailto:hopf@synyx.de">hopf@synyx.de</a>></span><br>
<blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">Hi,<br>
<br>
<br>
you might want to try<br>
<br>
CmsShell shell = new CmsShell(webappfolder, "opencms", "opencms", "", null);<br>
<br>
but I am not sure if this will make a difference.<br>
<br>
Regards<br>
Florian<br>
<br>
Thomas Göttlich schrieb:<br>
<div><div></div><div class="h5">> Hi,<br>
><br>
> I want to call CmsShell from from a custom ant task, like this:<br>
><br>
> String tArgs[] = new String[3];<br>
> tArgs[0] = "-base=" + webInfPath;<br>
> tArgs[1] = "-defaultWebApp=opencms";<br>
> tArgs[2] = "-servletMapping=opencms";<br>
><br>
> CmsShell.main( tArgs );<br>
><br>
><br>
> The class path for the task is set to the OpenCMS WEB-INF/lib folder and<br>
> the JBoss lib folder (for servlet-api.jar etc.).<br>
><br>
> The parameters seem to work, since the opencms.properties file is read,<br>
> for example.<br>
><br>
> However, there is a class loading problem:<br>
><br>
> java.lang.ClassNotFoundException:<br>
> org.opencms.configuration.CmsSystemConfiguration<br>
>         at java.net.URLClassLoader$1.run(URLClassLoader.java:200)<br>
>         at java.security.AccessController.doPrivileged(Native Method)<br>
>         at java.net.URLClassLoader.findClass(URLClassLoader.java:188)<br>
>         at java.lang.ClassLoader.loadClass(ClassLoader.java:306)<br>
>         at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:268)<br>
>         at java.lang.ClassLoader.loadClass(ClassLoader.java:251)<br>
>         at<br>
> org.apache.commons.digester.ObjectCreateRule.begin(ObjectCreateRule.java:205)<br>
>         at org.apache.commons.digester.Rule.begin(Rule.java:175)<br>
>         at<br>
> org.apache.commons.digester.Digester.startElement(Digester.java:1453)<br>
>         at<br>
> org.apache.xerces.parsers.AbstractSAXParser.startElement(Unknown Source)<br>
>         at<br>
> org.apache.xerces.parsers.AbstractXMLDocumentParser.emptyElement(Unknown<br>
> Source)<br>
>         at<br>
> org.apache.xerces.impl.dtd.XMLDTDValidator.emptyElement(Unknown Source)<br>
>         at<br>
> org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanStartElement(Unknown<br>
> Source)<br>
>         at<br>
> org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(Unknown<br>
> Source)<br>
>         at<br>
> org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown<br>
> Source)<br>
>         at org.apache.xerces.parsers.XML11Configuration.parse(Unknown<br>
> Source)<br>
>         at org.apache.xerces.parsers.XML11Configuration.parse(Unknown<br>
> Source)<br>
>         at org.apache.xerces.parsers.XMLParser.parse(Unknown Source)<br>
>         at org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown Source)<br>
>         at<br>
> org.apache.xerces.jaxp.SAXParserImpl$JAXPSAXParser.parse(Unknown Source)<br>
>         at org.apache.commons.digester.Digester.parse(Digester.java:1765)<br>
>         at<br>
> org.opencms.configuration.CmsConfigurationManager.loadXmlConfiguration(CmsConfigurationManager.java:507)<br>
>         at<br>
> org.opencms.configuration.CmsConfigurationManager.loadXmlConfiguration(CmsConfigurationManager.java:342)<br>
>         at<br>
> org.opencms.main.OpenCmsCore.initConfiguration(OpenCmsCore.java:970)<br>
>         at<br>
> org.opencms.main.OpenCmsCore.upgradeRunlevel(OpenCmsCore.java:1699)<br>
>         at org.opencms.main.CmsShell.<init>(CmsShell.java:458)<br>
><br>
><br>
> Calling CmsShell from an ant task with the very same classpath works:<br>
><br>
> <java classname="org.opencms.main.CmsShell" fork="true" input="shell.input"><br>
>       <classpath><br>
>         <fileset dir="${opencms.lib.dir}"><br>
>           <include name="**/*.jar"/><br>
>         </fileset><br>
>         <fileset dir="${jboss.server.dir}/lib"><br>
>           <include name="**/*.jar"/><br>
>         </fileset><br>
>       </classpath><br>
>       <arg value="-base=${opencms.web.dir}" /><br>
>       <arg value="-defaultWebApp=opencms" /><br>
>       <arg value="-servletMapping=opencms" /><br>
>     </java><br>
><br>
> Any ideas why it doesn't work from a custom task?<br>
><br>
> Thanks in advance.<br>
><br>
><br>
</div></div><div class="im">> ------------------------------------------------------------------------<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 href="http://lists.opencms.org/mailman/listinfo/opencms-dev" target="_blank">http://lists.opencms.org/mailman/listinfo/opencms-dev</a><br>
<br>
<br>
</div>--<br>
/**<br>
 * Florian Hopf<br>
 * Synyx GmbH & Co. KG<br>
 * OpenSource Solutions<br>
 * Karlstr. 68<br>
 * 76137 Karlsruhe<br>
 * phone  +49(0)721 911 83 03<br>
 * fax   +49(0)721 66 48 877<br>
 * www   <a href="http://www.synyx.de" target="_blank">http://www.synyx.de</a><br>
 * blog  <a href="http://blog.synyx.de" target="_blank">http://blog.synyx.de</a><br>
 * blog  <a href="http://mobile.synyx.de" target="_blank">http://mobile.synyx.de</a><br>
 * forum <a href="http://www.opencms-forum.de" target="_blank">http://www.opencms-forum.de</a><br>
 * irc   irc://<a href="http://irc.synyx.de" target="_blank">irc.synyx.de</a><br>
 *<br>
 * Sitz der Gesellschaft: Karlsruhe<br>
 * Registergericht: Mannheim<br>
 * Handelsregisternummer: HRA 4793<br>
 * USt-IdNr.: DE249264296<br>
 *<br>
 * Komplementärin: Elatech Verwaltungs GmbH<br>
 * Sitz der Gesellschaft: Karlsruhe<br>
 * Geschäftsführer: Markus Daniel<br>
 * Registergericht: Mannheim<br>
 * Handelsregisternummer: HRB 7250<br>
 */<br>
<div><div></div><div class="h5"><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 href="http://lists.opencms.org/mailman/listinfo/opencms-dev" target="_blank">http://lists.opencms.org/mailman/listinfo/opencms-dev</a><br>
</div></div></blockquote></div><br>