jimmoores / quandl4j

Java wrapper for Quandl REST API
quandl4j.org
Apache License 2.0
78 stars 23 forks source link

Exception in thread "main" java.lang.NoClassDefFoundError: javax/ws/rs/core/UriBuilder #4

Closed tuncayxx closed 8 years ago

tuncayxx commented 9 years ago

Exception in thread "main" java.lang.NoClassDefFoundError: javax/ws/rs/core/UriBuilder at com.jimmoores.quandl.QuandlSession.(QuandlSession.java:41) at com.jimmoores.quandl.example.Example1.run(Example1.java:21) at com.jimmoores.quandl.example.Example1.main(Example1.java:33) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:606) at com.intellij.rt.execution.application.AppMain.main(AppMain.java:134) Caused by: java.lang.ClassNotFoundException: javax.ws.rs.core.UriBuilder at java.net.URLClassLoader$1.run(URLClassLoader.java:366) at java.net.URLClassLoader$1.run(URLClassLoader.java:355) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:354) at java.lang.ClassLoader.loadClass(ClassLoader.java:425) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308) at java.lang.ClassLoader.loadClass(ClassLoader.java:358) ... 8 more

tuncayxx commented 9 years ago

I get above exception when running example 1. I just cloned the repo and installed successfully using Maven. When running the example 1 I get above exception. ???

jimmoores commented 9 years ago

Which version of Java are you using? It looks like it can't find the JAX-RS 2 interfaces... On 12 Nov 2014 12:01, "tuncayxx" notifications@github.com wrote:

I get above exception when running example 1. I just cloned the repo and installed successfully using Maven. When running the example 1 I get above exception. ???

— Reply to this email directly or view it on GitHub https://github.com/jimmoores/quandl4j/issues/4#issuecomment-62708323.

tuncayxx commented 9 years ago

Hi Jimmorres,

I make use of Java 1.7.0_65

jimmoores commented 9 years ago

Are you trying to use it with a container like Tomcat or it is possible you have your IDE setup to include one in the Classpath? Could you provide me with some more details on your environment?

Jim

On 12 November 2014 15:13, tuncayxx notifications@github.com wrote:

Hi Jimmorres,

I make use of Java 1.7.0_65

— Reply to this email directly or view it on GitHub https://github.com/jimmoores/quandl4j/issues/4#issuecomment-62732851.

tuncayxx commented 9 years ago

I just compled with maven and then inside my Ide run the example 1 without any container.

jimmoores commented 9 years ago

Do you have the maven entries in your IDE run item? It looks like you're not including the maven dependencies in the classpath when you are running it from within the IDE. For example, in eclipse, if you open the launch item it should look like this:

​ What's your IDE, OS, etc?

Jim

On 12 November 2014 15:40, tuncayxx notifications@github.com wrote:

I just compled with maven and then inside my Ide run the example 1 without any container.

— Reply to this email directly or view it on GitHub https://github.com/jimmoores/quandl4j/issues/4#issuecomment-62737681.

tuncayxx commented 9 years ago

I make use of IntelliJ Idea 14

Maven dependencies are:

< 1.7 > Maven: ch.qos.logback:logback-classic:1.0.13 Maven: ch.qos.logback:logback-core:1.0.13 Maven: com.beust:jcommander:1.27 Maven: com.opengamma.external.json:json:1.0.0.v20101106 Maven: commons-cli:commons-cli:1.2 Maven: javax.annotation:javax.annotation-api:1.2 Maven: javax.ws.rs:javax.ws.rs-api:2.0 Maven: net.sf.opencsv:opencsv:2.3 Maven: org.beanshell:bsh:2.0b4 Maven: org.glassfish.hk2.external:aopalliance-repackaged:2.2.0 Maven: org.glassfish.hk2.external:javax.inject:2.2.0 Maven: org.glassfish.hk2:hk2-api:2.2.0 Maven: org.glassfish.hk2:hk2-locator:2.2.0 Maven: org.glassfish.hk2:hk2-utils:2.2.0 Maven: org.glassfish.hk2:osgi-resource-locator:1.0.1 Maven: org.glassfish.jersey.bundles.repackaged:jersey-guava:2.8 Maven: org.glassfish.jersey.core:jersey-client:2.8 Maven: org.glassfish.jersey.core:jersey-common:2.8 Maven: org.javassist:javassist:3.18.1-GA Maven: org.slf4j:slf4j-api:1.7.5 Maven: org.testng:testng:6.8.8 Maven: org.threeten:threetenbp:0.9

