Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Failed to use SolSample.java #14

Open
marlonprudente opened this issue Apr 14, 2019 · 0 comments
Open

Failed to use SolSample.java #14

marlonprudente opened this issue Apr 14, 2019 · 0 comments

Comments

@marlonprudente
Copy link

I trying to use SolSample with Ganache, my method is the same:

	private static void deploy() {
		Web3j web3j = Web3j.build(new HttpService(Environment.RPC_URL));
		Credentials credentials = Credentials.create("9797ab180fae3c9fa50c1b713beb5e08e012a303de04760349712dbcf6d497c1");//可以根据私钥生成
                System.out.println("Address: " + credentials.getAddress());
		RemoteCall<TokenERC20> deploy = TokenERC20.deploy(web3j, credentials,
				Convert.toWei("10", Convert.Unit.GWEI).toBigInteger(),
				BigInteger.valueOf(3000000),
				BigInteger.valueOf(5201314),
				"my token", "mt");
		try {
			TokenERC20 tokenERC20 = deploy.send();
			tokenERC20.isValid();
		} catch (Exception e) {
			e.printStackTrace();
		}

	}

but, the error is:

Address: 0xf7e06fc2159da20efa1a5c3bfe3330445259314d java.lang.RuntimeException: java.lang.NoSuchMethodException: com.ethjava.sol.TokenERC20.<init>(java.lang.String, org.web3j.protocol.Web3j, org.web3j.crypto.Credentials, org.web3j.tx.gas.ContractGasProvider) at org.web3j.tx.Contract.deploy(Contract.java:359) at org.web3j.tx.Contract.deploy(Contract.java:396) at org.web3j.tx.Contract.lambda$deployRemoteCall$5(Contract.java:419) at org.web3j.protocol.core.RemoteCall.send(RemoteCall.java:30) at com.ethjava.sol.SolSample.deploy(SolSample.java:29) at com.ethjava.sol.SolSample.main(SolSample.java:15) Caused by: java.lang.NoSuchMethodException: com.ethjava.sol.TokenERC20.<init>(java.lang.String, org.web3j.protocol.Web3j, org.web3j.crypto.Credentials, org.web3j.tx.gas.ContractGasProvider) at java.base/java.lang.Class.getConstructor0(Class.java:3350) at java.base/java.lang.Class.getDeclaredConstructor(Class.java:2554) at org.web3j.tx.Contract.deploy(Contract.java:346) ... 5 more Exception in thread "main" java.lang.NullPointerException at org.web3j.tx.RawTransactionManager.<init>(RawTransactionManager.java:36) at org.web3j.tx.RawTransactionManager.<init>(RawTransactionManager.java:66) at org.web3j.tx.Contract.<init>(Contract.java:94) at com.ethjava.sol.TokenERC20.<init>(TokenERC20.java:75) at com.ethjava.sol.TokenERC20.load(TokenERC20.java:263) at com.ethjava.sol.SolSample.use(SolSample.java:41) at com.ethjava.sol.SolSample.main(SolSample.java:16) 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:134) at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:207) 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:116) at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:80) at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build(SingleThreadedBuilder.java:51) at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:128) at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:307) at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:193) at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:106) at org.apache.maven.cli.MavenCli.execute(MavenCli.java:863) at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:288) at org.apache.maven.cli.MavenCli.main(MavenCli.java:199) at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.base/java.lang.reflect.Method.invoke(Method.java:566) at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:289) at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:229) at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:415) at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:356)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant