Coder Social home page Coder Social logo

Comments (6)

taowen avatar taowen commented on May 18, 2024

can you give me the full stacktrace of the error message?

from java.

tokazio avatar tokazio commented on May 18, 2024

Trying the code on another platform, it seems to work (asking for decoder).
Can confirm this and give you the full stack next thuesday.

Now i'm getting:
com.jsoniter.spi.JsonException: static gen should provide the decoder we need, but failed to create the decoder at com.jsoniter.Codegen.gen(Codegen.java:80) at com.jsoniter.Codegen.getDecoder(Codegen.java:35) at com.jsoniter.JsonIterator.read(JsonIterator.java:336) at com.jsoniter.JsonIterator.deserialize(JsonIterator.java:373) at net.esyo.utils.JsonUtils.loadFromFile(JsonUtils.java:61) at net.esyo.registry.server.RegistryServer.loadConfig(RegistryServer.java:328) at net.esyo.registry.server.RegistryServer.main(RegistryServer.java:44) Caused by: java.lang.ClassNotFoundException: decoder.net.esyo.registry.server.NetRegistryConfig at java.net.URLClassLoader.findClass(URLClassLoader.java:381) at java.lang.ClassLoader.loadClass(ClassLoader.java:424) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:335) at java.lang.ClassLoader.loadClass(ClassLoader.java:357) at java.lang.Class.forName0(Native Method) at java.lang.Class.forName(Class.java:264) at com.jsoniter.Codegen.gen(Codegen.java:75) ... 6 more

I haven't wrote a decoder but, why is it searching decoder.net.esyo.registry.server.NetRegistryConfig? note the 'decoder' as the base package instead of 'net.esyo'.

from java.

taowen avatar taowen commented on May 18, 2024

static decoder works this way. it will create the the decoder source code in the package "decoder.xxx" prefixing your class name. you do not need to write the decoder, the decoder should be generated by com.jsoniter.StaticCodeGenerator

then in the runtime, it will search for "decoder.xxx". if in static mode, not found such class will be a fatal error, because it expects the class should be generated ahead of time. if in dynamic mode, it will trigger class generation in the runtime (using javaasist).

checkout code https://github.com/json-iterator/java/tree/master/demo
mvn exec:java -Dexec.mainClass=com.jsoniter.demo.Demo

from java.

tokazio avatar tokazio commented on May 18, 2024

Multiple java installations misconfiguration.

from java.

tokazio avatar tokazio commented on May 18, 2024

Using netbeans with maven.
JAVA_HOME=C:\Program Files\Java\jdk1.8.0_102

Have:
jdk1.7.0_25
jdk1.7.0_79
jdk1.8.0.91
jdk1.8.0_102
jdk-9
Installed in C:\Program Files\Java

Exception in thread "main" java.lang.UnsupportedClassVersionError: net/esyo/utils/JsonUtils : Unsupported major.minor version 52.0
	at java.lang.ClassLoader.defineClass1(Native Method)
	at java.lang.ClassLoader.defineClass(Unknown Source)
	at java.security.SecureClassLoader.defineClass(Unknown Source)
	at java.net.URLClassLoader.defineClass(Unknown Source)
	at java.net.URLClassLoader.access$100(Unknown Source)
	at java.net.URLClassLoader$1.run(Unknown Source)
	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)
	at java.lang.Class.forName0(Native Method)
	at java.lang.Class.forName(Unknown Source)
	at com.jsoniter.StaticCodeGenerator.main(StaticCodeGenerator.java:17)
Command execution failed.
org.apache.commons.exec.ExecuteException: Process exited with an error: 1 (Exit value: 1)
	at org.apache.commons.exec.DefaultExecutor.executeInternal(DefaultExecutor.java:404)
	at org.apache.commons.exec.DefaultExecutor.execute(DefaultExecutor.java:166)
	at org.codehaus.mojo.exec.ExecMojo.executeCommandLine(ExecMojo.java:764)
	at org.codehaus.mojo.exec.ExecMojo.executeCommandLine(ExecMojo.java:711)
	at org.codehaus.mojo.exec.ExecMojo.execute(ExecMojo.java:289)
	at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:101)
	at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:209)
	at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
	at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
	at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:84)
	at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:59)
	at org.apache.maven.lifecycle.internal.LifecycleStarter.singleThreadedBuild(LifecycleStarter.java:183)
	at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:161)
	at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:320)
	at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:156)
	at org.apache.maven.cli.MavenCli.execute(MavenCli.java:537)
	at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:196)
	at org.apache.maven.cli.MavenCli.main(MavenCli.java:141)
	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.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:290)
	at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:230)
	at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:409)
	at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:352)

from java.

tokazio avatar tokazio commented on May 18, 2024

ok found this: http://stackoverflow.com/questions/4681090/how-do-i-find-where-jdk-is-installed-on-my-windows-machine

Netbeans maven process was using system32/java.exe instead of the JAVA_HOME one...

from java.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.