jimmoores commented 9 years ago

I'll try it with IntelliJ myself and get back to you. Bit baffled to be honest as it works fine in Eclipse.

On 12 November 2014 15:57, tuncayxx notifications@github.com wrote:

I make use of IntelliJ Idea 14

Maven dependencies are:

< 1.7 > Maven: ch.qos.logback:logback-classic:1.0.13 Maven: ch.qos.logback:logback-core:1.0.13 Maven: com.beust:jcommander:1.27 Maven: com.opengamma.external.json:json:1.0.0.v20101106 Maven: commons-cli:commons-cli:1.2 Maven: javax.annotation:javax.annotation-api:1.2 Maven: javax.ws.rs:javax.ws.rs-api:2.0 Maven: net.sf.opencsv:opencsv:2.3 Maven: org.beanshell:bsh:2.0b4 Maven: org.glassfish.hk2.external:aopalliance-repackaged:2.2.0 Maven: org.glassfish.hk2.external:javax.inject:2.2.0 Maven: org.glassfish.hk2:hk2-api:2.2.0 Maven: org.glassfish.hk2:hk2-locator:2.2.0 Maven: org.glassfish.hk2:hk2-utils:2.2.0 Maven: org.glassfish.hk2:osgi-resource-locator:1.0.1 Maven: org.glassfish.jersey.bundles.repackaged:jersey-guava:2.8 Maven: org.glassfish.jersey.core:jersey-client:2.8 Maven: org.glassfish.jersey.core:jersey-common:2.8 Maven: org.javassist:javassist:3.18.1-GA Maven: org.slf4j:slf4j-api:1.7.5 Maven: org.testng:testng:6.8.8 Maven: org.threeten:threetenbp:0.9

— Reply to this email directly or view it on GitHub https://github.com/jimmoores/quandl4j/issues/4#issuecomment-62740973.

tuncayxx commented 9 years ago

Ok :)

jimmoores commented 9 years ago

Ok, managed to reproduce the problem. Can you try adding this to the pom.xml:

javax.ws.rs javax.ws.rs-api 2.0

I think it's because I've been testing against JDK8 which includes this package and the Travis CI job doesn't run the examples because they're not strictly tests.

Let me know if this works and if so I'll update the pom and push out a new version.

Jim

On 12 November 2014 16:20, tuncayxx notifications@github.com wrote:

Ok :)

— Reply to this email directly or view it on GitHub https://github.com/jimmoores/quandl4j/issues/4#issuecomment-62745079.

tuncayxx commented 9 years ago

Now, I get another exception

Exception in thread "main" java.lang.ExceptionInInitializerError at com.jimmoores.quandl.example.Example1.run(Example1.java:21) at com.jimmoores.quandl.example.Example1.main(Example1.java:33) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:606) at com.intellij.rt.execution.application.AppMain.main(AppMain.java:120) Caused by: java.lang.RuntimeException: java.lang.ClassNotFoundException: org.glassfish.jersey.internal.RuntimeDelegateImpl at javax.ws.rs.ext.RuntimeDelegate.findDelegate(RuntimeDelegate.java:152) at javax.ws.rs.ext.RuntimeDelegate.getInstance(RuntimeDelegate.java:120) at javax.ws.rs.core.UriBuilder.newInstance(UriBuilder.java:95) at javax.ws.rs.core.UriBuilder.fromPath(UriBuilder.java:148) at com.jimmoores.quandl.QuandlSession.(QuandlSession.java:41) ... 7 more Caused by: java.lang.ClassNotFoundException: org.glassfish.jersey.internal.RuntimeDelegateImpl

tuncayxx commented 9 years ago

Adding below dependency didn't help:

org.glassfish.jersey.core jersey-common 2.4.1 test
jimmoores commented 9 years ago

Try removing the scope of test? On 13 Nov 2014 08:51, "tuncayxx" notifications@github.com wrote:

Adding below dependency didn't help:

org.glassfish.jersey.core jersey-common 2.4.1 test

— Reply to this email directly or view it on GitHub https://github.com/jimmoores/quandl4j/issues/4#issuecomment-62859699.

tuncayxx commented 9 years ago

