java.lang.NoClassDefFoundError when creating proxy - java

When i try to create web service proxy in java i always get. I look to web service but it works, i can invoke it. Why i can not create proxy?
java.lang.NoClassDefFoundError:
xxx/GetBibliografijeXml
(wrong name:
xxx/GetBibliografijeXML)
at
java.lang.ClassLoader.defineClass1(Native
Method) at
java.lang.ClassLoader.defineClass(ClassLoader.java:620)
at
java.security.SecureClassLoader.defineClass(SecureClassLoader.java:124)
at
java.net.URLClassLoader.defineClass(URLClassLoader.java:260)
at
java.net.URLClassLoader.access$100(URLClassLoader.java:56)
at
java.net.URLClassLoader$1.run(URLClassLoader.java:195)
at
java.security.AccessController.doPrivileged(Native
Method) at
java.net.URLClassLoader.findClass(URLClassLoader.java:188)
at
java.lang.ClassLoader.loadClass(ClassLoader.java:306)
at
java.lang.ClassLoader.loadClass(ClassLoader.java:251)
at
oracle.j2ee.ws.common.processor.modeler.wsdl.SchemaAnalyzer.getValueClassBeanInfo(SchemaAnalyzer.java:465)
at
oracle.j2ee.ws.common.processor.modeler.wsdl.ComplexTypeBindingModeler.structuredType(ComplexTypeBindingModeler.java:142)
at
oracle.j2ee.ws.common.processor.modeler.wsdl.ComplexTypeBindingModeler.complexType(ComplexTypeBindingModeler.java:442)
at
oracle.j2ee.ws.common.processor.modeler.wsdl.LiteralSchemaTypeModeler.complexType(LiteralSchemaTypeModeler.java:495)
at
oracle.j2ee.ws.common.processor.modeler.wsdl.LiteralSchemaTypeModeler.schemaType(LiteralSchemaTypeModeler.java:373)
at
oracle.j2ee.ws.common.processor.modeler.wsdl.LiteralSchemaTypeModeler.globalElement(LiteralSchemaTypeModeler.java:446)
at
oracle.j2ee.ws.common.processor.modeler.wsdl.SchemaAnalyzer.schemaElementTypeToLiteralType(SchemaAnalyzer.java:403)
at
oracle.j2ee.ws.common.processor.modeler.wsdl.OperationModeler.getElementTypeToLiteralType(OperationModeler.java:588)
at
oracle.j2ee.ws.common.processor.modeler.wsdl.DocLiteralOperationModeler.buildInput(DocLiteralOperationModeler.java:527)
at
oracle.j2ee.ws.common.processor.modeler.wsdl.DocLiteralOperationModeler.buildOperation(DocLiteralOperationModeler.java:256)
at
oracle.j2ee.ws.common.processor.modeler.wsdl.OperationModeler.process(OperationModeler.java:93)
at
oracle.j2ee.ws.common.processor.modeler.wsdl.WSDLModeler.processSOAPOperation(WSDLModeler.java:1086)
at
oracle.j2ee.ws.common.processor.modeler.wsdl.WSDLModeler.processBindingOperation(WSDLModeler.java:1020)
at
oracle.j2ee.ws.common.processor.modeler.wsdl.WSDLModeler.createNewPort(WSDLModeler.java:884)
at
oracle.j2ee.ws.common.processor.modeler.wsdl.WSDLModeler.processPort(WSDLModeler.java:757)
at
oracle.j2ee.ws.common.processor.modeler.wsdl.WSDLModeler.processService(WSDLModeler.java:671)
at
oracle.j2ee.ws.common.processor.modeler.wsdl.WSDLModeler.internalBuildModel(WSDLModeler.java:396)
at
oracle.j2ee.ws.common.processor.modeler.wsdl.WSDLModeler.buildModel(WSDLModeler.java:215)
at
oracle.j2ee.ws.common.processor.config.ModelInfo.buildModel(ModelInfo.java:173)
at
oracle.j2ee.ws.common.processor.Processor.runModeler(Processor.java:72)
at
oracle.j2ee.ws.tools.wsa.AssemblerTool.run(AssemblerTool.java:95)
at
oracle.j2ee.ws.tools.wsa.WsdlToJavaTool.createProxy(WsdlToJavaTool.java:356)
at
oracle.j2ee.ws.tools.wsa.Util.createProxy(Util.java:838)
at
oracle.jdeveloper.webservices.model.proxy.ProxyGenerator.doGeneration(ProxyGenerator.java:553)
at
oracle.jdeveloper.webservices.model.proxy.ProxyGenerator.generateImpl(ProxyGenerator.java:365)
at
oracle.jdeveloper.webservices.model.proxy.ProxyGenerator.mav$generateImpl(ProxyGenerator.java:77)
at
oracle.jdeveloper.webservices.model.proxy.ProxyGenerator$1ThrowingRunnable.run(ProxyGenerator.java:206)
at
oracle.jdeveloper.webservices.model.GeneratorUI$GeneratorAction.run(GeneratorUI.java:446)
at
oracle.ide.dialogs.ProgressBar.run(ProgressBar.java:551)
at
java.lang.Thread.run(Thread.java:595)

