尝试使用 jersy api 连接 jaserper 服务器引发异常?
当我尝试使用 jersy api 连接 jaserper 服务器时抛出异常 java.lang.NoSuchMethodError: org.glassfish.hk2.utilities.AbstractActiveDescriptor
When i am trying to connecting jaserper server using jersy api throw exception java.lang.NoSuchMethodError: org.glassfish.hk2.utilities.AbstractActiveDescriptor
代码如下
RestClientConfiguration configuration = new RestClientConfiguration("//localhost:80/jasperserver");
JasperserverRestClient client = new JasperserverRestClient(configuration);
//Session session = client.authenticate("jasperadmin", "jasperadmin");
OperationResult<InputStream> result = client
.authenticate("jasperadmin", "jasperadmin")
.reportingService()
.report("/reports/samples/Cascading_multi_select_report")
.prepareForRun(ReportOutputFormat.HTML, 1)
//.parameter("Cascading_name_single_select", "A & U Stalker Telecommunications, Inc")
.run();
InputStream report = result.getEntity();
我得到的确切异常如下
线程主"java.lang.NoSuchMethodError 中的异常:org.glassfish.hk2.utilities.AbstractActiveDescriptor.(Ljava/util/Set;Ljava/lang/Class;Ljava/lang/String;Ljava/util/Set;Lorg/glassfish/hk2/api/DescriptorType;Lorg/glassfish/hk2/api/DescriptorVisibility;ILjava/lang/Boolean;Ljava/util/Map;)V在org.jvnet.hk2.internal.ConstantActiveDescriptor.(ConstantActiveDescriptor.java:111) 在org.jvnet.hk2.internal.ConstantActiveDescriptor.(ConstantActiveDescriptor.java:111)在org.jvnet.hk2.internal.Utilities.getLocatorDescriptor(Utilities.java:795)在org.jvnet.hk2.external.generator.ServiceLocatorGeneratorImpl.initialize(ServiceLocatorGeneratorImpl.java:69)在org.jvnet.hk2.external.generator.ServiceLocatorGeneratorImpl.create(ServiceLocatorGeneratorImpl.java:91)在org.glassfish.hk2.internal.ServiceLocatorFactoryImpl.internalCreate(ServiceLocatorFactoryImpl.java:230)在org.glassfish.hk2.internal.ServiceLocatorFactoryImpl.create(ServiceLocatorFactoryImpl.java:207)在org.glassfish.jersey.internal.inject.Injections.createLocator(Injections.java:121)在org.glassfish.jersey.internal.RuntimeDelegateImpl.(RuntimeDelegateImpl.java:60)在 sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native方法)在sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)在sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)在 java.lang.reflect.Constructor.newInstance(Constructor.java:408)在 java.lang.Class.newInstance(Class.java:433) 在javax.ws.rs.ext.FactoryFinder.newInstance(FactoryFinder.java:117) 在javax.ws.rs.ext.FactoryFinder.find(FactoryFinder.java:207) 在javax.ws.rs.ext.RuntimeDelegate.findDelegate(RuntimeDelegate.java:135)在javax.ws.rs.ext.RuntimeDelegate.getInstance(RuntimeDelegate.java:120)在 javax.ws.rs.core.UriBuilder.newInstance(UriBuilder.java:95) 在javax.ws.rs.core.UriBuilder.fromUri(UriBuilder.java:119) 在org.glassfish.jersey.client.JerseyWebTarget.(JerseyWebTarget.java:72)在org.glassfish.jersey.client.JerseyClient.target(JerseyClient.java:140)在org.glassfish.jersey.client.JerseyClient.target(JerseyClient.java:62)在com.jaspersoft.jasperserver.jaxrs.client.core.SessionStorage.init(SessionStorage.java:96)在com.jaspersoft.jasperserver.jaxrs.client.core.SessionStorage.(SessionStorage.java:56)在com.jaspersoft.jasperserver.jaxrs.client.core.JasperserverRestClient.authenticate(JasperserverRestClient.java:47)
Exception in thread "main" java.lang.NoSuchMethodError: org.glassfish.hk2.utilities.AbstractActiveDescriptor.(Ljava/util/Set;Ljava/lang/Class;Ljava/lang/String;Ljava/util/Set;Lorg/glassfish/hk2/api/DescriptorType;Lorg/glassfish/hk2/api/DescriptorVisibility;ILjava/lang/Boolean;Ljava/util/Map;)V at org.jvnet.hk2.internal.ConstantActiveDescriptor.(ConstantActiveDescriptor.java:111) at org.jvnet.hk2.internal.ConstantActiveDescriptor.(ConstantActiveDescriptor.java:111) at org.jvnet.hk2.internal.Utilities.getLocatorDescriptor(Utilities.java:795) at org.jvnet.hk2.external.generator.ServiceLocatorGeneratorImpl.initialize(ServiceLocatorGeneratorImpl.java:69) at org.jvnet.hk2.external.generator.ServiceLocatorGeneratorImpl.create(ServiceLocatorGeneratorImpl.java:91) at org.glassfish.hk2.internal.ServiceLocatorFactoryImpl.internalCreate(ServiceLocatorFactoryImpl.java:230) at org.glassfish.hk2.internal.ServiceLocatorFactoryImpl.create(ServiceLocatorFactoryImpl.java:207) at org.glassfish.jersey.internal.inject.Injections.createLocator(Injections.java:121) at org.glassfish.jersey.internal.RuntimeDelegateImpl.(RuntimeDelegateImpl.java:60) at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62) at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) at java.lang.reflect.Constructor.newInstance(Constructor.java:408) at java.lang.Class.newInstance(Class.java:433) at javax.ws.rs.ext.FactoryFinder.newInstance(FactoryFinder.java:117) at javax.ws.rs.ext.FactoryFinder.find(FactoryFinder.java:207) at javax.ws.rs.ext.RuntimeDelegate.findDelegate(RuntimeDelegate.java:135) 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 org.glassfish.jersey.client.JerseyWebTarget.(JerseyWebTarget.java:72) at org.glassfish.jersey.client.JerseyClient.target(JerseyClient.java:140) at org.glassfish.jersey.client.JerseyClient.target(JerseyClient.java:62) at com.jaspersoft.jasperserver.jaxrs.client.core.SessionStorage.init(SessionStorage.java:96) at com.jaspersoft.jasperserver.jaxrs.client.core.SessionStorage.(SessionStorage.java:56) at com.jaspersoft.jasperserver.jaxrs.client.core.JasperserverRestClient.authenticate(JasperserverRestClient.java:47)
推荐答案
你也可以不使用任何api来做这个操作.只需使用 REST 调用所需的参数调用报表即可.这个指南会帮助你.
You can also do this operation without using any api. Just call the report with the parameters you want with REST call to your jasper server. This guide will help you.
相关文章