Adding following three dependencies the example 1 is working now :)

javax.ws.rs javax.ws.rs-api 2.0
<dependency>
  <groupId>org.glassfish.jersey.core</groupId>
  <artifactId>jersey-common</artifactId>
  <version>2.4.1</version>
</dependency>
  <dependency>
      <groupId>org.jboss.resteasy</groupId>
      <artifactId>resteasy-client</artifactId>
      <version>3.0.2.Final</version>
  </dependency>
tuncayxx commented 9 years ago

Thank you for the help Jimmoores :)

Btw, can I use your quandl API to fetch stock data from Google Finance through Quandle directly. Are there some sort of restrictions and is it allowed to make a lot of requests to Quandle in order to get realtime stock data from Google Finance ?

And why when I get data from Google Finance through the Quandle I get old data not most new updated data on Google Finance ?

jimmoores commented 9 years ago

I'm just sorry you've had so much trouble with it. No idea why rest easy is required, perhaps my jersey dependencies are not complete and it implements some of those classes...

Strange thing is that it worked for me with IntelliJ 14 (community edition) and the latest Java 7 SE JDK after a bit of fiddling around once I added that dependency I showed you.

I believe that all the Google finance data is available through Quandl.

I'll do some changes to the release to firm up the dependency requirements, include the examples in the testing and add IntelliJ instructions.

Jim On 13 Nov 2014 09:15, "tuncayxx" notifications@github.com wrote:

Thank you for the help Jimmoores :)

Btw, can I use your quandl API to fetch stock data from Google Finance through Quandle. Are there some sort of restrictions and is it allowed to make short interval requests to Quandle in order to get realtime stock data from Google Finance ?

— Reply to this email directly or view it on GitHub https://github.com/jimmoores/quandl4j/issues/4#issuecomment-62862309.

jimmoores commented 9 years ago

One thought. What version of maven are you using? If its < 3, I think maven didn't do transitive dependencies. Bit of a long shot but thought I'd ask. On 13 Nov 2014 11:24, "Jim Moores" jim.moores@gmail.com wrote:

I'm just sorry you've had so much trouble with it. No idea why rest easy is required, perhaps my jersey dependencies are not complete and it implements some of those classes...

Strange thing is that it worked for me with IntelliJ 14 (community edition) and the latest Java 7 SE JDK after a bit of fiddling around once I added that dependency I showed you.

I believe that all the Google finance data is available through Quandl.

I'll do some changes to the release to firm up the dependency requirements, include the examples in the testing and add IntelliJ instructions.

Jim On 13 Nov 2014 09:15, "tuncayxx" notifications@github.com wrote:

Thank you for the help Jimmoores :)

Btw, can I use your quandl API to fetch stock data from Google Finance through Quandle. Are there some sort of restrictions and is it allowed to make short interval requests to Quandle in order to get realtime stock data from Google Finance ?

— Reply to this email directly or view it on GitHub https://github.com/jimmoores/quandl4j/issues/4#issuecomment-62862309.

tuncayxx commented 9 years ago

Apache Maven 3.1.1 + Windows 7

tuncayxx commented 9 years ago

Jimmoores, the reason why I use your api is to fetch realtime stock information from Google Finance. But it seems like data I get are old from Quandl, why ?

jimmoores commented 9 years ago

Quandl is only historical data, not realtime data.

On 13 November 2014 11:47, tuncayxx notifications@github.com wrote:

Jimmoores, the reason why I use your api is to fetch realtime stock information from Google Finance. But it seems like data I get are old from Quandl, why ?

— Reply to this email directly or view it on GitHub https://github.com/jimmoores/quandl4j/issues/4#issuecomment-62879204.

tuncayxx commented 9 years ago

ok, thanks

georgeb22 commented 9 years ago

fyi I also needed the 3 dependencies above. InteliJ community 14.02 Win 7 Maven 3.2.5 quandl 1.0.0 also has output of...

