RxJava 2 doesn't tell the error line - java

It seems to me that RxJava doesn't give good exception tracing.
One example is this which I got from Eclipse when running my unit test. It is not clear which code using the map function.
Is there any special trick to increase the tracing ability? Or is this considered as a bug?
2017-02-28 19:12:44/SGT INFO c.bt.nmdb.ndac.adapter.Bnmpv5Adapter : Current time stamp - Tue Dec 23 23:56:00 SGT 2014
2017-02-28 19:12:45/SGT TRACE c.bt.nmdb.ndac.adapter.Bnmpv5Adapter : #findAndSendDeviceCredentials()
io.reactivex.exceptions.OnErrorNotImplementedException: The mapper function returned a null value.
at io.reactivex.internal.functions.Functions$14.accept(Functions.java:229)
at io.reactivex.internal.functions.Functions$14.accept(Functions.java:226)
at io.reactivex.internal.subscribers.LambdaSubscriber.onError(LambdaSubscriber.java:75)
at io.reactivex.internal.operators.flowable.FlowableDoOnEach$DoOnEachSubscriber.onError(FlowableDoOnEach.java:109)
at io.reactivex.internal.subscribers.BasicFuseableSubscriber.onError(BasicFuseableSubscriber.java:100)
at io.reactivex.internal.subscribers.BasicFuseableSubscriber.fail(BasicFuseableSubscriber.java:110)
at io.reactivex.internal.operators.flowable.FlowableMap$MapSubscriber.onNext(FlowableMap.java:65)
at io.reactivex.internal.operators.flowable.FlowableFromArray$ArraySubscription.fastPath(FlowableFromArray.java:134)
at io.reactivex.internal.operators.flowable.FlowableFromArray$BaseArraySubscription.request(FlowableFromArray.java:87)
at io.reactivex.internal.subscribers.BasicFuseableSubscriber.request(BasicFuseableSubscriber.java:152)
at io.reactivex.internal.subscribers.BasicFuseableSubscriber.request(BasicFuseableSubscriber.java:152)
at io.reactivex.internal.subscribers.LambdaSubscriber.request(LambdaSubscriber.java:110)
at io.reactivex.internal.operators.flowable.FlowableInternalHelper$RequestMax.accept(FlowableInternalHelper.java:244)
at io.reactivex.internal.operators.flowable.FlowableInternalHelper$RequestMax.accept(FlowableInternalHelper.java:240)
at io.reactivex.internal.subscribers.LambdaSubscriber.onSubscribe(LambdaSubscriber.java:48)
at io.reactivex.internal.subscribers.BasicFuseableSubscriber.onSubscribe(BasicFuseableSubscriber.java:66)
at io.reactivex.internal.subscribers.BasicFuseableSubscriber.onSubscribe(BasicFuseableSubscriber.java:66)
at io.reactivex.internal.operators.flowable.FlowableFromArray.subscribeActual(FlowableFromArray.java:37)
at io.reactivex.Flowable.subscribe(Flowable.java:12901)
at io.reactivex.internal.operators.flowable.FlowableMap.subscribeActual(FlowableMap.java:37)
at io.reactivex.Flowable.subscribe(Flowable.java:12901)
at io.reactivex.internal.operators.flowable.FlowableDoOnEach.subscribeActual(FlowableDoOnEach.java:48)
at io.reactivex.Flowable.subscribe(Flowable.java:12901)
at io.reactivex.Flowable.subscribe(Flowable.java:12886)
at io.reactivex.Flowable.subscribe(Flowable.java:12746)
at michsan.adapter.Bnmpv5Adapter_On_FindAndSendDeviceCredentials_TestCase.shouldFindDeviceCredentialsAndBuildResponses(Bnmpv5Adapter_On_FindAndSendDeviceCredentials_TestCase.java:71)
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 org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50)
at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47)
at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:26)
at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:78)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:57)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:86)
at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:459)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:675)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:382)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:192)
Caused by: java.lang.NullPointerException: The mapper function returned a null value.
at io.reactivex.internal.functions.ObjectHelper.requireNonNull(ObjectHelper.java:39)
at io.reactivex.internal.operators.flowable.FlowableMap$MapSubscriber.onNext(FlowableMap.java:63)
... 43 more
Exception in thread "main" io.reactivex.exceptions.OnErrorNotImplementedException: The mapper function returned a null value.
at io.reactivex.internal.functions.Functions$14.accept(Functions.java:229)
at io.reactivex.internal.functions.Functions$14.accept(Functions.java:226)
at io.reactivex.internal.subscribers.LambdaSubscriber.onError(LambdaSubscriber.java:75)
at io.reactivex.internal.operators.flowable.FlowableDoOnEach$DoOnEachSubscriber.onError(FlowableDoOnEach.java:109)
at io.reactivex.internal.subscribers.BasicFuseableSubscriber.onError(BasicFuseableSubscriber.java:100)
at io.reactivex.internal.subscribers.BasicFuseableSubscriber.fail(BasicFuseableSubscriber.java:110)
at io.reactivex.internal.operators.flowable.FlowableMap$MapSubscriber.onNext(FlowableMap.java:65)
at io.reactivex.internal.operators.flowable.FlowableFromArray$ArraySubscription.fastPath(FlowableFromArray.java:134)
at io.reactivex.internal.operators.flowable.FlowableFromArray$BaseArraySubscription.request(FlowableFromArray.java:87)
at io.reactivex.internal.subscribers.BasicFuseableSubscriber.request(BasicFuseableSubscriber.java:152)
at io.reactivex.internal.subscribers.BasicFuseableSubscriber.request(BasicFuseableSubscriber.java:152)
at io.reactivex.internal.subscribers.LambdaSubscriber.request(LambdaSubscriber.java:110)
at io.reactivex.internal.operators.flowable.FlowableInternalHelper$RequestMax.accept(FlowableInternalHelper.java:244)
at io.reactivex.internal.operators.flowable.FlowableInternalHelper$RequestMax.accept(FlowableInternalHelper.java:240)
at io.reactivex.internal.subscribers.LambdaSubscriber.onSubscribe(LambdaSubscriber.java:48)
at io.reactivex.internal.subscribers.BasicFuseableSubscriber.onSubscribe(BasicFuseableSubscriber.java:66)
at io.reactivex.internal.subscribers.BasicFuseableSubscriber.onSubscribe(BasicFuseableSubscriber.java:66)
at io.reactivex.internal.operators.flowable.FlowableFromArray.subscribeActual(FlowableFromArray.java:37)
at io.reactivex.Flowable.subscribe(Flowable.java:12901)
at io.reactivex.internal.operators.flowable.FlowableMap.subscribeActual(FlowableMap.java:37)
at io.reactivex.Flowable.subscribe(Flowable.java:12901)
at io.reactivex.internal.operators.flowable.FlowableDoOnEach.subscribeActual(FlowableDoOnEach.java:48)
at io.reactivex.Flowable.subscribe(Flowable.java:12901)
at io.reactivex.Flowable.subscribe(Flowable.java:12886)
at io.reactivex.Flowable.subscribe(Flowable.java:12746)
at michsan.adapter.Bnmpv5Adapter_On_FindAndSendDeviceCredentials_TestCase.shouldFindDeviceCredentialsAndBuildResponses(Bnmpv5Adapter_On_FindAndSendDeviceCredentials_TestCase.java:71)
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 org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50)
at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47)
at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:26)
at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:78)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:57)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:86)
at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:459)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:675)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:382)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:192)
Caused by: java.lang.NullPointerException: The mapper function returned a null value.
at io.reactivex.internal.functions.ObjectHelper.requireNonNull(ObjectHelper.java:39)
at io.reactivex.internal.operators.flowable.FlowableMap$MapSubscriber.onNext(FlowableMap.java:63)
... 43 more

