I have some java code converted to .net assemblies using IKVM.
When ever I run the application, it throws an exception as below:
The type initializer for '1' threw an exception.
{"Method not found: 'System.Exception java.lang.Throwable.__<map>(System.Exception, System.Type, Boolean)'."}
What I am missing?
After a couple of hours, I could figure out the problem.
The IKVM version that made .net assemblies is important. higher versions which I got from Nuget did not work properly. I had to download IKVM version 0.42.0.3
Related
I am using a JSON parser to extract the value and I am using the following jar
json-path-2.1.0, and I am getting the following error when I invoke the use case deployed as webservice on weblogic server
I wrote a small main program to extract the value from the json string and it works fine, but the server version of the use case is giving the issue. I am not sure if there are any other jars part of my ear can negatively impact this
SEVERE: defaultReader
java.lang.NoSuchFieldError: defaultReader
at com.jayway.jsonpath.spi.json.JsonSmartJsonProvider.<init>(JsonSmartJsonProvider.java:39)
at com.jayway.jsonpath.internal.DefaultsImpl.jsonProvider(DefaultsImpl.java:21)
at com.jayway.jsonpath.Configuration.defaultConfiguration(Configuration.java:174)
at com.jayway.jsonpath.internal.JsonContext.<init>(JsonContext.java:52)
at com.jayway.jsonpath.JsonPath.parse(JsonPath.java:596)
Stumbled about the same problem.
The reason why it does not work is not the JDK 8.
The reason why you encounter this issue, is the fact that weblogic 12.2.1.X is bundling some old version of json-smart.
On my machine this would be found here:
jar:file:/C:/dev/WLS_12_2_1_2_0/oracle_common/modules/net.minidev.json-smart.jar!/net/minidev/json/JSONValue.class
Now if you are using a library like json-path that depends on json-smart, then by default the container will load the required class using one of its built-in modules.
The blowup you have, seems to be that the JSONValue class that your json-path depends on seemed to have this defaultReder field.
Here is a snipet of the clode that is blowing up.
public JsonSmartJsonProvider() {
this(JSONParser.MODE_PERMISSIVE, JSONValue.defaultReader.DEFAULT_ORDERED);
}
That
JSONValue.defaultReader
Seems not to be valid on weblogs older system class loader class.
You can tell the container to use what you are packing by putting into your weblogic.xml deployment descriptor something like this:
<wls:prefer-application-packages>
<wls:package-name>net.minidev.json.*</wls:package-name>
</wls:prefer-application-packages>
I am having quite a bit of trouble getting weblogic to swallow the fine-grained instruction above.
I found myself to force weblogic to swallog all that goes into the web-inf folder instead doing:
<wls:container-descriptor>
<wls:prefer-web-inf-classes>true</wls:prefer-web-inf-classes>
</wls:container-descriptor>
I would have rather not be using a hammer like the web-inf-classes, but I am dancing with the weblogic system classloader when I do not go coarse grained...
Regards.
I too was facing this issue, It turned out some other library was using json-smart's older version, and it was getting precedence over json-path's json-smart dependency. Removing the other jar solved the issue. Or you can also downgrade your json-path's version to appropriate version such that it support json-smart's older version.
Looks like JsonParser jar is present in JVM 1.8 version and it seems to have more precedence over the JsonParser class available in Json-path.jar. Apparently the us case doesn't work in 12.2.1 version of the weblogic server but it works fine in 12.1.3
I had the same problem but I use Gradle so I had to add:
compile group: 'net.minidev', name: 'json-smart', version: '2.3' to my dependencies.
I use JRuby with jxBrowser. I´ve just upgraded to version 6.8 and my application stopped working. I think the problem comes with the new #JSAccessible annotation. JRuby does not allow method annotation and I inject a JRuby class into a javascript. What used to work now gives me the following message:
Unhandled Java exception: com.teamdev.jxbrowser.chromium.JSFunctionException: Uncaught TypeError: Cannot read property 'set_this' of undefined
Is it possible to not require the #JSAccessible annotation and bring back the functioning of version 6.7?
To bring back functionality of version 6.7 you just need to avoid using the #JSAccessible annotation in your code. This annotation represents an extension to the current API. If you don't use this annotation, the behavior is the same as in previous versions.
I am trying to merge some .net assemblies for Windows Phone 8 using ILMerge.exe (2.12.0803). On their own all assemblies work fine. I can successfully merge assembles which do not contain references to the Windows.Networking namespace as follows:
.\ILMerge.exe /lib:"%ProgramFiles(x86)%\Reference
Assemblies\Microsoft\Framework\WindowsPhone\v8.0"
/out:.\WP8\%1\MathToolbox.dll .\%1\MathBase.dll .\%1\PolyFunctions.dll
As soon as I try to include a DLL which uses the Windows.Networking namspace as follows:
.\ILMerge.exe /lib:"%ProgramFiles(x86)%\Reference
Assemblies\Microsoft\Framework\WindowsPhone\v8.0"
/out:.\WP8\%1\MathToolbox.dll .\%1\MathBase.dll .\%1\PolyFunctions.dll
.\%1\RemoteTools.dll
I am recieving the following exception:
An exception occurred during merging: Unresolved assembly reference
not allowed: Windows. at
System.Compiler.Ir2md.GetAssemblyRefIndex(AssemblyNode assembly) at
System.Compiler.Ir2md.GetTypeRefIndex(TypeNode type) at
System.Compiler.Ir2md.VisitReferencedType(TypeNode type) at
System.Compiler.Ir2md.VisitClass(Class Class) at
System.Compiler.Ir2md.VisitModule(Module module) at
System.Compiler.Ir2md.SetupMetadataWriter(String debugSymbolsLocation)
at System.Compiler.Ir2md.WritePE(Module module, String
debugSymbolsLocation, BinaryWriter writer) at
System.Compiler.Writer.WritePE(String location, Boolean
writeDebugSymbols, Module module, Boolean delayS ign, String
keyFileName, String keyName) at
System.Compiler.Writer.WritePE(CompilerParameters compilerParameters,
Module module) at ILMerging.ILMerge.Merge() at
ILMerging.ILMerge.Main(String[] args)
Having done some reading this exception suggets ILMerge is unable to locate the Windows.Networking assemblies. I have attempted adding various different flags to ILMERGE including:
.\ILMerge.exe /lib:"%ProgramFiles(x86)%\Reference
Assemblies\Microsoft\Framework\WindowsPhone\v8.0" /targetplatform:v4,"%ProgramFiles(x86)%\Reference Assemblies\Microsoft\Framework\Silverlight\v4.0\Profile\WindowsPhone71"
/out:.\WP8\%1\MathToolbox.dll .\%1\MathBase.dll .\%1\PolyFunctions.dll
.\%1\RemoteTools.dll
But still get the same exception. If anyone has any suggestions that would be greatly appreciated.
I don't think ILMerge actually works with other than pure .NET assemblies, especially when Windows Phone 8 and WinRT projects uses referenced native libraries - that might be that not found "Windows" unresolved assembly.
The error indicates that ILMerge cannot find the platform's Windows.winmd. When compiling a Windows Phone or Windows Store project, you compile against two main things; The Platform SDK (WinRT) and a .NET SDK. Any tools that run over these assemblies will need both.
In addition to passing the .NET assembly folder, try passing "C:\Program Files (x86)\Windows Phone Kits\8.0\Windows Metadata directory" as a lib argument.
Make note, ILMerge is based on an older version of CCI (http://ccimetadata.codeplex.com/) so even after doing above, may still have trouble consuming the WinRT metadata format which is slightly different to .NET's.
Running this code:
var statusResponse = TwitterStatus.Show(tweet.Id);
gives an error message: Unable to parse JSON in the statusResponse object and the ResponseObject comes back as null.
Not sure how to fix this. Any ideas?
I run into the same issue today. It seems that you reference a newer version of Newtonsoft.Json in your project (or maybe an other NuGet package included it).
The problem can be fixed by using the Newtonsoft.Json 4.0.5.0 library that is shipped with the Twitterizer project. It needs to be that exact version.
It appears that the the ILogger interface in 3.x is missing a method for .Info that the TemplateEngineNeeds. I'm getting the following error...
Method not found: 'Void Castle.Core.Logging.ILogger.Info(System.String, System.Object[])'.
I'm using version 1.1.1.0 Castle.Components.Common.TemplateEngine.NVelocityTemplateEngine. Perhaps this isn't the correct version so any help in pointing out the correct version would be greatly appreciated.
As far as I know nobody has upgraded TemplateEngine to Castle.Core 3.0 yet. Please fork the repository and upgrade it, then send the team a pull request. If you have any questions about the code post to the Castle Dev list.