SLF4J: Class path contains multiple SLF4J bindings. SLF4J: Found binding in [jar:file:/C:/Users/George/.m2/repository/ch/qos/logback/logback-classic/1.0.13/logback-classic-1.0.13.jar!/org/slf4j/impl/StaticLoggerBinder.class] SLF4J: Found binding in [jar:file:/C:/Users/George/.m2/repository/org/slf4j/slf4j-simple/1.5.8/slf4j-simple-1.5.8.jar!/org/slf4j/impl/StaticLoggerBinder.class] SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an explanation. SLF4J: Actual binding is of type [ch.qos.logback.classic.util.ContextSelectorStaticBinder] 14:04:19.362 [main] DEBUG o.j.r.p.providers.DocumentProvider - Unable to retrieve config: expandEntityReferences defaults to true 14:04:19.372 [main] DEBUG o.j.r.p.providers.DocumentProvider - Unable to retrieve config: expandEntityReferences defaults to true

jimmoores commented 9 years ago

I thought I'd fixed the dependencies issue, apologies for that, I'll investigate again. I don't understand the resteasy requirement as I've never used that. I'm guessing it's a drop-in replacement for the jersey client dependencies. I think the reason is that these are available out-of-the-box in Java 8.

georgeb22 commented 9 years ago

No problem, may well be an issue with the class loader loading a singleton somewhere.

I should have added that I'm using jdk1.8.0_31

the trace says,

Exception in thread "main" java.lang.RuntimeException: java.lang.ClassNotFoundException: org.glassfish.jersey.client.JerseyClientBuilder at javax.ws.rs.client.ClientBuilder.newBuilder(ClientBuilder.java:103) at javax.ws.rs.client.ClientBuilder.newClient(ClientBuilder.java:114) at com.jimmoores.quandl.QuandlSession.getClient(QuandlSession.java:121) at com.jimmoores.quandl.QuandlSession.getDataSet(QuandlSession.java:143) at com.da.app1.Example1.run(Example1.java:32) at com.da.app1.Example1.main(Example1.java:65) 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:483) at com.intellij.rt.execution.application.AppMain.main(AppMain.java:134) Caused by: java.lang.ClassNotFoundException: org.glassfish.jersey.client.JerseyClientBuilder at java.net.URLClassLoader$1.run(URLClassLoader.java:372) at java.net.URLClassLoader$1.run(URLClassLoader.java:361) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:360) at java.lang.ClassLoader.loadClass(ClassLoader.java:424) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308) at java.lang.ClassLoader.loadClass(ClassLoader.java:357) at java.lang.Class.forName0(Native Method) at java.lang.Class.forName(Class.java:260) at javax.ws.rs.client.FactoryFinder.newInstance(FactoryFinder.java:113) at javax.ws.rs.client.FactoryFinder.find(FactoryFinder.java:206) at javax.ws.rs.client.ClientBuilder.newBuilder(ClientBuilder.java:86) ... 10 more

On 23 January 2015 at 14:58, Jim Moores notifications@github.com wrote:

I thought I'd fixed the dependencies issue, apologies for that, I'll investigate again. I don't understand the resteasy requirement as I've never used that. I'm guessing it's a drop-in replacement for the jersey client dependencies. I think the reason is that these are available out-of-the-box in Java 8.

— Reply to this email directly or view it on GitHub https://github.com/jimmoores/quandl4j/issues/4#issuecomment-71204829.

jimmoores commented 9 years ago

I've pushed what I think is a fix to the master branch (1.1.0-SNAPSHOT). I think the problem was that my maven dependencies for jersey was marked with scope 'provided'. I also added a dep for jersey-common, although I don't know if I need that. I did NOT add RESTEasy as a dep because I didn't want to just blindly add something without understanding why it helped (which might be a bit stubborn of me).

I know this is a lot to ask, but any possibility you could try it (a build from master)? I added tests to actually run the examples, which was missing before - they seem to pass in Travis CI and locally.

I wondered if this was anything to do with it:

http://stackoverflow.com/questions/17366266/jax-rs-2-0-change-default-implementation

This suggests I need to add a service entry in META-INF/services/javax.ws.rs.client.ClientBuilder that points at the Jersey client builder perhaps?

Anyway, If the changes I just pushed fixes it for you, I'll push out a new release to maven central.

georgeb22 commented 9 years ago

Ok, may take a while, a couple of other things which I'll need to work around....

Just tried in in Intelij and it's requesting JavaSE1.7, which I've cleared off this laptop.

Also having to add versions again for