Building up on akarnokd's answer, you want to use RxJavaPlugins to add a hook for each Flowable, Observable,... For instance, as akarnokd does in his RxJava2Extensions library with Flowables:
RxJavaPlugins.setOnFlowableAssembly(new Function<Flowable, Flowable>() {
#Override
public Flowable apply(Flowable f) throws Exception {
// Play with the Stack, collect info
return new FlowableOnAssembly(f);
}
});
This way, you can collect info (the stack, for instance) in that FlowableOnAssembly. At this point, if you can capture crashes, you can already access that info you added (stacktrace, and whatever else you put into FlowableOnAssembly).
For easier debugging, even in remote devices, you can set a DefaultUncaughtExceptionHandler to capture any crash and print the info you collected in FlowableOnAssembly, for instance:
Thread.setDefaultUncaughtExceptionHandler(new Thread.UncaughtExceptionHandler() {
#Override
public void uncaughtException(Thread t, Throwable e) {
if (e instanceOf FlowableOnAssembly) {
// Print the info you captured
}
}
};
This mechanism will be intercepting everything RxJava2 does, so you probably want to put/remove enable/disable it easily. You can go use a small library I wrote for this purpose in:
RxJava2Debug
RxJava2Debug will create a nice simple StackTrace for you. Optionally, it will also filter it so the first entry of the root cause points to your code (this way services like Crashlytics can collate different errors for you).

Related

Getting IllegalStateException while calling restTemplate.exchange()

Getting the java.lang.IllegalStateException while trying to read the data from json file using RestTemplate.exchange(). Tried many ways, but no success. Any suggestion would be appreciate.
Code:
ResponseEntity<GetCustomerResponse> customerResponse = restTemplate.exchange("J:\Backup\FILWORKSPACE\tapp100997_accountopeningservice\target\classes\testdata\CustomerEnquiryApiResponse.json",HttpMethod.POST, request, GetCustomerResponse.class);
Exception :
java.lang.IllegalStateException: Could not create URI object: Illegal character in opaque part at index 2: J:\Backup\FILWORKSPACE\tapp100997_accountopeningservice\target\classes\testdata\CustomerEnquiryApiResponse.json
at org.springframework.web.util.DefaultUriTemplateHandler.createUri(DefaultUriTemplateHandler.java:168)
at org.springframework.web.util.DefaultUriTemplateHandler.expandInternal(DefaultUriTemplateHandler.java:105)
at org.springframework.web.util.AbstractUriTemplateHandler.expand(AbstractUriTemplateHandler.java:106)
at org.springframework.web.client.RestTemplate.execute(RestTemplate.java:612)
at org.springframework.web.client.RestTemplate.exchange(RestTemplate.java:531)
at com.fidintl.bs.accountopening.rulengine.rules.CustomerRule.getCustomerDetails(CustomerRule.java:169)
at com.fidintl.bs.accountopening.rulengine.rules.CustomerRule.execute(CustomerRule.java:55)
at com.fidintl.bs.accountopening.rulengine.rules.CustomerRuleTest.testCustomerEligibilityWithBlankData(CustomerRuleTest.java:122)
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:497)
at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50)
at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47)
at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:26)
at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:78)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:57)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
at org.mockito.internal.runners.JUnit45AndHigherRunnerImpl.run(JUnit45AndHigherRunnerImpl.java:37)
at org.mockito.runners.MockitoJUnitRunner.run(MockitoJUnitRunner.java:62)
at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:86)
at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:538)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:760)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:460)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:206)
Caused by: java.net.URISyntaxException: Illegal character in opaque part at index 2: J:\Backup\FILWORKSPACE\tapp100997_accountopeningservice\target\classes\testdata\CustomerEnquiryApiResponse.json
at java.net.URI$Parser.fail(URI.java:2848)
at java.net.URI$Parser.checkChars(URI.java:3021)
at java.net.URI$Parser.parse(URI.java:3058)
at java.net.URI.<init>(URI.java:588)
at org.springframework.web.util.DefaultUriTemplateHandler.createUri(DefaultUriTemplateHandler.java:165)
... 33 more
Json file Data :
{"success":true,"errors":[],"customerDetails":[{"customerReference":{"type":"PARTY_REFERENCE_NUMBER","identifier":"500008713684"},"success":true,"errors":[],"customers":[{"customerType":"INDIVIDUAL_INVESTOR","individualClientDetails":{"personalDetails":{"personName":{"title":"Miss","initials":null,"firstName":"User","lastName":"Payroll","fullName":"Miss User Payroll","printName":"Miss User Payroll"},"dateOfBirth":"1970-12-01","dateOfDeath":null,"gender":"UNKNOWN","maritalStatus":"UNKNOWN","townOfBirth":null,"countryOfBirth":"GB","nationalityDetails":[{"countryCode":"GB","primaryNationalityFlag":null,"reportingNationalityFlag":"Y","reportingDetails":{"nationalIdType":"TAX_IDENTIFIER","nationalId":"AB109999D"}},{"countryCode":"GB","primaryNationalityFlag":"Y","reportingNationalityFlag":null,"reportingDetails":null}],"countriesOfResidence":[{"countryCode":"GB","countryName":"UNITED KINGDOM","primaryCountryOfResidence":"Y"}],"age":"48","niNoIssuedFlag":"Y","anticipatedRetirementAge":null},"crownEmployeeFlag":"N","planParticipantDetails":null,"employerDetails":null,"occupation":null},"institutionalClientDetails":null,"partyReferenceNumber":"500008713684","alternativeReferences":[{"identifierType":"SONATA_CLIENT_ID","identifier":"100668431"},{"identifierType":"INVESTOR_REFERENCE_NUMBER","identifier":"1004664408"}],"lifeCycleStatus":"INVESTOR","inceptionDate":"2019-03-19","dormancyDate":null,"directAdvisedIndicator":"DIRECT_AND_ADVISED","lostContactFlag":"N","probateFlag":"N","courtOfProtectionFlag":"N","languagePreference":"ENG","postalAddresses":[{"contactRole":"CORRESPONDENCE_ADDRESS","nonStructuredAddressDetails":{"line1":"30 Benedict Drive","line2":null,"line3":"FELTHAM","line4":null},"structuredAddressDetails":null,"overrideAddress":"N","administrativeArea":null,"postalTown":"FELTHAM","postalCode":"TW14 8JL","region":"UK","countryCode":"GB","setBy":"500008713684","status":"ACTIVE","validity":{"lastValidatedDate":null,"validFrom":"2019-03-19 18:05:07.000+0000","validTo":null},"countryName":"UNITED KINGDOM"},{"contactRole":"REGISTERED_ADDRESS","nonStructuredAddressDetails":{"line1":"30 Benedict Drive","line2":null,"line3":"FELTHAM","line4":null},"structuredAddressDetails":null,"overrideAddress":"N","administrativeArea":null,"postalTown":"FELTHAM","postalCode":"TW14 8JL","region":"UK","countryCode":"GB","setBy":"500008713684","status":"ACTIVE","validity":{"lastValidatedDate":null,"validFrom":"2019-03-19 18:05:07.000+0000","validTo":null},"countryName":"UNITED KINGDOM"}],"classifications":[{"classificationScheme":"FATCA_US","classificationCode":"INUS05","classificationDescription":"Non US Status"},{"classificationScheme":"OFFICE_CODE","classificationCode":"OAKH","classificationDescription":"FIL Investments International"},{"classificationScheme":"MIFID","classificationCode":"RE","classificationDescription":"Retail"},{"classificationScheme":"GFAS_CUSTOMER_TYPE","classificationCode":"P","classificationDescription":"Private Individual"}],"externalIdentifiers":[{"identifierName":"TAX_IDENTIFICATION_NUMBER","value":"AB109999D","country":"GB","tinNotIssued":"NOT_CONFIRMED"},{"identifierName":"NATIONAL_INSURANCE_NUMBER","value":"AB109999D","country":"GB","tinNotIssued":null}],"salutations":null,"documentDeliveryPreferenceDetails":{"documentDeliveryPreferences":[{"documentType":"COT","deliveryMethod":"POST_AND_ONLINE"},{"documentType":"SAV","deliveryMethod":"POST_AND_ONLINE"},{"documentType":"PLC","deliveryMethod":"POST_AND_ONLINE"},{"documentType":"RRL","deliveryMethod":"POST_AND_ONLINE"},{"documentType":"WPL","deliveryMethod":"POST_AND_ONLINE"},{"documentType":"DTL","deliveryMethod":"POST_AND_ONLINE"},{"documentType":"ITR","deliveryMethod":"POST_AND_ONLINE"},{"documentType":"WL","deliveryMethod":"POST_AND_ONLINE"},{"documentType":"MLC","deliveryMethod":"POST_AND_ONLINE"}],"emailNotificationFlag":"N"},"electronicAddresses":null,"telephones":null,"partyAssociations":null,"amlStatusDetails":null,"bankAccountDetails":null,"w8BenDetails":null,"reportingCurrency":null,"associatedFILEmployee":null,"employmentStatus":null,"marketingSource":null,"partyGenericVariables":{"genericVariables":[{"name":"PLATFORM","values":["SONATA"]},{"name":"PDP_CONSENT","values":["YES"]}]},"restrictions":null,"roleToFIL":null,"marketingPreferences":[],"applicationTerms":[{"applicationTermsAndCondition":{"applicationName":"ISA Declaration","applicationVersion":"1.0","applicationTermsAndConditionsVersion":"2.0","dateAccepted":"2015-03-12 00:00:00.000+0000","applicationType":"DOCUMENT"}},{"applicationTermsAndCondition":{"applicationName":"Doing Business with Fidelity","applicationVersion":"1.0","applicationTermsAndConditionsVersion":"2.0","dateAccepted":"2015-03-12 00:00:00.000+0000","applicationType":"DOCUMENT"}},{"applicationTermsAndCondition":{"applicationName":"Payroll ISA","applicationVersion":"1.0","applicationTermsAndConditionsVersion":"2.0","dateAccepted":"2015-03-12 00:00:00.000+0000","applicationType":"DOCUMENT"}},{"applicationTermsAndCondition":{"applicationName":"Fidelity's Privacy Policy","applicationVersion":"1.0","applicationTermsAndConditionsVersion":"2.0","dateAccepted":"2015-03-12 00:00:00.000+0000","applicationType":"DOCUMENT"}},{"applicationTermsAndCondition":{"applicationName":"US Person","applicationVersion":"1.0","applicationTermsAndConditionsVersion":"2.0","dateAccepted":"2015-03-12 00:00:00.000+0000","applicationType":"DOCUMENT"}},{"applicationTermsAndCondition":{"applicationName":"Client Terms","applicationVersion":"1.0","applicationTermsAndConditionsVersion":"2.0","dateAccepted":"2015-03-12 00:00:00.000+0000","applicationType":"DOCUMENT"}},{"applicationTermsAndCondition":{"applicationName":"Online Terms","applicationVersion":"1.0","applicationTermsAndConditionsVersion":"2.0","dateAccepted":"2015-03-12 00:00:00.000+0000","applicationType":"DOCUMENT"}}],"createdBy":null,"assignedTo":null,"updatedBy":null,"auditDetails":null,"standingPreferences":null,"literaturePreferences":null,"documentDeliveryPreferences":null,"pensionDetails":null,"migration":null,"pensionPlatform":null,"clientRegionDetails":null}]}]}
From docs https://docs.spring.io/spring/docs/current/javadoc-api/org/springframework/web/client/RestTemplate.html#exchange-java.lang.String-org.springframework.http.HttpMethod-org.springframework.http.HttpEntity-java.lang.Class-java.lang.Object...-,
Execute the HTTP method to the given URI template, writing the given request entity to the request, and returns the response as ResponseEntity.
You need to use valid hhtp url.

