question

jagilyabos avatar image
0 Likes"
jagilyabos asked ·

OutOfMemoryError when calling getCategoryFeatures() in eBay API

Maybe, someone has an idea why I'm getting this. In my code, I need to return all the available conditions for the category that i'm passing.

 

 private static GetCategoryFeaturesCall getCatFeature(String categoryId, SiteCodeType site) {
   GetCategoryFeaturesCall request = new GetCategoryFeaturesCall(createApiContext());
   request.setSite(site);
   request.setDetailLevel(new DetailLevelCodeType[] { DetailLevelCodeType.RETURN_ALL });
   request.setCategoryID(categoryId);
   request.setOutputSelector(new String[] {"Category.ConditionEnabled", "Category.ConditionValues.Condition.ID", "Category.ConditionValues.Condition.DisplayName" });

   try {  request.getCategoryFeatures();
   } catch (Exception e) {  e.printStackTrace();  }

 

   return request;
 }
 

Every time it runs, once it gets to the call in the 'try' block, I'm getting this =>

 

99468 [http-8080-2] INFO  com.ebay.sdk.SdkAPIInterfaceServiceLocator  - loading wsdl : jar:file:/usr/local/apache-tomcat-6.0.36/webapps/SAE/WEB-INF/lib/ebysdkcore.jar!/eBaySvc.wsdl
100903 [http-8080-2] INFO  com.ebay.sdk.SdkAPIInterfaceServiceLocator  - wsdl loaded and service initialized.
Exception in thread "http-8080-2"
Exception: java.lang.OutOfMemoryError thrown from the UncaughtExceptionHandler in thread "http-8080-2"
....

 

Does anyone have any idea why? I increased the heap size 4 times, up to a 1024 already. It runs with 512mb on my Windows box in Eclipse without any issues and returns quickly. Thank you!

ebay-apigetcategoryfeaturesoom
10 |600 characters needed characters left characters exceeded

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

jagilyabos avatar image
0 Likes"
jagilyabos answered ·

Solved. Setting the site on apiContext instead of doing request.setSite(site) got rid of the OOM error. Also, I removed request.setOutputSelector() and used setViewAllNodes(true). No more OOM on the server. Decreased memory back to 256 and it returns quickly without any issues.

· Share
10 |600 characters needed characters left characters exceeded

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

jagilyabos avatar image
0 Likes"
jagilyabos answered ·

The code above runs on Linux box (CentOS release 6.3) with jdk1.7.0_03 and apache-tomcat-6.0.36

Thank you in advance!

 

· Share
10 |600 characters needed characters left characters exceeded

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.