I've created a custom file system for use in Sytlus Studio, following the Javadoc instructions and using the JavaFileSystem sample code as an example. I have my code working to the point where I can browse the directory structure of my repository (the custom file system), but when I go to open an xml document, I get the error:
java.lang.NoSuchMethodError: <init>
Apparently the JVM cannot instantiate some object. I've stripped my code down to the bare minimum, essentially stubbing out calls into my API, and added logger.info() calls to all the methods, but alas I cannot track down the issue. What is the best way to see under the hood and discover what call/instantiation is causing this issue?
I can help you with this problem. Can you give us some more info?
What version of Stylus Studio are you using?
Did you look in the Stylus Studio output window for error messages (menu View->Output Window)?
Did the NoSuchMethodError show up in a dialog box with a [Show Details] button? Ifso, what are the details.
Does your StylusFile implementation have a public constructor with a single String argument? (probably yes, or you wouldn’t be able to browse the directory structure)
Assuming you have already covered the above issues, I would try these things:
- Make sure your StylusFile implementation works in-vitro, that is outside Stylus Studio as a standalone program with some sort of test driver.
- Your StylusFile implemention is running in its own class loader. You have to define the classpath in the Stylus Studio Options menu.
- Where is the NoSuchMethodError being reported?
>Did you look in the Stylus
>Studio output window for error
>messages (menu View->Output
>Window)?
Yes, the only information I see there is the output of my logger.info() calls.
>Did the NoSuchMethodError show
>up in a dialog box with a
>[Show Details] button? Ifso,
>what are the details.
The error dialog only showed "<init>". The Show Details reveals:
java.lang.NoSuchMethodError: <init>
>Does your StylusFile
>implementation have a public
>constructor with a single
>String argument? (probably
>yes, or you wouldn’t be able
>to browse the directory
>structure)
Yes it does.
>
>Assuming you have already
>covered the above issues, I
>would try these things:
>- Make sure your StylusFile
>implementation works in-vitro,
>that is outside Stylus Studio
>as a standalone program with
>some sort of test driver.
I've successfully used my code through the StylusFileFactory class. I assumed that's a legit method for verifying the code.
>- Your StylusFile implemention
>is running in its own class
>loader. You have to define
>the classpath in the Stylus
>Studio Options menu.
I have put my jar file (with the custom file system as well as the code to access the repository) in the classpath (based on your suggestion) with no change. Based on the results of the test above, though, I suspect this may be where the problem may be.
>- Where is the
>NoSuchMethodError being
>reported?
When you said you put your jar in the classpath, I presume you meant in the classpath using Stylus Studio menu Tools->Options->Custom File Systems.
The NoSuchMethodError exception probably means that you are loading and running an obsolete .class file which does not have the correct <init> method. This could happen if you have the wrong class file in your jar or perhaps you have a class name conflict with something in one of our jars. Can you email me your .jar file?
Does your logging information tell you which statement is failing?
Can you put
try { ... } catch(NoSuchMethodError e) {e.printStackTrace(System.out)}
around your entire open code? That should help localize where the problem occurs.
The error might be occurring at the moment the Stylus framework loads one of your classes, and therefore not be associated with a specific statement. This would make it more difficult to identify the location.
We should probably take the rest of this conversation offline,
please send your response to stylus-field-report@progress.com