how to handle nested #DynamoDBDocument

I have a domain called UserAdvice which has a variable of type PriceWithPaf, which has 2 variables in it, which are again of custom-type/class-object. I have declared both the inner-objects/variables and the parent class which is a variable in the Domain as #DynamoDBDocument.
The best part is I am able to save the data exactly the way I want in DynamoDB Database but when I read the data back to object I get following error:
(I am using spring data for dynamoDB - from github & this error is shown in test case - where I use AmazonDynamoDBLocal)
com.amazonaws.services.dynamodbv2.datamodeling.DynamoDBMappingException: UserAdvise[averageEntryPrice]; could not unconvert attribute
at com.amazonaws.services.dynamodbv2.datamodeling.DynamoDBMapperTableModel.unconvert(DynamoDBMapperTableModel.java:271)
at com.amazonaws.services.dynamodbv2.datamodeling.DynamoDBMapper.privateMarshallIntoObject(DynamoDBMapper.java:456)
at com.amazonaws.services.dynamodbv2.datamodeling.DynamoDBMapper.marshallIntoObjects(DynamoDBMapper.java:484)
at com.amazonaws.services.dynamodbv2.datamodeling.PaginatedScanList.<init>(PaginatedScanList.java:64)
at com.amazonaws.services.dynamodbv2.datamodeling.DynamoDBMapper.scan(DynamoDBMapper.java:1458)
at com.amazonaws.services.dynamodbv2.datamodeling.AbstractDynamoDBMapper.scan(AbstractDynamoDBMapper.java:216)
at org.socialsignin.spring.data.dynamodb.core.DynamoDBTemplate.scan(DynamoDBTemplate.java:112)
at org.socialsignin.spring.data.dynamodb.repository.support.SimpleDynamoDBCrudRepository.findAll(SimpleDynamoDBCrudRepository.java:166)
at org.socialsignin.spring.data.dynamodb.repository.support.SimpleDynamoDBCrudRepository.findAll(SimpleDynamoDBCrudRepository.java:43)
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:497)
at org.springframework.data.repository.core.support.RepositoryFactorySupport$QueryExecutorMethodInterceptor.executeMethodOn(RepositoryFactorySupport.java:503)
at org.springframework.data.repository.core.support.RepositoryFactorySupport$QueryExecutorMethodInterceptor.doInvoke(RepositoryFactorySupport.java:488)
at org.springframework.data.repository.core.support.RepositoryFactorySupport$QueryExecutorMethodInterceptor.invoke(RepositoryFactorySupport.java:460)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)
at org.springframework.data.projection.DefaultMethodInvokingMethodInterceptor.invoke(DefaultMethodInvokingMethodInterceptor.java:61)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)
at org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:92)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)
at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:213)
at com.sun.proxy.$Proxy68.findAll(Unknown Source)
at com.wt.api.write.WDAuthenticationShould.return_200_for_virtual_and_real_advises_and_wallet_amount(WDAuthenticationShould.java:1079)
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:497)
at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50)
at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47)
at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:26)
at org.springframework.test.context.junit4.statements.RunBeforeTestMethodCallbacks.evaluate(RunBeforeTestMethodCallbacks.java:73)
at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:27)
at org.springframework.test.context.junit4.statements.RunAfterTestMethodCallbacks.evaluate(RunAfterTestMethodCallbacks.java:82)
at org.junit.rules.ExternalResource$1.evaluate(ExternalResource.java:48)
at org.junit.contrib.java.lang.system.EnvironmentVariables$EnvironmentVariablesStatement.evaluate(EnvironmentVariables.java:71)
at org.junit.rules.RunRules.evaluate(RunRules.java:20)
at org.springframework.test.context.junit4.statements.SpringRepeat.evaluate(SpringRepeat.java:73)
at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325)
at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:224)
at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:83)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
at org.springframework.test.context.junit4.statements.RunBeforeTestClassCallbacks.evaluate(RunBeforeTestClassCallbacks.java:61)
at org.springframework.test.context.junit4.statements.RunAfterTestClassCallbacks.evaluate(RunAfterTestClassCallbacks.java:68)
at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.run(SpringJUnit4ClassRunner.java:163)
at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:86)
at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:459)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:675)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:382)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:192)
Caused by: com.amazonaws.services.dynamodbv2.datamodeling.DynamoDBMappingException: PriceWithPaf[nonDividendPaf]; could not unconvert attribute
at com.amazonaws.services.dynamodbv2.datamodeling.DynamoDBMapperTableModel.unconvert(DynamoDBMapperTableModel.java:271)
at com.amazonaws.services.dynamodbv2.datamodeling.StandardModelFactories$Rules$ObjectDocumentMap$1.unconvert(StandardModelFactories.java:603)
at com.amazonaws.services.dynamodbv2.datamodeling.StandardModelFactories$Rules$ObjectDocumentMap$1.unconvert(StandardModelFactories.java:598)
at com.amazonaws.services.dynamodbv2.datamodeling.DynamoDBTypeConverter$DelegateConverter.unconvert(DynamoDBTypeConverter.java:109)
at com.amazonaws.services.dynamodbv2.datamodeling.DynamoDBTypeConverter$NullSafeConverter.unconvert(DynamoDBTypeConverter.java:128)
at com.amazonaws.services.dynamodbv2.datamodeling.DynamoDBTypeConverter$ExtendedConverter.unconvert(DynamoDBTypeConverter.java:88)
at com.amazonaws.services.dynamodbv2.datamodeling.DynamoDBMapperFieldModel.unconvert(DynamoDBMapperFieldModel.java:146)
at com.amazonaws.services.dynamodbv2.datamodeling.DynamoDBMapperFieldModel.unconvertAndSet(DynamoDBMapperFieldModel.java:164)
at com.amazonaws.services.dynamodbv2.datamodeling.DynamoDBMapperTableModel.unconvert(DynamoDBMapperTableModel.java:267)
... 57 more
Caused by: com.amazonaws.services.dynamodbv2.datamodeling.DynamoDBMappingException: could not invoke null on class com.wt.domain.PriceWithPaf with value 1.0 of type class java.lang.Double
at com.amazonaws.services.dynamodbv2.datamodeling.StandardBeanProperties$MethodReflect.set(StandardBeanProperties.java:136)
at com.amazonaws.services.dynamodbv2.datamodeling.DynamoDBMapperFieldModel.set(DynamoDBMapperFieldModel.java:111)
at com.amazonaws.services.dynamodbv2.datamodeling.DynamoDBMapperFieldModel.unconvertAndSet(DynamoDBMapperFieldModel.java:164)
at com.amazonaws.services.dynamodbv2.datamodeling.DynamoDBMapperTableModel.unconvert(DynamoDBMapperTableModel.java:267)
... 65 more
Caused by: java.lang.NullPointerException
at com.amazonaws.services.dynamodbv2.datamodeling.StandardBeanProperties$MethodReflect.set(StandardBeanProperties.java:133)
... 68 more
After facing this issue and trying to solve it for 3 days. Finally came across this article , it worked .
My mistake was :
Initial
#DynamoDBAttribute
public String getPeriod() {
return period;
}
public void set_period(String period) {
this.period = period;
}
Changed it to :
#DynamoDBAttribute
public String getPeriod() {
return period;
}
public void setPeriod(String period) {
this.period = period;
}
It worked - the error was due to wrong getter setup - one of the getter was suppose to return custom object (PriceWithPaf) instead of returning a double.
This made the unmapping of dynamoDBDocument go wrong.
using DynamoDBDocument is easy - just put this annotation on all the class which acts as a variable to the Domain Class. and make sure your getter and setter are default/not manipulated ;)

