Could not find the main class: org.apache.xalan.xslt.Process - xslt

As part of a project, I have been asked to carry out an XML to HTML transformation. I have to use Xalan Version 2.7.0.
However when I set the CLASSPATH for xalan in command prompt:
set CLASSPATH=%CLASSPATH%;I:\Xalan\xalan-j_2_7_0\xalan.jar
and try to carry out the transformation as follows:
java org.apache.xalan.xslt.Process -in Multimedia\StudentDeals.xml -xsl Multimedia\StudentDeals.xsl -out Multimedia\Deals.html
I always get this:
Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/xalan/xslt
/Process
Caused by: java.lang.ClassNotFoundException: org.apache.xalan.xslt.Process
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
Could not find the main class: org.apache.xalan.xslt.Process. Program will exit
Does anyone know why I am getting this error and how to resolve it?
Thanks

Following the link that Mads Hansen provided above, I tried things out. I got it working all right, without having to specify serializer.jar in the classpath, but I did include the classpath option in the call itself:
java -classpath D:\XSLT_engines\xalan-j_2_7_1\xalan.jar org.apache.xalan.xslt.Process -in input.xml -xsl transformation.xsl -out output.xml

Related

Getting java.lang.ClassNotFoundException: org.eclipse.jetty.servlet.listener.IntrospectorCleaner

I'm using Jetty as an embedded web server within OSGi and spring-dm environment. All my bundles and war files are deployed successfully. However I'm observing the following warning in my logs:
2015-03-25 17:32:13.748:WARN:oejw.StandardDescriptorProcessor:Could not instantiate listener org.eclipse.jetty.servlet.listener.IntrospectorCleaner
java.lang.ClassNotFoundException: org.eclipse.jetty.servlet.listener.IntrospectorCleaner
at java.net.URLClassLoader$1.run(URLClassLoader.java:366)
at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
at java.lang.ClassLoader.loadClass(ClassLoader.java:425)
at java.net.FactoryURLClassLoader.loadClass(URLClassLoader.java:789)
at java.lang.ClassLoader.loadClass(ClassLoader.java:358)
at org.eclipse.jetty.server.handler.ContextHandler.loadClass(ContextHandler.java:1517)
at org.eclipse.jetty.webapp.StandardDescriptorProcessor.visitListener(StandardDescriptorProcessor.java:1863)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at org.eclipse.jetty.webapp.IterativeDescriptorProcessor.visit(IterativeDescriptorProcessor.java:85)
at org.eclipse.jetty.webapp.IterativeDescriptorProcessor.process(IterativeDescriptorProcessor.java:72)
at org.eclipse.jetty.webapp.MetaData.resolve(MetaData.java:366)
at org.eclipse.jetty.webapp.WebAppContext.startContext(WebAppContext.java:1250)
at org.eclipse.jetty.server.handler.ContextHandler.doStart(ContextHandler.java:710)
at org.eclipse.jetty.webapp.WebAppContext.doStart(WebAppContext.java:494)
at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:64)
at org.springframework.osgi.web.deployer.jetty.JettyWarDeployer.startWebAppContext(JettyWarDeployer.java:218)
at org.springframework.osgi.web.deployer.jetty.JettyWarDeployer.startDeployment(JettyWarDeployer.java:123)
at org.springframework.osgi.web.deployer.support.AbstractWarDeployer.deploy(AbstractWarDeployer.java:93)
at org.springframework.osgi.web.extender.internal.activator.WarLoaderListener$DeploymentManager$DeployTask.doRun(WarLoaderListener.java:261)
at org.springframework.osgi.web.extender.internal.activator.WarLoaderListener$DeploymentManager$BaseTask.run(WarLoaderListener.java:219)
at org.springframework.scheduling.timer.DelegatingTimerTask.run(DelegatingTimerTask.java:70)
at java.util.TimerThread.mainLoop(Timer.java:555)
at java.util.TimerThread.run(Timer.java:505)
Though this warning is not impacting any functionality, i'm still curious to know why this error is happening. With little debugging I can see that the package "org.eclipse.jetty.servlet.listener" is not imported by any of the modules. I explicitly added this import to jetty-webapp and spring-osgi-web bundles, but that didn't help either.
Upgrade your version of Jetty, you have a very old version with a faulty manifest.
This was fixed well over a year ago.
$ cd jetty-distribution-9.2.10.v20150310
$ jar -xvf lib/jetty-servlet-9.2.10.v20150310.jar META-INF/MANIFEST.MF
inflated: META-INF/MANIFEST.MF
$ grep -A3 Export-Package META-INF/MANIFEST.MF
Export-Package: org.eclipse.jetty.servlet;version="9.2.10",org.eclipse
.jetty.servlet.jmx;version="9.2.10",org.eclipse.jetty.servlet.listene
r;version="9.2.10"
Bundle-Classpath: .