[INFO] Scanning for projects... [WARNING] [WARNING] Some problems were encountered while building the effective model for com.jimmoores:quandl:jar:1.1.0-SNAPSHOT [WARNING] 'build.plugins.plugin.version' for org.joda:joda-beans-maven-plugin is missing. @ line 406, column 19 [WARNING] 'build.plugins.plugin.version' for org.apache.maven.plugins:maven-enforcer-plugin is missing. @ line 351, column 19

georgeb22 commented 9 years ago

Also added to pom..

in the rules section of

org.apache.maven.plugins

as found in http://maven.apache.org/enforcer/enforcer-rules/requirePluginVersions.html

org.apache.maven.plugins:maven-resources-plugin, org.apache.maven.plugins:maven-antrun-plugin, org.apache.maven.plugins:maven-clean-plugin, org.apache.maven.plugins:maven-install-plugin, org.apache.maven.plugins:maven-deploy-plugin

On 23 January 2015 at 16:28, Jim Moores notifications@github.com wrote:

I've pushed what I think is a fix to the master branch (1.1.0-SNAPSHOT). I think the problem was that my maven dependencies for jersey was marked with scope 'provided'. I also added a dep for jersey-common, although I don't know if I need that. I did NOT add RESTEasy as a dep because I didn't want to just blindly add something without understanding why it helped (which might be a bit stubborn of me).

I know this is a lot to ask, but any possibility you could try it (a build from master)? I added tests to actually run the examples, which was missing before - they seem to pass in Travis CI and locally.

I wondered if this was anything to do with it:

http://stackoverflow.com/questions/17366266/jax-rs-2-0-change-default-implementation

This suggests I need to add a service entry in META-INF/services/javax.ws.rs.client.ClientBuilder that points at the Jersey client builder perhaps? If that fixes it for you, I'll push out a new release to maven central.

— Reply to this email directly or view it on GitHub https://github.com/jimmoores/quandl4j/issues/4#issuecomment-71219934.

georgeb22 commented 9 years ago

[INFO] --- joda-beans-maven-plugin:1.0:validate (default) @ quandl --- [INFO] Skipping as joda-beans is not in the project compile classpath

On 23 January 2015 at 14:58, Jim Moores notifications@github.com wrote:

I thought I'd fixed the dependencies issue, apologies for that, I'll investigate again. I don't understand the resteasy requirement as I've never used that. I'm guessing it's a drop-in replacement for the jersey client dependencies. I think the reason is that these are available out-of-the-box in Java 8.

— Reply to this email directly or view it on GitHub https://github.com/jimmoores/quandl4j/issues/4#issuecomment-71204829.

georgeb22 commented 9 years ago

[INFO] --- maven-checkstyle-plugin:2.12.1:check (enforce-checkstyle) @ quandl --- [INFO] [INFO] There are 820 checkstyle errors.

;-)

added to project properties

true On 23 January 2015 at 16:28, Jim Moores notifications@github.com wrote: > I've pushed what I think is a fix to the master branch (1.1.0-SNAPSHOT). I > think the problem was that my maven dependencies for jersey was marked with > scope 'provided'. I also added a dep for jersey-common, although I don't > know if I need that. I did NOT add RESTEasy as a dep because I didn't want > to just blindly add something without understanding why it helped (which > might be a bit stubborn of me). > > I know this is a lot to ask, but any possibility you could try it (a build > from master)? I added tests to actually run the examples, which was missing > before - they seem to pass in Travis CI and locally. > > I wondered if this was anything to do with it: > > http://stackoverflow.com/questions/17366266/jax-rs-2-0-change-default-implementation > > This suggests I need to add a service entry in > META-INF/services/javax.ws.rs.client.ClientBuilder that points at the > Jersey client builder perhaps? If that fixes it for you, I'll push out a > new release to maven central. > > — > Reply to this email directly or view it on GitHub > https://github.com/jimmoores/quandl4j/issues/4#issuecomment-71219934.
georgeb22 commented 9 years ago

results of maven deploy after previous email changes

[INFO] --- maven-compiler-plugin:3.1:testCompile (default-testCompile) @ quandl --- [INFO] Changes detected - recompiling the module! [INFO] Compiling 14 source files to C:\Development\IdeaProjects\quandl4j\target\test-classes [WARNING] /C:/Development/IdeaProjects/quandl4j/src/test/java/com/jimmoores/quandl/tests/RegressionTests.java: Some input files use or override a deprecated API. [WARNING] /C:/Development/IdeaProjects/quandl4j/src/test/java/com/jimmoores/quandl/tests/RegressionTests.java: Recompile with -Xlint:deprecation for details. [INFO] [INFO] --- maven-surefire-plugin:2.17:test (default-test) @ quandl --- [INFO] Surefire report directory: C:\Development\IdeaProjects\quandl4j\target\surefire-reports