org.mockito.exceptions.misusing.WrongTypeOfReturnValue: ArrayList cannot be returned by toString()

In my code i set the return value of a mock:
when(spreadSheetHandler.readData("2"))
.thenReturn(jsonUtility.fromSpreadSheetJsonFile());
this is readData signature
public List<List<String>> readData(String range) throws IOException {
and this is
public List<List<String>> fromSpreadSheetJsonFile() {
List<List<String>> fromJsonFile = null;
ObjectMapper mapper = new ObjectMapper();
TypeReference<List<List<String>>> mapType = new TypeReference<List<List<String>>>() {};
try {
fromJsonFile = mapper.readValue(new File("/Users/eladb/WorkspaceQa/sdk-service/src/test/resources/spreadsheetList.json"), mapType);
} catch (Exception ex) {
logger.error("json parsing failure", ex);
}
return fromJsonFile;
}
fromSpreadSheetJsonFile finishes successfully
but then i get an error:
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 org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50)
at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47)
at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:26)
at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:78)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:57)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
at org.junit.runner.JUnitCore.run(JUnitCore.java:137)
at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:68)
at com.intellij.rt.execution.junit.IdeaTestRunner$Repeater.startRunnerWithArgs(IdeaTestRunner.java:47)
at com.intellij.rt.execution.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:242)
at com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:70)
Caused by: org.mockito.exceptions.misusing.WrongTypeOfReturnValue:
ArrayList cannot be returned by toString()
toString() should return String
***
If you're unsure why you're getting above error read on.
Due to the nature of the syntax above problem might occur because:
1. This exception *might* occur in wrongly written multi-threaded tests.
Please refer to Mockito FAQ on limitations of concurrency testing.
2. A spy is stubbed using when(spy.foo()).then() syntax. It is safer to stub spies -
- with doReturn|Throw() family of methods. More in javadocs for Mockito.spy() method.
at com.waze.sdkClient.servlets.ClientRunner_PublishTest.readFromSpreadsheet3Rows_shouldPublish2Times(ClientRunner_PublishTest.java:51)
... 23 more
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 org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50)
at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47)
at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:26)
at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:78)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:57)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
at org.junit.runner.JUnitCore.run(JUnitCore.java:137)
at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:68)
at com.intellij.rt.execution.junit.IdeaTestRunner$Repeater.startRunnerWithArgs(IdeaTestRunner.java:47)
at com.intellij.rt.execution.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:242)
at com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:70)
Caused by: org.mockito.exceptions.misusing.WrongTypeOfReturnValue:
ArrayList cannot be returned by toString()
toString() should return String
***
If you're unsure why you're getting above error read on.
Due to the nature of the syntax above problem might occur because:
1. This exception *might* occur in wrongly written multi-threaded tests.
Please refer to Mockito FAQ on limitations of concurrency testing.
2. A spy is stubbed using when(spy.foo()).then() syntax. It is safer to stub spies -
- with doReturn|Throw() family of methods. More in javadocs for Mockito.spy() method.
what can cause it? as i return List> as expected?