Netbeans can't refresh webservice - NoClassDefFoundError

When I try to import a webservice I get the following output:
ant -f /home/bence/NetBeansProjects/WebClient wsimport-client-clean-AdminService_1 wsimport-client-generate
wsimport-client-clean-AdminService_1:
Deleting directory /home/bence/NetBeansProjects/WebClient/build/generated/jax-wsCache/AdminService_1
init:
wsimport-init:
wsimport-client-AdminService_1:
Created dir: /home/bence/NetBeansProjects/WebClient/build/generated/jax-wsCache/AdminService_1
command line: wsimport -d /home/bence/NetBeansProjects/WebClient/build/generated/jax-wsCache/AdminService_1 -extension -Xnocompile -Xendorsed -keep -s /home/bence/NetBeansProjects/WebClient/build/generated/jax-wsCache/AdminService_1 -encoding UTF-8 -catalog /home/bence/NetBeansProjects/WebClient/catalog.xml -verbose /home/bence/NetBeansProjects/WebClient/xml-resources/web-service-references/AdminService_1/wsdl/localhost_8084/WebFormsTest/AdminService.wsdl -p org.czentral.test.service -wsdllocation http://localhost:8084/WebFormsTest/AdminService?wsdl
parsing WSDL...
/home/bence/NetBeansProjects/WebClient/nbproject/jaxws-build.xml:22:
java.lang.NoClassDefFoundError: com/sun/tools/xjc/Plugin
at java.lang.ClassLoader.findBootstrapClass(Native Method)
at java.lang.ClassLoader.findBootstrapClassOrNull(ClassLoader.java:1058)
at java.lang.ClassLoader.loadClass(ClassLoader.java:413)
at java.lang.ClassLoader.loadClass(ClassLoader.java:411)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
at org.apache.tools.ant.AntClassLoader.findBaseClass(AntClassLoader.java:1385)
at org.apache.tools.ant.AntClassLoader.loadClass(AntClassLoader.java:1064)
at java.lang.ClassLoader.loadClass(ClassLoader.java:411)
at com.sun.istack.tools.MaskingClassLoader.loadClass(MaskingClassLoader.java:82)
at java.lang.ClassLoader.loadClass(ClassLoader.java:411)
at java.lang.ClassLoader.loadClass(ClassLoader.java:411)
at java.lang.ClassLoader.loadClass(ClassLoader.java:411)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:270)
at java.util.ServiceLoader$LazyIterator.next(ServiceLoader.java:363)
at java.util.ServiceLoader$1.next(ServiceLoader.java:445)
at com.sun.tools.xjc.Options.findServices(Options.java:952)
at com.sun.tools.xjc.Options.getAllPlugins(Options.java:374)
at com.sun.tools.xjc.reader.AbstractExtensionBindingChecker.<init>(AbstractExtensionBindingChecker.java:100)
at com.sun.tools.xjc.reader.ExtensionBindingChecker.<init>(ExtensionBindingChecker.java:81)
at com.sun.tools.xjc.ModelLoader$XMLSchemaParser.parse(ModelLoader.java:265)
at com.sun.xml.xsom.impl.parser.NGCCRuntimeEx.parseEntity(NGCCRuntimeEx.java:347)
at com.sun.xml.xsom.impl.parser.ParserContext.parse(ParserContext.java:128)
at com.sun.xml.xsom.impl.parser.ParserContext.<init>(ParserContext.java:100)
at com.sun.xml.xsom.parser.XSOMParser.<init>(XSOMParser.java:110)
at com.sun.tools.xjc.ModelLoader.createXSOMParser(ModelLoader.java:431)
at com.sun.tools.xjc.ModelLoader.createXSOMParser(ModelLoader.java:439)
at com.sun.tools.xjc.ModelLoader.createXSOM(ModelLoader.java:521)
at com.sun.tools.xjc.api.impl.s2j.SchemaCompilerImpl.bind(SchemaCompilerImpl.java:268)
at com.sun.tools.xjc.api.impl.s2j.SchemaCompilerImpl.bind(SchemaCompilerImpl.java:94)
at com.sun.tools.ws.processor.modeler.wsdl.JAXBModelBuilder.bind(JAXBModelBuilder.java:142)
at com.sun.tools.ws.processor.modeler.wsdl.WSDLModeler.buildJAXBModel(WSDLModeler.java:2244)
at com.sun.tools.ws.processor.modeler.wsdl.WSDLModeler.internalBuildModel(WSDLModeler.java:191)
at com.sun.tools.ws.processor.modeler.wsdl.WSDLModeler.buildModel(WSDLModeler.java:137)
at com.sun.tools.ws.wscompile.WsimportTool.buildWsdlModel(WsimportTool.java:381)
at com.sun.tools.ws.wscompile.WsimportTool.run(WsimportTool.java:198)
at com.sun.tools.ws.wscompile.WsimportTool.run(WsimportTool.java:179)
at com.sun.tools.ws.ant.WsImport2.execute(WsImport2.java:835)
at com.sun.istack.tools.ProtectedTask.execute(ProtectedTask.java:103)
at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:292)
at sun.reflect.GeneratedMethodAccessor59.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)
at org.apache.tools.ant.Task.perform(Task.java:348)
at org.apache.tools.ant.Target.execute(Target.java:435)
at org.apache.tools.ant.Target.performTasks(Target.java:456)
at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1393)
at org.apache.tools.ant.Project.executeTarget(Project.java:1364)
at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:41)
at org.apache.tools.ant.Project.executeTargets(Project.java:1248)
at org.apache.tools.ant.module.bridge.impl.BridgeImpl.run(BridgeImpl.java:286)
at org.apache.tools.ant.module.run.TargetExecutor.run(TargetExecutor.java:555)
at org.netbeans.core.execution.RunClassThread.run(RunClassThread.java:153)
BUILD FAILED (total time: 1 second)
I looked around and everything seems OK:
The project's Libraries include JAXB 2.2.5 - jaxb-xjc.jar which indeed contains the class in question.
My jaxws-build.xml contains a classpath ${libs.jaxws21.classpath}
The value of libs.jaxws21.classpath defined in ~/.netbeans/8.0/build.properties has a valid value, containing correct access to jaxb-xjc.jar
When I manually run the wsimport command displayed above it gives unrecognized parameter -encoding (an other version is run maybe in: /usr/bin/wsimport). With this parameter removed it works and generates the .java files. Manually moving them to build/generated-sources/jax-ws will let me compile the project.
I'm using Netbeans 8 (just installed) with Java 7 (openjdk-7-jdk) , I removed any previous versions (configurations moved to backup).
I'm pretty much out of ideas. Anyone else having the same problem? Are there any other settings I can check?