T E S T S

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:483) at sun.instrument.InstrumentationImpl.loadClassAndStartAgent(InstrumentationImpl.java:386) at sun.instrument.InstrumentationImpl.loadClassAndCallPremain(InstrumentationImpl.java:401) Caused by: java.lang.RuntimeException: Class java/util/UUID could not be instrumented. at org.jacoco.agent.rt.internal_9dd1198.core.runtime.ModifiedSystemClassRuntime.createFor(ModifiedSystemClassRuntime.java:138) at org.jacoco.agent.rt.internal_9dd1198.core.runtime.ModifiedSystemClassRuntime.createFor(ModifiedSystemClassRuntime.java:99) at org.jacoco.agent.rt.internal_9dd1198.PreMain.createRuntime(PreMain.java:55) at org.jacoco.agent.rt.internal_9dd1198.PreMain.premain(PreMain.java:47) ... 6 more Caused by: java.lang.NoSuchFieldException: $jacocoAccess at java.lang.Class.getField(Class.java:1695) at org.jacoco.agent.rt.internal_9dd1198.core.runtime.ModifiedSystemClassRuntime.createFor(ModifiedSystemClassRuntime.java:136) ... 9 more FATAL ERROR in native method: processing of -javaagent failed Exception in thread "main"

On 23 January 2015 at 14:58, Jim Moores notifications@github.com wrote:

I thought I'd fixed the dependencies issue, apologies for that, I'll investigate again. I don't understand the resteasy requirement as I've never used that. I'm guessing it's a drop-in replacement for the jersey client dependencies. I think the reason is that these are available out-of-the-box in Java 8.

— Reply to this email directly or view it on GitHub https://github.com/jimmoores/quandl4j/issues/4#issuecomment-71204829.

georgeb22 commented 9 years ago

it looks like the deprecated API in RegressionTests.java are around the changes for deprecating MultiDataSetRequest :-)

On 23 January 2015 at 14:58, Jim Moores notifications@github.com wrote:

I thought I'd fixed the dependencies issue, apologies for that, I'll investigate again. I don't understand the resteasy requirement as I've never used that. I'm guessing it's a drop-in replacement for the jersey client dependencies. I think the reason is that these are available out-of-the-box in Java 8.

— Reply to this email directly or view it on GitHub https://github.com/jimmoores/quandl4j/issues/4#issuecomment-71204829.

georgeb22 commented 9 years ago

removed deprecated tests and ran deploy

still looks like you have a fundamental class issue


T E S T S

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:483) at sun.instrument.InstrumentationImpl.loadClassAndStartAgent(InstrumentationImpl.java:386) at sun.instrument.InstrumentationImpl.loadClassAndCallPremain(InstrumentationImpl.java:401) Caused by: java.lang.RuntimeException: Class java/util/UUID could not be instrumented. at org.jacoco.agent.rt.internal_9dd1198.core.runtime.ModifiedSystemClassRuntime.createFor(ModifiedSystemClassRuntime.java:138) at org.jacoco.agent.rt.internal_9dd1198.core.runtime.ModifiedSystemClassRuntime.createFor(ModifiedSystemClassRuntime.java:99) at org.jacoco.agent.rt.internal_9dd1198.PreMain.createRuntime(PreMain.java:55) at org.jacoco.agent.rt.internal_9dd1198.PreMain.premain(PreMain.java:47) ... 6 more Caused by: java.lang.NoSuchFieldException: $jacocoAccess at java.lang.Class.getField(Class.java:1695) at org.jacoco.agent.rt.internal_9dd1198.core.runtime.ModifiedSystemClassRuntime.createFor(ModifiedSystemClassRuntime.java:136) ... 9 more FATAL ERROR in native method: processing of -javaagent failed Exception in thread "main"

On 23 January 2015 at 16:28, Jim Moores notifications@github.com wrote:

I've pushed what I think is a fix to the master branch (1.1.0-SNAPSHOT). I think the problem was that my maven dependencies for jersey was marked with scope 'provided'. I also added a dep for jersey-common, although I don't know if I need that. I did NOT add RESTEasy as a dep because I didn't want to just blindly add something without understanding why it helped (which might be a bit stubborn of me).

