Jump to content
We've recently updated our Privacy Statement, available here ×

Problem creating a Data Source from Java bean


pedro.felgueiras

Recommended Posts

I'm making a Java Bean to get the data derectly from an web service.
For that i have made a Maven project that are running as it suposed. It have a similar structure that a project that i have previusly made to test the Java Bean Data Source. It have a factor and an entity. 
The dependecies that the project have are the spring-web 4.1.5.RELEASE , commons-codec 1.10 and the gson 2.3.1. 
 
When testing the Data Source from the Java Bean it gives me this error: 
 
net.sf.jasperreports.engine.JRException: java.lang.reflect.InvocationTargetException	at net.sf.jasperreports.data.bean.BeanDataAdapterService.contributeParameters(BeanDataAdapterService.java:108)	at net.sf.jasperreports.data.AbstractDataAdapterService.test(AbstractDataAdapterService.java:128)	at com.jaspersoft.studio.data.wizard.AbstractDataAdapterWizard$3.run(AbstractDataAdapterWizard.java:157)	at org.eclipse.jface.operation.ModalContext$ModalContextThread.run(ModalContext.java:122)Caused by: java.lang.reflect.InvocationTargetException	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)	at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)	at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)	at java.lang.reflect.Method.invoke(Unknown Source)	at net.sf.jasperreports.data.bean.BeanDataAdapterService.contributeParameters(BeanDataAdapterService.java:83)	... 3 moreCaused by: java.lang.NoSuchMethodError: org.springframework.util.CollectionUtils.unmodifiableMultiValueMap(Lorg/springframework/util/MultiValueMap;)Lorg/springframework/util/MultiValueMap;	at org.springframework.web.util.HierarchicalUriComponents.(HierarchicalUriComponents.java:84)	at org.springframework.web.util.UriComponentsBuilder.build(UriComponentsBuilder.java:340)	at org.springframework.web.util.UriComponentsBuilder.build(UriComponentsBuilder.java:324)	at org.springframework.web.util.UriTemplate.(UriTemplate.java:69)	at org.springframework.web.client.RestTemplate.execute(RestTemplate.java:528)	at org.springframework.web.client.RestTemplate.exchange(RestTemplate.java:475)	at pt.i2s.it2s.bean.first_report.factory.ReportFactory.load(ReportFactory.java:40)	... 8 more[/code]

 

The code is : 
 
	protected static ClientHttpRequestFactory clientHttpRequestFactory;	protected static RestTemplate restTemplate;		public static List load(){		connect();		HttpHeaders headers = new HttpHeaders();		headers.setContentType(MediaType.APPLICATION_JSON);		ResponseEntity response = null;		HttpEntity httpEntity = new HttpEntity(headers);		response = restTemplate.exchange(getBaseServiceUrl()				+ "/UserService1.svc/GetAllUsers", HttpMethod.POST, httpEntity,				new ParameterizedTypeReference() {				});		JsonElement jelement = new Gson().fromJson (response.getBody(), JsonElement.class);		JsonArray jusers = jelement.getAsJsonObject().getAsJsonArray("d");		List users = new ArrayList();		for (JsonElement juser : jusers) {			users.add(new Users(juser.getAsJsonObject().get("displayText").getAsString(), juser.getAsJsonObject().get("loginName").getAsString()));		}		return users;	}				private static void connect() {		clientHttpRequestFactory = new SimpleClientHttpRequestFactory() {			@Override			protected void prepareConnection(HttpURLConnection connection,					String httpMethod) throws IOException {				super.prepareConnection(connection, httpMethod);				String authorisation = company + "\" + username + ":"						+ password;				byte[] encodedAuthorisation = Base64.encodeBase64(authorisation						.getBytes());				connection.setRequestProperty("Authorization", "Basic "						+ new String(encodedAuthorisation));			}		};		restTemplate = new RestTemplate(clientHttpRequestFactory);	}[/code]
 
 
The line 40 is:
response = restTemplate.exchange(getBaseServiceUrl()				+ "/UserService1.svc/GetAllUsers", HttpMethod.POST, httpEntity,				new ParameterizedTypeReference() {				});[/code]
 
 
 
Can any one tetll me what i'm doing wrong?  

 

Link to comment
Share on other sites

  • Replies 0
  • Created
  • Last Reply

Top Posters In This Topic

Popular Days

Top Posters In This Topic

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...