Well, it looks like something is using the wrong case:
java.lang.NoClassDefFoundError: xxx/GetBibliografijeXml
(wrong name: xxx/GetBibliografijeXML)
Note the casing of "XML".
Check everywhere that the name is used, and make sure the case is consistent everywhere. Is the class an autogenerated one, or one you've written yourself?
Also bear in mind that if you're on a case-insensitive operating system and the classes are being loaded straight from disk (without coming from a jar file etc), it could be finding an old class file - you won't be able to have two classes whose names differ only in case on such a file system, as the class files will clash. If your WSDL uses both cases, it may have generated two classes, but then you only end up with one file on disk :(

Related

Apache beam wildcard recursive search for files

I am using Spotify's Scio library for writing apache beam pipelines in scala. I want to search for files under a directory in a recursive way on a filesystem which can be hdfs, alluxio or GCS. Like *.jar should find all the files under the provided directory and sub-directories.
Apache beam sdk provided org.apache.beam.sdk.io.FileIO class for such purpose where I can find files on one directory level using pipeline.apply(FileIO.match().filepattern(filesPattern)).
How can I make it recursive to search for all files matching the provided pattern?
Currently, I am trying another approach, where I am creating resourceId of the provided pattern and getting current directory of the provided pattern, then I am trying to resolve all sub-directories in the current directory using resourceId.resolve() method. But it is throwing an exception for it.
val currentDir = FileSystems.matchNewResource(filesPattern, false).getCurrentDirectory
val childDir = currentDir.resolve("{#literal *}", StandardResolveOptions.RESOLVE_DIRECTORY)
For currentDir.resolve I am getting following exception:
------------------------------------------------------------
The program finished with the following exception:
org.apache.flink.client.program.ProgramInvocationException: The main method caused an error.
at org.apache.flink.client.program.PackagedProgram.callMainMethod(PackagedProgram.java:546)
at org.apache.flink.client.program.PackagedProgram.invokeInteractiveModeForExecution(PackagedProgram.java:421)
at org.apache.flink.client.program.ClusterClient.run(ClusterClient.java:427)
at org.apache.flink.client.cli.CliFrontend.executeProgram(CliFrontend.java:813)
at org.apache.flink.client.cli.CliFrontend.runProgram(CliFrontend.java:287)
at org.apache.flink.client.cli.CliFrontend.run(CliFrontend.java:213)
at org.apache.flink.client.cli.CliFrontend.parseParameters(CliFrontend.java:1050)
at org.apache.flink.client.cli.CliFrontend.lambda$main$11(CliFrontend.java:1126)
at java.security.AccessController.doPrivileged(Native Method)
at javax.security.auth.Subject.doAs(Subject.java:422)
at org.apache.hadoop.security.UserGroupInformation.doAs(UserGroupInformation.java:1836)
at org.apache.flink.runtime.security.HadoopSecurityContext.runSecured(HadoopSecurityContext.java:41)
at org.apache.flink.client.cli.CliFrontend.main(CliFrontend.java:1126)
Caused by: java.lang.IllegalArgumentException: Illegal character in path at index 0: {#literal *}/
at java.net.URI.create(URI.java:852)
at java.net.URI.resolve(URI.java:1036)
at org.apache.beam.sdk.io.hdfs.HadoopResourceId.resolve(HadoopResourceId.java:46)
at com.sparkcognition.foundation.ingest.jobs.copyjob.FileOperations$.findFiles(BinaryFilesSink.scala:110)
at com.sparkcognition.foundation.ingest.jobs.copyjob.BinaryFilesSink$.main(BinaryFilesSink.scala:39)
at com.sparkcognition.foundation.ingest.jobs.copyjob.BinaryFilesSink.main(BinaryFilesSink.scala)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.apache.flink.client.program.PackagedProgram.callMainMethod(PackagedProgram.java:529)
... 12 more
Caused by: java.net.URISyntaxException: Illegal character in path at index 0: {#literal *}/
at java.net.URI$Parser.fail(URI.java:2848)
at java.net.URI$Parser.checkChars(URI.java:3021)
at java.net.URI$Parser.parseHierarchical(URI.java:3105)
at java.net.URI$Parser.parse(URI.java:3063)
at java.net.URI.<init>(URI.java:588)
at java.net.URI.create(URI.java:850)
... 22 more
Please suggest what should be the right way to search for files recursively using apache beam?
References:
https://beam.apache.org/releases/javadoc/2.11.0/index.html?org/apache/beam/sdk/io/fs/ResourceId.html
It looks like you have some code copied from some faulty javadoc. Some old versions of the example code were published with errors around the asterisks.
To find all files inside currentDir:
val childDir = currentDir.resolve("**", StandardResolveOptions.RESOLVE_FILES)

Weka DiscriminantAnalysis NoClassDefFoundError

I'm trying to use MultiClassFLDA in discriminant analysis package but I always get an error on running the code and defining a new instance of the MultiClassFLDA class
Exception in thread "main" java.lang.NoClassDefFoundError: no/uib/cipr/matrix/Vector
at assignment2.face.tryLDA(face.java:141)
at assignment2.Assignment2.main(Assignment2.java:106)
Caused by: java.lang.ClassNotFoundException: no.uib.cipr.matrix.Vector
at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:331)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
It seems to be linked to some dynamic class loading in newer versions of Weka, presumably within the Weka Package Manager: that class is defined in the mtj.jar, which is bundled inside weka.jar. In that other question, an answer suggested to extract the mtj.jar and add it to your classpath.
As I didn't have this problem with other Filters, my guess is that MultiClassFLDA is not implemented correctly: I found out is that if you use another Filter before, that specific class will get loaded:
// Run a dummy Filter for correct initialization
Filter f = new Standardize();
f.setInputFormat(data);
Filter.useFilter(new Instances("", params, 0), f); // Dummy run on empty dataset
// Now run the MultiClassFLDA
f = new MultiClassFLDA();
f.setInputFormat(data);
data = Filter.useFilter(data, f);
N.B. that is a really ugly hack! I used it to be able to work. I'll edit my answer when I find the appropriate way to do it (other than extracting the jar from Weka itslef).

org.openide.util.RequestProcessor$SlowItem exception in basic NetBeans plugin

I followed a tutorial to build a simple plugin for NetBeans v 7.3.1 ... I know this is an older version of NetBeans but I'm restricted by the software my employer insists on using.
All I have is a simple plugin that loads a toolbar item that consists of a button. But when I run the plugin, I always get the same exception alert in a popup:
A org.openide.util.RequestProcessor$SlowItem exception has occurred.
Please report this at [blah blah website blah blah log file created]
This message hasn't been helpful solving the problem. Here is the log file, which as a Java n00b I've been unable to decipher or understand what is going on in it well enough to figure out why I'm getting this error. And there's little to no info I've been able to find in searches. If I'm reading it right (I'm sure I'm not reading it right) then the error is happening in .jar files where I can't do anything about it. So is there anything I can hope to do to ship a plugin that will run without throwing exceptions? Workaround? Something stupid I missed as a n00b?
SEVERE [org.openide.util.RequestProcessor]: Error in RequestProcessor org.openide.loaders.FolderInstance$1R
java.lang.NullPointerException
at org.openide.util.Exceptions$AnnException.getMessage(Exceptions.java:238)
at org.openide.util.Exceptions$AnnException.toString(Exceptions.java:321)
at java.util.Objects.toString(Objects.java:159)
at java.lang.Throwable.initCause(Throwable.java:457)
at org.openide.util.Exceptions$AnnException.findOrCreate0(Exceptions.java:279)
at org.openide.util.Exceptions$AnnException.findOrCreate0(Exceptions.java:286)
at org.openide.util.Exceptions$AnnException.findOrCreate0(Exceptions.java:286)
at org.openide.util.Exceptions$AnnException.findOrCreate0(Exceptions.java:286)
at org.openide.util.Exceptions$AnnException.findOrCreate0(Exceptions.java:286)
at org.openide.util.Exceptions$AnnException.findOrCreate(Exceptions.java:256)
at org.openide.util.Exceptions.attachMessage(Exceptions.java:85)
at org.openide.loaders.InstanceSupport.instanceClass(InstanceSupport.java:157)
at org.openide.loaders.InstanceDataObject$Ser.instanceClass(InstanceDataObject.java:1338)
at org.openide.loaders.InstanceDataObject.instanceClass(InstanceDataObject.java:809)
at org.openide.awt.MenuBar$LazyMenu$MenuFolder.acceptCookie(MenuBar.java:808)
at org.openide.loaders.FolderInstance.acceptDataObject(FolderInstance.java:419)
at org.openide.loaders.FolderInstance.defaultProcessObjects(FolderInstance.java:795)
at org.openide.loaders.FolderInstance.access$000(FolderInstance.java:103)
at org.openide.loaders.FolderInstance$1R.init(FolderInstance.java:693)
at org.openide.loaders.FolderInstance$1R.run(FolderInstance.java:720)
Caused: org.openide.util.RequestProcessor$SlowItem: task failed due to
at org.openide.util.RequestProcessor$Task.schedule(RequestProcessor.java:1473)
at org.openide.loaders.FolderInstance.processObjects(FolderInstance.java:768)
at org.openide.loaders.FolderInstance$Listener.finished(FolderInstance.java:1052)
at org.openide.loaders.FolderList.createBoth(FolderList.java:923)
at org.openide.loaders.FolderList.getObjects(FolderList.java:608)
at org.openide.loaders.FolderList.access$200(FolderList.java:77)
at org.openide.loaders.FolderList$ListTask.computeResult(FolderList.java:1007)
at org.openide.loaders.FolderList$ListTask.run(FolderList.java:983)
at org.openide.util.RequestProcessor$Task.run(RequestProcessor.java:1432)
[catch] at org.openide.util.RequestProcessor$Processor.run(RequestProcessor.java:2044)
WARNING [org.netbeans.ProxyClassLoader]: Will not load class org.netbeans.modules.editor.NbCodeFoldingAction arbitrarily from one of ModuleCL#183d64f7[org.netbeans.modules.editor] and ModuleCL#52954826[com.mycompany.TrestleLauncher] starting from SystemClassLoader[263 modules]; see http://wiki.netbeans.org/DevFaqModuleCCE
INFO [org.openide.loaders.FolderInstance.Menu.View]
Cannot get class for MultiFileObject#26bf742[Menu/View/org-netbeans-modules-editor-NbCodeFoldingAction.instance] defined by [jar:file:/C:/Program%20Files/NetBeans%207.3.1/ide/modules/org-netbeans-modules-editor.jar!/org/netbeans/modules/editor/resources/layer.xml]
Cannot get class for MultiFileObject#26bf742[Menu/View/org-netbeans-modules-editor-NbCodeFoldingAction.instance] defined by [jar:file:/C:/Program%20Files/NetBeans%207.3.1/ide/modules/org-netbeans-modules-editor.jar!/org/netbeans/modules/editor/resources/layer.xml]
Caused: java.lang.NullPointerException
at org.openide.util.Exceptions$AnnException.getMessage(Exceptions.java:238)
at org.openide.util.Exceptions$AnnException.toString(Exceptions.java:321)
at java.util.Objects.toString(Objects.java:159)
at java.lang.Throwable.initCause(Throwable.java:457)
at org.openide.util.Exceptions$AnnException.findOrCreate0(Exceptions.java:279)
at org.openide.util.Exceptions$AnnException.findOrCreate(Exceptions.java:256)
at org.openide.util.Exceptions.attachMessage(Exceptions.java:85)
at org.openide.loaders.InstanceSupport.findClass(InstanceSupport.java:506)
at org.openide.loaders.InstanceSupport.instanceClass(InstanceSupport.java:148)
Caused: java.lang.ClassNotFoundException: From file: MultiFileObject#26bf742[Menu/View/org-netbeans-modules-editor-NbCodeFoldingAction.instance] due to
at org.openide.loaders.InstanceSupport.instanceClass(InstanceSupport.java:162)
at org.openide.loaders.InstanceDataObject$Ser.instanceClass(InstanceDataObject.java:1338)
at org.openide.loaders.InstanceDataObject.instanceClass(InstanceDataObject.java:809)
at org.openide.awt.MenuBar$LazyMenu$MenuFolder.acceptCookie(MenuBar.java:808)
[catch] at org.openide.loaders.FolderInstance.acceptDataObject(FolderInstance.java:419)
at org.openide.loaders.FolderInstance.defaultProcessObjects(FolderInstance.java:795)
at org.openide.loaders.FolderInstance.access$000(FolderInstance.java:103)
at org.openide.loaders.FolderInstance$1R.init(FolderInstance.java:693)
at org.openide.loaders.FolderInstance$1R.run(FolderInstance.java:720)
at org.openide.util.RequestProcessor$Task.run(RequestProcessor.java:1432)
at org.openide.util.RequestProcessor$Processor.run(RequestProcessor.java:2044)
ALL [null]: Cannot get class for MultiFileObject#26bf742[Menu/View/org-netbeans-modules-editor-NbCodeFoldingAction.instance] defined by [jar:file:/C:/Program%20Files/NetBeans%207.3.1/ide/modules/org-netbeans-modules-editor.jar!/org/netbeans/modules/editor/resources/layer.xml]
WARNING [org.netbeans.modules.editor.settings.storage.keybindings.KeyMapsStorage]: The keybinding 'A-MOUSE_WHEEL_UP' in Editors/Keybindings/NetBeans/Defaults/org-netbeans-modules-editor-keybindings.xml may not work correctly on Mac. Keybindings starting with Alt or Ctrl should be coded with latin capital letters 'O' or 'D' respectively. For details see org.openide.util.Utilities.stringToKey().
WARNING [org.netbeans.modules.editor.settings.storage.keybindings.KeyMapsStorage]: The keybinding 'A-MOUSE_WHEEL_DOWN' in Editors/Keybindings/NetBeans/Defaults/org-netbeans-modules-editor-keybindings.xml may not work correctly on Mac. Keybindings starting with Alt or Ctrl should be coded with latin capital letters 'O' or 'D' respectively. For details see org.openide.util.Utilities.stringToKey().
WARNING [org.netbeans.ProxyClassLoader]: Will not load class org.netbeans.modules.editor.MainMenuAction$GoToSourceAction arbitrarily from one of ModuleCL#183d64f7[org.netbeans.modules.editor] and ModuleCL#52954826[com.mycompany.TrestleLauncher] starting from SystemClassLoader[263 modules]; see http://wiki.netbeans.org/DevFaqModuleCCE
INFO [org.openide.loaders.FolderInstance.Menu.GoTo]
Cannot get class for MultiFileObject#7e5308ff[Menu/GoTo/org-netbeans-modules-editor-MainMenuAction$GoToSourceAction.instance] defined by [jar:file:/C:/Program%20Files/NetBeans%207.3.1/ide/modules/org-netbeans-modules-editor.jar!/org/netbeans/modules/editor/resources/layer.xml]
Cannot get class for MultiFileObject#7e5308ff[Menu/GoTo/org-netbeans-modules-editor-MainMenuAction$GoToSourceAction.instance] defined by [jar:file:/C:/Program%20Files/NetBeans%207.3.1/ide/modules/org-netbeans-modules-editor.jar!/org/netbeans/modules/editor/resources/layer.xml]
Caused: java.lang.NullPointerException
at org.openide.util.Exceptions$AnnException.getMessage(Exceptions.java:238)
at org.openide.util.Exceptions$AnnException.toString(Exceptions.java:321)
at java.util.Objects.toString(Objects.java:159)
at java.lang.Throwable.initCause(Throwable.java:457)
at org.openide.util.Exceptions$AnnException.findOrCreate0(Exceptions.java:279)
at org.openide.util.Exceptions$AnnException.findOrCreate(Exceptions.java:256)
at org.openide.util.Exceptions.attachMessage(Exceptions.java:85)
at org.openide.loaders.InstanceSupport.findClass(InstanceSupport.java:506)
at org.openide.loaders.InstanceSupport.instanceClass(InstanceSupport.java:148)
Caused: java.lang.ClassNotFoundException: From file: MultiFileObject#7e5308ff[Menu/GoTo/org-netbeans-modules-editor-MainMenuAction$GoToSourceAction.instance] due to
at org.openide.loaders.InstanceSupport.instanceClass(InstanceSupport.java:162)
at org.openide.loaders.InstanceDataObject$Ser.instanceClass(InstanceDataObject.java:1338)
at org.openide.loaders.InstanceDataObject.instanceClass(InstanceDataObject.java:809)
at org.openide.awt.MenuBar$LazyMenu$MenuFolder.acceptCookie(MenuBar.java:808)
[catch] at org.openide.loaders.FolderInstance.acceptDataObject(FolderInstance.java:419)
at org.openide.loaders.FolderInstance.defaultProcessObjects(FolderInstance.java:795)
at org.openide.loaders.FolderInstance.access$000(FolderInstance.java:103)
at org.openide.loaders.FolderInstance$1R.init(FolderInstance.java:693)
at org.openide.loaders.FolderInstance$1R.run(FolderInstance.java:720)
at org.openide.util.RequestProcessor$Task.run(RequestProcessor.java:1432)
at org.openide.util.RequestProcessor$Processor.run(RequestProcessor.java:2044)
ALL [null]: Cannot get class for MultiFileObject#7e5308ff[Menu/GoTo/org-netbeans-modules-editor-MainMenuAction$GoToSourceAction.instance] defined by [jar:file:/C:/Program%20Files/NetBeans%207.3.1/ide/modules/org-netbeans-modules-editor.jar!/org/netbeans/modules/editor/resources/layer.xml]
WARNING [org.netbeans.ProxyClassLoader]: Will not load class org.netbeans.modules.editor.MainMenuAction$GoToSuperAction arbitrarily from one of ModuleCL#183d64f7[org.netbeans.modules.editor] and ModuleCL#52954826[com.mycompany.TrestleLauncher] starting from SystemClassLoader[263 modules]; see http://wiki.netbeans.org/DevFaqModuleCCE
INFO [org.openide.loaders.FolderInstance.Menu.GoTo]
Cannot get class for MultiFileObject#210198eb[Menu/GoTo/org-netbeans-modules-editor-MainMenuAction$GoToSuperAction.instance] defined by [jar:file:/C:/Program%20Files/NetBeans%207.3.1/ide/modules/org-netbeans-modules-editor.jar!/org/netbeans/modules/editor/resources/layer.xml]
Cannot get class for MultiFileObject#210198eb[Menu/GoTo/org-netbeans-modules-editor-MainMenuAction$GoToSuperAction.instance] defined by [jar:file:/C:/Program%20Files/NetBeans%207.3.1/ide/modules/org-netbeans-modules-editor.jar!/org/netbeans/modules/editor/resources/layer.xml]
Caused: java.lang.NullPointerException
at org.openide.util.Exceptions$AnnException.getMessage(Exceptions.java:238)
at org.openide.util.Exceptions$AnnException.toString(Exceptions.java:321)
at java.util.Objects.toString(Objects.java:159)
at java.lang.Throwable.initCause(Throwable.java:457)
at org.openide.util.Exceptions$AnnException.findOrCreate0(Exceptions.java:279)
at org.openide.util.Exceptions$AnnException.findOrCreate(Exceptions.java:256)
at org.openide.util.Exceptions.attachMessage(Exceptions.java:85)
at org.openide.loaders.InstanceSupport.findClass(InstanceSupport.java:506)
at org.openide.loaders.InstanceSupport.instanceClass(InstanceSupport.java:148)
Caused: java.lang.ClassNotFoundException: From file: MultiFileObject#210198eb[Menu/GoTo/org-netbeans-modules-editor-MainMenuAction$GoToSuperAction.instance] due to
at org.openide.loaders.InstanceSupport.instanceClass(InstanceSupport.java:162)
at org.openide.loaders.InstanceDataObject$Ser.instanceClass(InstanceDataObject.java:1338)
at org.openide.loaders.InstanceDataObject.instanceClass(InstanceDataObject.java:809)
at org.openide.awt.MenuBar$LazyMenu$MenuFolder.acceptCookie(MenuBar.java:808)
[catch] at org.openide.loaders.FolderInstance.acceptDataObject(FolderInstance.java:419)
at org.openide.loaders.FolderInstance.defaultProcessObjects(FolderInstance.java:795)
at org.openide.loaders.FolderInstance.access$000(FolderInstance.java:103)
at org.openide.loaders.FolderInstance$1R.init(FolderInstance.java:693)
at org.openide.loaders.FolderInstance$1R.run(FolderInstance.java:720)
at org.openide.util.RequestProcessor$Task.run(RequestProcessor.java:1432)
at org.openide.util.RequestProcessor$Processor.run(RequestProcessor.java:2044)
ALL [null]: Cannot get class for MultiFileObject#210198eb[Menu/GoTo/org-netbeans-modules-editor-MainMenuAction$GoToSuperAction.instance] defined by [jar:file:/C:/Program%20Files/NetBeans%207.3.1/ide/modules/org-netbeans-modules-editor.jar!/org/netbeans/modules/editor/resources/layer.xml]
WARNING [org.openide.filesystems.Ordering]: Not all children in Menu/Window/ marked with the position attribute: [Other], but some are: [org-netbeans-modules-project-ui-logical-tab-action.shadow, org-netbeans-modules-project-ui-physical-tab-action.shadow, org-netbeans-modules-favorites-View.shadow, org-netbeans-core-ide-ServicesTabAction.shadow, org-netbeans-modules-tasklist-ui-TaskListAction.shadow, ShowPaletteAction.shadow, org-netbeans-core-windows-actions-GlobalPropertiesAction.shadow, Output, Navigator, Debug, Versioning, Web, SwitchToRecentDocumentAction.shadow, ProgressListAction.shadow, Separator3.instance, ConfigureWindow, org-netbeans-core-windows-actions-ResetWindowsAction.shadow, Separator4.instance, CloseWindowAction.shadow, CloseAllDocumentsAction.shadow, CloseAllButThisAction.shadow, DocumentsAction.shadow]
WARNING [org.netbeans.TopSecurityManager]: use of system property netbeans.user has been obsoleted in favor of InstalledFileLocator/Places at org.netbeans.modules.uihandler.Installer.logsDirectory(Installer.java:840)
INFO [org.netbeans.core.netigso.Netigso]: bundle org.eclipse.osgi#3.8.0.v20120529-1548 256
INFO [org.netbeans.core.netigso.Netigso]: bundle org.eclipse.osgi#3.8.0.v20120529-1548 stopped
INFO [org.netbeans.core.netigso.Netigso]: bundle org.eclipse.osgi#3.8.0.v20120529-1548 stopped
This seems to have been a result of adding a library package via Wrapped .JAR that didn't need to be added (or more accurately, needed to be added using a more correct method). Instead of finding, downloading, and depending on Wrapped .JAR files to account for dependencies, I needed to add module dependencies by name (not by package) in NetBeans.

Unable to create a model class in Jena Library for Parsing or Extratcting URIS from RDF?XML page

I have wriitten following code using the Jena Library to print the URIs on a web page but it is showing a error. The code is
public static void test(String url)
{
try
{
System.out.println("to go");
Model read = ModelFactory.createDefaultModel().read(url);
System.out.println("to go");
StmtIterator si=read.listStatements();
System.out.println("to go");
while(si.hasNext())
{
Statement s=si.nextStatement();
Resource r=s.getSubject();
Property p=s.getPredicate();
RDFNode o=s.getObject();
System.out.println(r.getURI());
System.out.println(p.getURI());
System.out.println(o.asResource().getURI());
}
}
catch(JenaException | NoSuchElementException c)
{ }
}
Can anyone help me further with this problem???
It is not able to create a model read object. The URL is a web address of a xml page.
the following error occurs:
Exception in thread "main" java.lang.NoClassDefFoundError: org/slf4j/LoggerFactory
at com.hp.hpl.jena.util.Metadata.<clinit>(Metadata.java:39)
at com.hp.hpl.jena.JenaRuntime.<clinit>(JenaRuntime.java:37)
at com.hp.hpl.jena.rdf.model.impl.RDFReaderFImpl.<clinit>(RDFReaderFImpl.java:74)
at com.hp.hpl.jena.rdf.model.impl.ModelCom.<clinit>(ModelCom.java:54)
at com.hp.hpl.jena.rdf.model.ModelFactory.createDefaultModel(ModelFactory.java:142)
at com.hp.hpl.jena.rdf.model.ModelFactory.createDefaultModel(ModelFactory.java:136)
at web.crawler.WebCrawler.test(WebCrawler.java:52)
at web.crawler.WebCrawler.main(WebCrawler.java:98)
Caused by: java.lang.ClassNotFoundException: org.slf4j.LoggerFactory
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)
Add all the jars in the lib/ directory of the distribution. You can use the lib/* form for the classpath.
if you then still get missing org.w3c.dom.ElementTraversal (which is in xml-apis), it's because you have an older version of Xerces and old xml-apis.
java.lang.NoClassDefFoundError: org/slf4j/LoggerFactory
the library slf4j*.jar is missing from your classpath.
Following are the libraries I had to add more:
import org.slf4j.*;
import org.apache.xerces.util.XMLChar;
import org.w3c.dom.ElementTraversal;
import org.apache.jena.iri.IRIFactory;
I solved it adding all the libraries availables at jena lib dir.
I gess Jena need another lib or jar file, but I dont know the especific .jar, so I add all of them.
Then it works!

InvalidClassException : class invalid for deserialization

I am using SSA parser library in my project. When I invoke main method of one of it's class using command prompt it works fine on my machine.
I execute following command from command prompt :
java -Xmx800M -cp %1 edu.stanford.nlp.parser.lexparser.LexicalizedParser -retainTMPSubcategories -outputFormat "penn,typedDependenciesCollapsed" englishPCFG.ser.gz %2
But when I tried to use the same class in my java program, I am getting Caused by: java.io.InvalidClassException: edu.stanford.nlp.stats.Counter; edu.stanford.nlp.stats.Counter; class invalid for deserialization exception.
Following line throws error :
LexicalizedParser _parser = new LexicalizedParser("C:\englishPCFG.ser.gz");
This englishPCFG.ser.gz file contains some classes or information which gets loaded when creating object of type LexicalizedParser.
Following is the stacktrace :
Loading parser from serialized file C:\englishPCFG.ser.gz ...
Exception in thread "main" java.lang.RuntimeException: Invalid class in file: C:\englishPCFG.ser.gz
at edu.stanford.nlp.parser.lexparser.LexicalizedParser.getParserDataFromSerializedFile(LexicalizedParser.java:822)
at edu.stanford.nlp.parser.lexparser.LexicalizedParser.getParserDataFromFile(LexicalizedParser.java:603)
at edu.stanford.nlp.parser.lexparser.LexicalizedParser.<init>(LexicalizedParser.java:168)
at edu.stanford.nlp.parser.lexparser.LexicalizedParser.<init>(LexicalizedParser.java:154)
at com.tcs.srl.ssa.SSAInvoker.<init>(SSAInvoker.java:21)
at com.tcs.srl.ssa.SSAInvoker.main(SSAInvoker.java:53)
Caused by: java.io.InvalidClassException: edu.stanford.nlp.stats.Counter; edu.stanford.nlp.stats.Counter; class invalid for deserialization
at java.io.ObjectStreamClass.checkDeserialize(Unknown Source)
at java.io.ObjectInputStream.readOrdinaryObject(Unknown Source)
at java.io.ObjectInputStream.readObject0(Unknown Source)
at java.io.ObjectInputStream.defaultReadFields(Unknown Source)
at java.io.ObjectInputStream.readSerialData(Unknown Source)
at java.io.ObjectInputStream.readOrdinaryObject(Unknown Source)
at java.io.ObjectInputStream.readObject0(Unknown Source)
at java.io.ObjectInputStream.defaultReadFields(Unknown Source)
at java.io.ObjectInputStream.readSerialData(Unknown Source)
at java.io.ObjectInputStream.readOrdinaryObject(Unknown Source)
at java.io.ObjectInputStream.readObject0(Unknown Source)
at java.io.ObjectInputStream.readObject(Unknown Source)
at edu.stanford.nlp.parser.lexparser.LexicalizedParser.getParserDataFromSerializedFile(LexicalizedParser.java:814)
... 5 more
Caused by: java.io.InvalidClassException: edu.stanford.nlp.stats.Counter; class invalid for deserialization
at java.io.ObjectStreamClass.initNonProxy(Unknown Source)
at java.io.ObjectInputStream.readNonProxyDesc(Unknown Source)
at java.io.ObjectInputStream.readClassDesc(Unknown Source)
... 17 more
I am new to Java world so I dont to why this error is coming and what should I do to avoid it.
I googled for this error then I found out that this error comes because of some version mismatch which I think is something similar to dll hell of windows API. Am I correct?
Anyone knows why this kind of error comes? and what should we do to avoid it?
Please enlighten !!!
It could be because the serialVersionUID of the classe has changed, and you are trying to read an object that was written with another version of the class.
You can force the version number by déclaring a serialVersionUID in your serializable class:
private static final long serialVersionUID = 1L;
The java word for dll hell is classpath hell ;-) But that's not your hell anyway.
Object serialization is a process of persisting java objects to files (or streams). The output format is binary. Deserialization (iaw: making java objects from serialized data) requires the same versions of the classes.
So it is possible, that you simply use an older or newer version of that Counter class. This input file should be shipped with a documentation that clearly says, which version of the parser is required. I'd investigate in that direction first.
OT: For the sake of completeness I ran into InvalidClassException ... class invalid for deserialization (and this question) when solving another problem.
(Since edu.stanford.nlp.stats.Counter is not anonymous, the case in this question is certainly not the same case as mine.)
I was sending a serialized class from server to client, the class had two anonymous classes. The jar with these classes was shared among server and client but for server it was compiled in Eclipse JDT, for client in javac. Compilers generated different ordering of names $1, $2 for anonymous classes, hence instance of $1 was sent by server but could not be received as $1 at client side. More info in blogpost (in Czech, though example is obvious).
Try using serialVer to generate the serialID of your old classes that you're trying to de-serialize and add it explicitly (private static final long serialVersionUID = (insert number from serialVer here)L;) in the new versions of the class. If you change anything in a class serialized and you haven't setted the serialID, java thinks the class you've serialized isn't compatible with the new one.
This error suggests that the serialized objects within C:\englishPCFG.ser.gz were serialized with using a older or newer definition of the class which unfortunately is different in such a way that it breaks the terms of compatible serialization from one version to another.
Please see http://download.oracle.com/javase/1.4.2/docs/api/java/io/InvalidClassException.html
Can you check to see when this file was produced and then if possible locate the version of the SSAParser library at the time of it's creation?

Categories

Resources