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

strdist error message - java.lang.NoSuchMethodError #5

Closed
sogervais opened this issue Jan 5, 2018 · 4 comments
Closed

strdist error message - java.lang.NoSuchMethodError #5

sogervais opened this issue Jan 5, 2018 · 4 comments
Assignees

Comments

@sogervais
Copy link

Hi. I am getting a java.lang.NoSuchMethodError when using the strdist command from the STRUTIL package.

Thought it was something I was doing at first. I did a complete reinstall and the phonetic encoding commands continue to work fine. However the strdist command returns this error. I've recreated it below with your example.

` sysuse census
(1980 Census data by state)

. keep state state2

. strdist state state2, jarowinklers(jaro_sim)
java.lang.reflect.InvocationTargetException
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 com.stata.Javacall.load(Javacall.java:130)
at com.stata.Javacall.load(Javacall.java:90)
Caused by: java.lang.NoSuchMethodError: org.paces.Stata.MetaData.Meta: method ()V not found
at org.paces.Stata.StringUtils.Similarity.DistanceMetrics.(DistanceMetrics.java:169)
at org.paces.Stata.StringUtils.StringUtilities.distance(StringUtilities.java:53)
... 6 more
`

This error is occurring on a PC - recent upgrade on my work machine.
I've not had the error on my mac - STRUTIL was installed last year when I first discovered your program and all is working ok on that installation.

I see from this exchange wbuchanan/StataJSON#22 that a similar error occured perhaps due to a dependency issue with StataJavaUtilities. Perhaps this is another in the same vein.

I hope this is something you can easily address.

Stephen

@wbuchanan
Copy link
Owner

@sogervais
That definitely seem to be the culprit. In the pom file you'll see this towards the very end:

<dependency>
			<groupId>org.paces-consulting</groupId>
			<artifactId>stata-java</artifactId>
			<version>0.0.3-SNAPSHOT</version>
			<type>jar</type>
			<scope>compile</scope>
			<optional>false</optional>
		</dependency>

That is basically packaging the StataJavaUtilities binary in the contents of the StataStringUtilities binary as well. This should be a relatively easy file (e.g., should just need to recompile the binary with a modification to the scope of the StataJavaUtilities dependency as provided). My access to a PC is fairly limited, but if you can let me know if you have any of my other programs that have Java binaries associated with them installed on your PC I can try to ask one of the folks in my shop to test things quickly.

The dependency for StataJavaUtilities should read:

		<dependency>
			<groupId>org.paces-consulting</groupId>
			<artifactId>stata-java</artifactId>
			<version>0.0.3-SNAPSHOT</version>
			<type>jar</type>
			<scope>provided</scope>
			<optional>false</optional>
		</dependency>

That should basically tell the JVM to look for the StataJavaUtilities library on the end user's system instead of packaging it with this program.

wbuchanan added a commit that referenced this issue Jan 5, 2018
Updated pom file to make the StataJavaUtilities library assumed to be provided on the client side.
wbuchanan added a commit that referenced this issue Jan 5, 2018
@wbuchanan
Copy link
Owner

@sogervais
I just recompiled with the change mentioned above and tried pushing an update to the distribution page. If you could try reinstalling the package from the GitHub page:

net inst strutil, from(http://wbuchanan.github.io/StataStringUtilities) replace force

That should fix things (hopefully). If it does, definitely let me know and if it is still issuing the same error I'll try to spend a bit more time digging into this issue over the weekend to try fixing it.

@sogervais
Copy link
Author

I had to play around with my windows setup a bit and now it works.

I removed both the STRUTIL and BREWSCHEME packages that I had installed. I had not yet added an ado/personal folder. Reinstalled BREWSCHEME and then STRUTIL and now I am up and running.

Thanks for getting to this so quickly. I really appreciate the support!

@wbuchanan
Copy link
Owner

Awesome. Glad to hear it fixed things on your end as well.

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

No branches or pull requests

2 participants