How can I solve Error during testing Angular Js in netbeans?

After following this example
https://netbeans.org/kb/docs/webclient/html5-js-support.html
I always get that error:
Exception in thread "main" java.lang.NoClassDefFoundError: com/google/jstestdriver/hooks/TestListener
at java.lang.Class.getDeclaredMethods0(Native Method)
at java.lang.Class.privateGetDeclaredMethods(Class.java:2451)
at java.lang.Class.getMethod0(Class.java:2694)
at java.lang.Class.getMethod(Class.java:1622)
at sun.launcher.LauncherHelper.getMainMethod(LauncherHelper.java:494)
at sun.launcher.LauncherHelper.checkAndLoadMain(LauncherHelper.java:486)
Caused by: java.lang.ClassNotFoundException: com.google.jstestdriver.hooks.TestListener
at java.net.URLClassLoader$1.run(URLClassLoader.java:366)
at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
at java.lang.ClassLoader.loadClass(ClassLoader.java:423)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
at java.lang.ClassLoader.loadClass(ClassLoader.java:356)
... 6 more
I want to know why is that happening and how to solve that problem
Thanks for your help.
You need to add the JsTestDriver jar to your lib folder, as listed in the resources table.
The file is available here: https://code.google.com/p/js-test-driver/downloads/list

Eclipse Axis2 Service Archiver Plugin Problem

My Eclipse Axis2 Service Archiver plugin is no longer working properly. I have used it to build several .aar files but now when i open the plugin I only get blank gray screens. I've tried deleting the org.apache.axis2.eclipse.codegen.plugin folder from my workspace plugins directory and even removing the org.apache.axis2.eclipse.service.plugin_1.6.0.jar and reinstalling but I still get the same blank screens. I'm using Eclipse Indigo now, I even went back to Eclipse Helios and the same problem occurred. Any suggestions?
This might help:
1) Shut down eclipse
2) Change into the workspace plugins folder (something like:
workspace/.metadata/.plugins/org.apache2.eclipse.service.plugin)
3) Delete the file there (called dialog-settings or something).
4) Then restart eclipse and try if it works.
Hope it works.
I find the solution occasionally. When you get a grey dialog, maximize it, and it will display correctly
Caused by: java.lang.ClassNotFoundException:
org.apache.axiom.om.impl.llom.factory.OMLinkedListMetaFactory
Looks like you need axiom library in your cp.
I used to have the same problem, I solved it by going to Axis Runtime configuration under Eclipse Settings then remove the path to axis2 runtime. Apply and re-set the runtime path. Apply and try again to use your plugin.
I found the answer. I had extracted the jar for the plugin into the plugins folder in the eclipse installation directory. I moved them to the dropins folder in the eclipse installation directory and restarted eclipse. It is working properly now.
UPDATE: The problem is back. I found it is printing an exception in the workspace log:
java.lang.ExceptionInInitializerError
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Unknown Source)
at org.apache.axis2.tool.service.eclipse.ui.ServiceXMLGenerationPage.updateTable(ServiceXMLGenerationPage.java:241)
at org.apache.axis2.tool.service.eclipse.ui.ServiceXMLGenerationPage.createControl(ServiceXMLGenerationPage.java:160)
at org.eclipse.jface.wizard.Wizard.createPageControls(Wizard.java:174)
at org.eclipse.jface.wizard.WizardDialog.createPageControls(WizardDialog.java:736)
at org.eclipse.jface.wizard.WizardDialog.setWizard(WizardDialog.java:1183)
at org.eclipse.jface.wizard.WizardDialog.updateForPage(WizardDialog.java:1242)
at org.eclipse.jface.wizard.WizardDialog.access$4(WizardDialog.java:1239)
at org.eclipse.jface.wizard.WizardDialog$8.run(WizardDialog.java:1228)
at org.eclipse.swt.custom.BusyIndicator.showWhile(BusyIndicator.java:70)
at org.eclipse.jface.wizard.WizardDialog.showPage(WizardDialog.java:1226)
at org.eclipse.jface.wizard.WizardDialog.nextPressed(WizardDialog.java:915)
at org.eclipse.jface.wizard.WizardDialog.buttonPressed(WizardDialog.java:428)
at org.eclipse.jface.dialogs.Dialog$2.widgetSelected(Dialog.java:624)
at org.eclipse.swt.widgets.TypedListener.handleEvent(TypedListener.java:240)
at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1053)
at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:4165)
at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3754)
at org.eclipse.jface.window.Window.runEventLoop(Window.java:825)
at org.eclipse.jface.window.Window.open(Window.java:801)
at org.eclipse.ui.internal.handlers.WizardHandler$New.executeHandler(WizardHandler.java:257)
at org.eclipse.ui.internal.handlers.WizardHandler.execute(WizardHandler.java:277)
at org.eclipse.ui.internal.handlers.HandlerProxy.execute(HandlerProxy.java:293)
at org.eclipse.core.commands.Command.executeWithChecks(Command.java:476)
at org.eclipse.core.commands.ParameterizedCommand.executeWithChecks(ParameterizedCommand.java:508)
at org.eclipse.ui.internal.handlers.HandlerService.executeCommand(HandlerService.java:169)
at org.eclipse.ui.internal.handlers.SlaveHandlerService.executeCommand(SlaveHandlerService.java:241)
at org.eclipse.ui.internal.actions.CommandAction.runWithEvent(CommandAction.java:157)
at org.eclipse.jface.action.ActionContributionItem.handleWidgetSelection(ActionContributionItem.java:584)
at org.eclipse.jface.action.ActionContributionItem.access$2(ActionContributionItem.java:501)
at org.eclipse.jface.action.ActionContributionItem$5.handleEvent(ActionContributionItem.java:411)
at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1053)
at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:4165)
at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3754)
at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:2696)
at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:2660)
at org.eclipse.ui.internal.Workbench.access$4(Workbench.java:2494)
at org.eclipse.ui.internal.Workbench$7.run(Workbench.java:674)
at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)
at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:667)
at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:149)
at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:123)
at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:196)
at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:110)
at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:79)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:344)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:179)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:622)
at org.eclipse.equinox.launcher.Main.basicRun(Main.java:577)
at org.eclipse.equinox.launcher.Main.run(Main.java:1410)
Caused by: org.apache.axiom.om.OMException: java.lang.ClassNotFoundException: org.apache.axiom.om.impl.llom.factory.OMLinkedListMetaFactory
at org.apache.axiom.om.OMAbstractFactory.getMetaFactory(OMAbstractFactory.java:139)
at org.apache.axiom.om.OMAbstractFactory.getOMFactory(OMAbstractFactory.java:152)
at com.gvr.fms.devcomm.interfacelayer.DevcommWebService.<clinit>(DevcommWebService.java:32)
... 57 more
Caused by: java.lang.ClassNotFoundException: org.apache.axiom.om.impl.llom.factory.OMLinkedListMetaFactory
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Unknown Source)
at org.apache.axiom.om.OMAbstractFactory.getMetaFactory(OMAbstractFactory.java:133)
... 59 more

