Re: [json-lib-user] java.lang.NoSuchMethodException
Brought to you by:
aalmiray
From: Eric K. <eri...@gm...> - 2012-03-09 22:00:27
|
The relevant source is all in the same file - so there should not be a classpath issue there. I have checked the classpath and have moved all the relevant jars to the beginning: json-lib-2.4-jdk15.jar commons-beanutils-1.8.0.jar commons-collections-3.2.1.jar commons-lang-2.5.jar ezmorph-1.0.6.jar Still I get the same error. From within Eclipse, I can see that I am calling json-lib-2.4-jdk15.jar and these are exactly the same libraries used in my stand-alone program that works. Sadly while my stand-alone project uses Maven, the legacy project does not, but I have checked several times now and everything should be kosher. Any other suggestions? I am tempted to try to use |NewBeanInstanceStrategy| as mentioned in http://json-lib.sourceforge.net/advanced.html but neither the documentation nor the javadoc has any clarity on what this means. An example somewhere would be nice. Cheers, Eric On 2012-03-09 1:37 PM, Tim Harsch wrote: > Sounds suspiciously like you might be picking an incorrect version of > your source off the classpath. It is a common technique when you see > this to pull out the code into a stand alone app as you have done. If > that test is telling you that it works then you are either picking up > a wrong version of JSON lib, or an older compile of your source. You > probably just need to closely inspect your classpath is my guess. > > ------------------------------------------------------------------------ > *From:* Eric Kolotyluk <eri...@gm...> > *To:* jso...@li... > *Sent:* Friday, March 9, 2012 1:09 PM > *Subject:* [json-lib-user] java.lang.NoSuchMethodException > > When I run the following code > > Server [] servers = (Server[]) > JSONArray.toArray(jsonArray, Server.class); // line 1308 > > I get > > net.sf.json.JSONException: java.lang.NoSuchMethodException: > com.kodak.vip.sct.view.PreferencesDialog$ServerPanel$Server.<init>() > at net.sf.json.JSONObject.toBean(JSONObject.java:288) > at net.sf.json.JSONArray.toArray(JSONArray.java:318) > at net.sf.json.JSONArray.toArray(JSONArray.java:250) > at > com.kodak.vip.sct.view.PreferencesDialog$ServerPanel$ServerComboBox.<init>(PreferencesDialog.java:1308) > > So far as I can tell, json-lib thinks it cannot find the no-arg > constructor for my Server class. But it is there, I can see it. > > I have even tested this same line of code in a stand-alone test > application and it works fine, but when I am using it in my real > application I get this exception. > > What could be causing json-lib to be confused? > > Cheers, Eric > > ------------------------------------------------------------------------------ > Virtualization & Cloud Management Using Capacity Planning > Cloud computing makes use of virtualization - but cloud computing > also focuses on allowing computing to be delivered as a service. > http://www.accelacomm.com/jaw/sfnl/114/51521223/ > _______________________________________________ > json-lib-user mailing list > jso...@li... > <mailto:jso...@li...> > https://lists.sourceforge.net/lists/listinfo/json-lib-user > > |