Hibernate create a copy of entity in listener

In my application I have an instance of A, when I update Ai, I want to create a copy of Ai with all previous values and insert that.
To do this work, I made a PreUpdateEventListener and in the onPreUpdate method, I want to create that clone, and then save it as a new instance, so assign Id:0 and then treat it as a new insertion.
To do that, I've:
from the SessionFactory, I opened a new Session
from that new session, using the Ai identifier, I've loaded the instance with previous state
I closed the newly created session
then I created a new instance, the clone, and then I copied into all the values treating associations so they could be treated as new ones
then I saved the new instance, the clone, in the current session
Everything seems to work, but when my code calls the flush (the caller code) I get a fantastic:
org.hibernate.AssertionFailure: collection [null] was not processed by flush()
at org.hibernate.engine.spi.CollectionEntry.postFlush(CollectionEntry.java:214)
at org.hibernate.event.internal.AbstractFlushingEventListener.postFlush(AbstractFlushingEventListener.java:369)
at org.hibernate.event.internal.DefaultFlushEventListener.onFlush(DefaultFlushEventListener.java:40)
at org.hibernate.internal.SessionImpl.flush(SessionImpl.java:1295)
at it.xyxyx.test.DaoBaseTest.FlushUnitOfWork(DaoBaseTest.java:28)
at it.xyxyx.service.dao.PlanDaoTest.testCan_query_for_plan_audit_with_plan_group_id(PlanDaoTest.java:344)
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 org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50)
at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47)
at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
at org.springframework.test.context.junit4.statements.RunBeforeTestMethodCallbacks.evaluate(RunBeforeTestMethodCallbacks.java:75)
at org.springframework.test.context.junit4.statements.RunAfterTestMethodCallbacks.evaluate(RunAfterTestMethodCallbacks.java:86)
at org.springframework.test.context.junit4.statements.SpringRepeat.evaluate(SpringRepeat.java:84)
at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325)
at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:254)
at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:89)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
at org.springframework.test.context.junit4.statements.RunBeforeTestClassCallbacks.evaluate(RunBeforeTestClassCallbacks.java:61)
at org.springframework.test.context.junit4.statements.RunAfterTestClassCallbacks.evaluate(RunAfterTestClassCallbacks.java:70)
at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.run(SpringJUnit4ClassRunner.java:193)
at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:86)
at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:459)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:675)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:382)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:192)
Any help is apprechiated!
Thanks in advance