How to install clojure-contrib on Windows?

I can't seem to find a way to launch the Clojure REPL with the contrib library included. If I understood the documentation correctly then this command should do it:
C:\clojure-1.1.0>"%ProgramFiles%\Java\jre6\bin\java.exe" -cp clojure.jar:clojure
-contrib.jar clojure.main
Exception in thread "main" java.lang.NoClassDefFoundError: clojure/main
Caused by: java.lang.ClassNotFoundException: clojure.main
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
Could not find the main class: clojure.main. Program will exit.
But as you can see, it fails. I did copy the clojure-contrib.jar to the C:\clojure-1.1.0 folder.
Can someone help me get it right?
Update
Thanks to MichaƂ's post I noticed that my error was using a colon where I had to use a semi-colon. This works:
C:\clojure-1.1.0>"%ProgramFiles%\Java\jre6\bin\java.exe" -cp clojure.jar;clojure-contrib.jar clojure.main
Clojure 1.1.0
user=>
(Answer updated to make the actual solution explicit, whereas it was somewhat hidden in the original...)
The classpath string on Windows uses ; as the separator. E.g.
java.exe -cp "C:\clojure-1.1.0\clojure.jar;C:\clojure-1.1.0\clojure-contrib.jar" clojure.main
Alternatively, you can use a wildcard to include all jars in the given directory in the classpath (that's a JDK 1.6 addition, wouldn't work with 1.5):
java.exe -cp "C:\clojure-1.1.0\*" clojure.main
(I think using double quotes here is ok in Windows, can't check though...)