I know this is a lot to ask, but any possibility you could try it (a build from master)? I added tests to actually run the examples, which was missing before - they seem to pass in Travis CI and locally.

I wondered if this was anything to do with it:

http://stackoverflow.com/questions/17366266/jax-rs-2-0-change-default-implementation

This suggests I need to add a service entry in META-INF/services/javax.ws.rs.client.ClientBuilder that points at the Jersey client builder perhaps? If that fixes it for you, I'll push out a new release to maven central.

— Reply to this email directly or view it on GitHub https://github.com/jimmoores/quandl4j/issues/4#issuecomment-71219934.

jimmoores commented 9 years ago

Ok, that stack trace looks like the code coverage JaCoCo/EclEmma stuff, which I shouldn't run by default, it's probably because you're running deploy rather than install. Yes, there is a whole bunch of crap in the pom which needs to be removed, the Checkstyle needs to be sorted out etc. I'll try and get to that in the next few days.

ayushmathur86 commented 9 years ago

Hi, I'm facing a similar problem for Rest service. There are two scenarios here:

  1. I have created a restful web service and deployed in JBoss EAP 6.1 successfully. The context can be seen as registered to /AlarmLibrary. However, when I'm trying to access from browser, it throws the error: "JBWEB000124: The requested resource is not available".
  2. I have created one rest client for the service and when I try to run the client, it throws the following error stack: Exception in thread "main" java.lang.RuntimeException: java.lang.ClassNotFoundException: org.glassfish.jersey.internal.RuntimeDelegateImpl at javax.ws.rs.ext.RuntimeDelegate.findDelegate(RuntimeDelegate.java:152) at javax.ws.rs.ext.RuntimeDelegate.getInstance(RuntimeDelegate.java:120) at javax.ws.rs.core.UriBuilder.newInstance(UriBuilder.java:95) at javax.ws.rs.core.UriBuilder.fromUri(UriBuilder.java:119) at com.psiincontrol.alarmservice.jaxrs.client.AlarmRestClient.(AlarmRestClient.java:35) at com.psiincontrol.alarmservice.jaxrs.client.AlarmRestClientTest.main(AlarmRestClientTest.java:21) Caused by: java.lang.ClassNotFoundException: org.glassfish.jersey.internal.RuntimeDelegateImpl at java.net.URLClassLoader$1.run(URLClassLoader.java:366) at java.net.URLClassLoader$1.run(URLClassLoader.java:355) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:354) at java.lang.ClassLoader.loadClass(ClassLoader.java:425) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308) at java.lang.ClassLoader.loadClass(ClassLoader.java:358) at java.lang.Class.forName0(Native Method) at java.lang.Class.forName(Class.java:190) at javax.ws.rs.ext.FactoryFinder.newInstance(FactoryFinder.java:114) at javax.ws.rs.ext.FactoryFinder.find(FactoryFinder.java:207) at javax.ws.rs.ext.RuntimeDelegate.findDelegate(RuntimeDelegate.java:135) ... 5 more

Could you please let me know what can be the issue here ? I have attached the server.log file snapshot for reference.

server_log

ayushmathur86 commented 9 years ago

Ok, I have resolved the issues mentioned for Case#2, however, I'm still not able to access my REST web service either from browser or from my client code. Here's the error message:

Getting list of alarms: Exception in thread "main" javax.ws.rs.NotFoundException: HTTP 404 Not Found at org.glassfish.jersey.client.JerseyInvocation.convertToException(JerseyInvocation.java:913) at org.glassfish.jersey.client.JerseyInvocation.translate(JerseyInvocation.java:822) at org.glassfish.jersey.client.JerseyInvocation.access$600(JerseyInvocation.java:90) at org.glassfish.jersey.client.JerseyInvocation$3.call(JerseyInvocation.java:693) at org.glassfish.jersey.internal.Errors.process(Errors.java:315) at org.glassfish.jersey.internal.Errors.process(Errors.java:297) at org.glassfish.jersey.internal.Errors.process(Errors.java:228) at org.glassfish.jersey.process.internal.RequestScope.runInScope(RequestScope.java:422) at org.glassfish.jersey.client.JerseyInvocation.invoke(JerseyInvocation.java:689) at org.glassfish.jersey.client.JerseyInvocation$Builder.method(JerseyInvocation.java:405) at org.glassfish.jersey.client.JerseyInvocation$Builder.get(JerseyInvocation.java:301) at com.psiincontrol.alarmservice.jaxrs.client.AlarmRestClient.getAlarms(AlarmRestClient.java:55) at com.psiincontrol.alarmservice.jaxrs.client.AlarmRestClientTest.main(AlarmRestClientTest.java:28)