Iterating through large ResultSets closes my JTDS connection

I'm writing code whose purpose is to read all records from two not-so-small tables. Table A has about 500k records and 25 columns, and Table B has a little under 200k records and 143 columns.
The tables are located on two separate SQL Server 2008 databases and I have no trouble establishing a connection to them. I use jtds-1.3.1.jar as my JDBC Driver. The problem is that I always get an exception before I can read all their records, and the exception varies between
java.sql.SQLException: I/O Error: socket closed
and
java.sql.SQLException: I/O Error: Stream 2 attempting to read when no request has been sent
These exceptions always happen after reading about 69k records from Table A or 12.5k records from Table B.
My connection String is:
jdbc:jtds:sqlserver://host:port;databaseName=XXX;user=XXX;password=XXX;useCursors=true;charset=ISO-8859-1
My code:
Statement st = conn.createStatement(ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_READ_ONLY);
st.setFetchDirection(ResultSet.FETCH_FORWARD);
st.setFetchSize(100);
ResultSet rs = st.executeQuery("SELECT * FROM TABLE A");
int counter = 0;
while (rs.next()) {
counter++;
if (counter % 2000 == 0) {
System.out.println(counter + " records.");
}
}
The first exception:
java.sql.SQLException: I/O Error: socket closed
at net.sourceforge.jtds.jdbc.TdsCore.nextToken(TdsCore.java:2481)
at net.sourceforge.jtds.jdbc.TdsCore.getNextRow(TdsCore.java:805)
at net.sourceforge.jtds.jdbc.MSCursorResultSet.processOutput(MSCursorResultSet.java:959)
at net.sourceforge.jtds.jdbc.MSCursorResultSet.cursorFetch(MSCursorResultSet.java:719)
at net.sourceforge.jtds.jdbc.MSCursorResultSet.next(MSCursorResultSet.java:1137)
at com.mycompany.client.MyCopyTest.testSelectFromTable2(MyCopyTest.java:97)
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 org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50)
at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47)
at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:78)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:57)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:50)
at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:459)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:675)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:382)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:192)
Caused by: java.net.SocketException: socket closed
at java.net.SocketInputStream.socketRead0(Native Method)
at java.net.SocketInputStream.read(SocketInputStream.java:152)
at java.net.SocketInputStream.read(SocketInputStream.java:122)
at java.io.DataInputStream.readFully(DataInputStream.java:195)
at java.io.DataInputStream.readFully(DataInputStream.java:169)
at net.sourceforge.jtds.jdbc.SharedSocket.readPacket(SharedSocket.java:850)
at net.sourceforge.jtds.jdbc.SharedSocket.getNetPacket(SharedSocket.java:731)
at net.sourceforge.jtds.jdbc.ResponseStream.getPacket(ResponseStream.java:477)
at net.sourceforge.jtds.jdbc.ResponseStream.read(ResponseStream.java:114)
at net.sourceforge.jtds.jdbc.ResponseStream.readShort(ResponseStream.java:319)
at net.sourceforge.jtds.jdbc.TdsData.readData(TdsData.java:959)
at net.sourceforge.jtds.jdbc.TdsCore.tdsRowToken(TdsCore.java:3175)
at net.sourceforge.jtds.jdbc.TdsCore.nextToken(TdsCore.java:2433)
... 28 more
The second exception:
java.sql.SQLException: I/O Error: Stream 2 attempting to read when no request has been sent
at net.sourceforge.jtds.jdbc.TdsCore.nextToken(TdsCore.java:2481)
at net.sourceforge.jtds.jdbc.TdsCore.getNextRow(TdsCore.java:805)
at net.sourceforge.jtds.jdbc.MSCursorResultSet.processOutput(MSCursorResultSet.java:959)
at net.sourceforge.jtds.jdbc.MSCursorResultSet.cursorFetch(MSCursorResultSet.java:719)
at net.sourceforge.jtds.jdbc.MSCursorResultSet.next(MSCursorResultSet.java:1137)
at com.mycompany.client.MyCopyTest.testSelectFromTable2(MyCopyTest.java:96)
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 org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50)
at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47)
at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:78)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:57)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:50)
at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:459)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:675)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:382)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:192)
Caused by: java.io.IOException: Stream 2 attempting to read when no request has been sent
at net.sourceforge.jtds.jdbc.SharedSocket.getNetPacket(SharedSocket.java:724)
at net.sourceforge.jtds.jdbc.ResponseStream.getPacket(ResponseStream.java:477)
at net.sourceforge.jtds.jdbc.ResponseStream.read(ResponseStream.java:146)
at net.sourceforge.jtds.jdbc.ResponseStream.readString(ResponseStream.java:301)
at net.sourceforge.jtds.jdbc.ResponseStream.readNonUnicodeString(ResponseStream.java:285)
at net.sourceforge.jtds.jdbc.TdsData.readData(TdsData.java:961)
at net.sourceforge.jtds.jdbc.TdsCore.tdsRowToken(TdsCore.java:3175)
at net.sourceforge.jtds.jdbc.TdsCore.nextToken(TdsCore.java:2433)
... 28 more
I've searched a lot but only found questions regarding authentication issues or invalid data that the driver couldn't parse, which I believe it's not the case here. Is there anything obvious I'm missing?
Any inputs will be highly appreciated.

Categories

Resources