Any idea how I can resolve this please ?

jimmoores commented 9 years ago

Hello, I haven't looked at your logs in detail (not at work yet) but I think it's probably too do with the default JAX-RS implementation. It could be that you have a different default implementation or that you're using e.g. JAX-RS 1.x, which is incompatible with 2.x in the same classpath. I believe the implementation can be hardwired in META-INF/services/javax.ws http://javax.ws.rs.ext. Note there is also an (unfortunately not quite up-to-date) JAX-RS 1.x backport on a branch on github.

I'll have a more detailed look in an hour or so.

Jim

Ok, I have resolved the issues mentioned for Case#2, however, I'm still not able to access my REST web service either from browser or from my client code. Here's the error message:

Getting list of alarms: Exception in thread "main" javax.ws.rs.NotFoundException: HTTP 404 Not Found at org.glassfish.jersey.client.JerseyInvocation.convertToException(JerseyInvocation.java:913) at org.glassfish.jersey.client.JerseyInvocation.translate(JerseyInvocation.java:822) at org.glassfish.jersey.client.JerseyInvocation.access$600(JerseyInvocation.java:90) at org.glassfish.jersey.client.JerseyInvocation$3.call(JerseyInvocation.java:693) at org.glassfish.jersey.internal.Errors.process(Errors.java:315) at org.glassfish.jersey.internal.Errors.process(Errors.java:297) at org.glassfish.jersey.internal.Errors.process(Errors.java:228) at org.glassfish.jersey.process.internal.RequestScope.runInScope(RequestScope.java:422) at org.glassfish.jersey.client.JerseyInvocation.invoke(JerseyInvocation.java:689) at org.glassfish.jersey.client.JerseyInvocation$Builder.method(JerseyInvocation.java:405) at org.glassfish.jersey.client.JerseyInvocation$Builder.get(JerseyInvocation.java:301) at com.psiincontrol.alarmservice.jaxrs.client.AlarmRestClient.getAlarms(AlarmRestClient.java:55) at com.psiincontrol.alarmservice.jaxrs.client.AlarmRestClientTest.main(AlarmRestClientTest.java:28)

Any idea how I can resolve this please ?

— Reply to this email directly or view it on GitHub https://github.com/jimmoores/quandl4j/issues/4#issuecomment-76351293.

ayushmathur86 commented 9 years ago

Hi Jim, Thanks for your firm reply. I have already provided the JAX-RS api 2.0 in pom.xml and is now resolved. I was missing jersey-common and jersey-client libraries which I have added now. The problem I'm still facing is to access the service with the provided URL. As per implementation, it should be: http://localhost:8080/AlarmLibrary/rest/alarm; but it's not the case as it doesn't open in either browser or connected through client code. Although, the JBOSS Admin console do show me the context as /AlarmLibrary.

image

ayushmathur86 commented 9 years ago

Hi Jim, I am out of options now as to why my web service cannot be connected. I tried everything I could (even performing the steps provided on other forums), but I still cannot access the service on browser or from client implementation. Could you please direct as to what can be the issue and how it can be resolved ?

jimmoores commented 9 years ago

I'm slightly unsure what these errors have to do with quandl4j. Are you saying it works when you remove quandl4j and doesn't when you add it? If you're getting 404s have you checked that your WEB-INF is being included in your deployment (in Eclipse right click on project, choose properties, go to the Deployment Template tab and see what's copied).

ayushmathur86 commented 9 years ago

Hi Jim, The problem is not with quandl4j since I included all the libraries required via pom. The only exception now is while running the client. I have checked for the WEB-INF in war file and it is being included with all libraries and classes. The service is being deployed on JBOSS successfully without any issues. But, when I'm trying to hit the URL of the service, it simply throws 404 not found error (be it from browser or rest client).

jimmoores commented 8 years ago

Closing issue