<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: ANet Java SDK - ExceptionInInitializerError coming from HttpUtility.postData() in Integration and Testing</title>
    <link>https://community.developer.cybersource.com/t5/Integration-and-Testing/ANet-Java-SDK-ExceptionInInitializerError-coming-from/m-p/56524#M31310</link>
    <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.developer.cybersource.com/t5/user/viewprofilepage/user-id/21017"&gt;@mdmaurer&lt;/a&gt;,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I personally don't have much experience with Java in Oracle DB. I hope some other developers would see this and be able to offer some assistance.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I can offer general troubleshooting tips, like making sure that Oracle is seeing the classes and dependencies from the SDK in the correct location. Make sure the buildpath or classpath is correct and the sdk and all its dependencies are correctly added.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Make sure that the version of the SDK that you're compiling against is the same as what's installed in Oracle DB and that all of the same components are there.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Other general troubleshooting tips for "NoClassDefFoundError"} can be found here:&amp;nbsp;&lt;A href="http://javarevisited.blogspot.com/2011/06/noclassdeffounderror-exception-in.html" target="_blank"&gt;http://javarevisited.blogspot.com/2011/06/noclassdeffounderror-exception-in.html&lt;/A&gt;&lt;/P&gt;</description>
    <pubDate>Tue, 27 Dec 2016 16:46:10 GMT</pubDate>
    <dc:creator>Aaron</dc:creator>
    <dc:date>2016-12-27T16:46:10Z</dc:date>
    <item>
      <title>ANet Java SDK - ExceptionInInitializerError coming from HttpUtility.postData()</title>
      <link>https://community.developer.cybersource.com/t5/Integration-and-Testing/ANet-Java-SDK-ExceptionInInitializerError-coming-from/m-p/56507#M31295</link>
      <description>&lt;P&gt;I wrote a Java class that has methods implementing calls to the&amp;nbsp;Anet Java API for processing basic credit card transactions. Works fine when calling it from a web app, and I get valid responses back from Anet. However, when trying to call it from Java running in Oracle DB then I get the following errors:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;When trying an &lt;STRONG&gt;AUTH_ONLY_TRANSACTION&lt;/STRONG&gt; or &lt;STRONG&gt;AUTH_CAPTURE_TRANSACTION&lt;/STRONG&gt;:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The FIRST time it runs, it throws this error:&lt;/P&gt;&lt;P&gt;&lt;FONT color="#993300"&gt;&lt;EM&gt;Dec 21, 2016 3:08:45 PM net.authorize.util.HttpUtility postData&lt;BR /&gt;&lt;/EM&gt;&lt;/FONT&gt;&lt;FONT color="#993300"&gt;&lt;EM&gt;SEVERE: Execution error for http post Message: 'java.lang.ExceptionInInitializerError'&lt;/EM&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The SECOND time and after it throws this error:&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&lt;FONT color="#993300"&gt;Dec 21, 2016 3:40:28 PM net.authorize.util.HttpUtility postData&lt;BR /&gt;&lt;EM&gt;&lt;FONT color="#993300"&gt;SEVERE: Execution error for http post Message: 'java.lang.NoClassDefFoundError'&lt;/FONT&gt;&lt;/EM&gt;&lt;/FONT&gt;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;No further info is given on where the static initializer error is&amp;nbsp;occurring, or on what class it can't find.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm using anet-java-sdk-1.9.2.jar, and loading it (plus all dependency jars) into Oracle, although perhaps I am missing some dependency???&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Don't know where to go from here, as it works from my web environment, but not from Oracle.&lt;/P&gt;</description>
      <pubDate>Wed, 21 Dec 2016 23:32:24 GMT</pubDate>
      <guid>https://community.developer.cybersource.com/t5/Integration-and-Testing/ANet-Java-SDK-ExceptionInInitializerError-coming-from/m-p/56507#M31295</guid>
      <dc:creator>mdmaurer</dc:creator>
      <dc:date>2016-12-21T23:32:24Z</dc:date>
    </item>
    <item>
      <title>Re: ANet Java SDK - ExceptionInInitializerError coming from HttpUtility.postData()</title>
      <link>https://community.developer.cybersource.com/t5/Integration-and-Testing/ANet-Java-SDK-ExceptionInInitializerError-coming-from/m-p/56524#M31310</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.developer.cybersource.com/t5/user/viewprofilepage/user-id/21017"&gt;@mdmaurer&lt;/a&gt;,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I personally don't have much experience with Java in Oracle DB. I hope some other developers would see this and be able to offer some assistance.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I can offer general troubleshooting tips, like making sure that Oracle is seeing the classes and dependencies from the SDK in the correct location. Make sure the buildpath or classpath is correct and the sdk and all its dependencies are correctly added.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Make sure that the version of the SDK that you're compiling against is the same as what's installed in Oracle DB and that all of the same components are there.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Other general troubleshooting tips for "NoClassDefFoundError"} can be found here:&amp;nbsp;&lt;A href="http://javarevisited.blogspot.com/2011/06/noclassdeffounderror-exception-in.html" target="_blank"&gt;http://javarevisited.blogspot.com/2011/06/noclassdeffounderror-exception-in.html&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 27 Dec 2016 16:46:10 GMT</pubDate>
      <guid>https://community.developer.cybersource.com/t5/Integration-and-Testing/ANet-Java-SDK-ExceptionInInitializerError-coming-from/m-p/56524#M31310</guid>
      <dc:creator>Aaron</dc:creator>
      <dc:date>2016-12-27T16:46:10Z</dc:date>
    </item>
    <item>
      <title>Re: ANet Java SDK - ExceptionInInitializerError coming from HttpUtility.postData()</title>
      <link>https://community.developer.cybersource.com/t5/Integration-and-Testing/ANet-Java-SDK-ExceptionInInitializerError-coming-from/m-p/56526#M31312</link>
      <description>&lt;P&gt;Thanks, Aaron.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have made some progress on this, and&amp;nbsp;am posting the info&amp;nbsp;here for future reference for anyone attempting to call the Java API from Oracle.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;First, all the required Java classes need to be loaded into the db using the "loadjava" command ($ORACLE_HOME/bin/loadjava -user -v -r &amp;lt;1&amp;gt;.jar, &amp;lt;2&amp;gt;.jar, &amp;lt;3&amp;gt;.jar, ...). They need to be loaded and &lt;STRONG&gt;"resolved",&lt;/STRONG&gt; which is what&amp;nbsp;the &lt;STRONG&gt;"-r"&lt;/STRONG&gt; switch&amp;nbsp;does. You need to get a clean load of all the jars and dependencies before proceeding. I did ignore these&amp;nbsp;3 resolution errors:&amp;nbsp;(org/apache/log/format/AvalonFormatter, org/apache/commons/logging/impl/AvalonLogger, org/apache/commons/logging/impl/ServletContextCleaner).&amp;nbsp;The list of jars I loaded include&amp;nbsp;the AuthNet SDK&amp;nbsp;(&lt;STRONG&gt;anet-java-sdk-1.9.2.jar&lt;/STRONG&gt; in my case),&amp;nbsp;my own custom jar containing my Java classes&amp;nbsp;that call the AuthNet SDK,&amp;nbsp;plus all the required dependency jars (in my case this included &lt;STRONG&gt;logkit-1.0.1.jar, commons-logging-1.1.1.jar, commons-codec-1.3.jar, log4j-1.2.16.jar, httpclient-4.0.1.jar, &lt;/STRONG&gt;and&lt;STRONG&gt;&amp;nbsp;httpcore-4.0.1.jar&lt;/STRONG&gt;).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The crux of&amp;nbsp;my issue was&lt;STRONG&gt; missing db permissions&lt;/STRONG&gt; that needed to be granted to the Oracle db user. I discovered these by&amp;nbsp;downloading&amp;nbsp;a copy of the AuthNet Java SDK source code and&amp;nbsp;modifying it slightly to add some extra debug statements,&amp;nbsp;and so the exception handlers&amp;nbsp;in question would print a full stack trace (which I was not seeing in the log file). I did this in&amp;nbsp;several methods of the following classes&amp;nbsp;of the net.authorize.util package: HttpUtility.java, HttpCallTask.java, HttpClient.java. Then I did a Maven build&amp;nbsp;of the SDK with my changes.&amp;nbsp;Each time I tried to process a transaction it would fail and produce one db permission error in the stack trace. I would&amp;nbsp;grant the missing permission and try again. It was a slow process, but one by one I was eventually able to&amp;nbsp;discover all the missing permissions. Once they were all granted then the transactions started processing successfully, and returning valid results!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here is a list of the permissions&amp;nbsp;I had to grant to the&amp;nbsp;Oracle db user (user-name "SERV" in this case):&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;dbms_java.grant_permission( 'SERV', 'SYS:java.lang.RuntimePermission', 'getClassLoader', '' )&lt;/LI&gt;&lt;LI&gt;dbms_java.grant_permission( 'SERV', 'SYS:java.lang.RuntimePermission', 'getenv.http.ConnectionTimeout', '' )&lt;/LI&gt;&lt;LI&gt;dbms_java.grant_permission( 'SERV', 'SYS:java.lang.RuntimePermission', 'getenv.http.ReadTimeout', '' )&lt;/LI&gt;&lt;LI&gt;dbms_java.grant_permission( 'SERV', 'SYS:java.lang.RuntimePermission', 'getenv.https.proxyUse', '' )&lt;/LI&gt;&lt;LI&gt;dbms_java.grant_permission( 'SERV', 'SYS:java.lang.RuntimePermission', 'getenv.https.proxyHost', '' )&lt;/LI&gt;&lt;LI&gt;dbms_java.grant_permission( 'SERV', 'SYS:java.lang.RuntimePermission', 'getenv.https.proxyPort', '' )&lt;/LI&gt;&lt;LI&gt;dbms_java.grant_permission( 'SERV', 'SYS:java.lang.RuntimePermission', 'accessDeclaredMembers', '' )'&lt;/LI&gt;&lt;LI&gt;dbms_java.grant_permission( 'SERV', 'SYS:java.lang.RuntimePermission', 'accessClassInPackage.com.sun.xml.internal.bind.v2.model.annotation', '' )'&lt;/LI&gt;&lt;LI&gt;dbms_java.grant_permission( 'SERV', 'SYS:java.lang.reflect.ReflectPermission', 'suppressAccessChecks', '' )&lt;/LI&gt;&lt;LI&gt;dbms_java.grant_permission( 'SERV', 'SYS:java.net.SocketPermission', 'apitest.authorize.net', 'resolve' )&lt;/LI&gt;&lt;LI&gt;dbms_java.grant_permission( 'SERV', 'SYS:java.net.SocketPermission', '23.201.59.7:443', 'connect,resolve' )&lt;/LI&gt;&lt;LI&gt;dbms_java.grant_permission( 'SERV', 'SYS:oracle.aurora.rdbms.HandlePermission', 'HandleInputStream.SYS:com.sun.xml.internal.bind.v2.runtime.reflect.opt.FieldAccessor_Ref', 'read' )&lt;/LI&gt;&lt;LI&gt;dbms_java.grant_permission( 'SERV', 'SYS:oracle.aurora.rdbms.HandlePermission', 'HandleInputStream.SYS:com.sun.xml.internal.bind.v2.runtime.reflect.opt.FieldAccessor_Boolean', 'read' )&lt;/LI&gt;&lt;LI&gt;dbms_java.grant_permission( 'SERV', 'SYS:oracle.aurora.rdbms.HandlePermission', 'HandleInputStream.SYS:com.sun.xml.internal.bind.v2.runtime.reflect.opt.FieldAccessor_Integer', 'read' )&lt;/LI&gt;&lt;LI&gt;dbms_java.grant_permission( 'SERV', 'SYS:oracle.aurora.rdbms.HandlePermission', 'HandleInputStream.SYS:com.sun.xml.internal.bind.v2.runtime.reflect.opt.FieldAccessor_Short', 'read' )&lt;/LI&gt;&lt;LI&gt;dbms_java.grant_permission( 'SERV', 'SYS:oracle.aurora.rdbms.HandlePermission', 'HandleInputStream.SYS:com.sun.xml.internal.bind.v2.runtime.reflect.opt.FieldAccessor_Long', 'read' )&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;Mike&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 27 Dec 2016 18:35:58 GMT</pubDate>
      <guid>https://community.developer.cybersource.com/t5/Integration-and-Testing/ANet-Java-SDK-ExceptionInInitializerError-coming-from/m-p/56526#M31312</guid>
      <dc:creator>mdmaurer</dc:creator>
      <dc:date>2016-12-27T18:35:58Z</dc:date>
    </item>
    <item>
      <title>Re: ANet Java SDK - ExceptionInInitializerError coming from HttpUtility.postData()</title>
      <link>https://community.developer.cybersource.com/t5/Integration-and-Testing/ANet-Java-SDK-ExceptionInInitializerError-coming-from/m-p/56528#M31314</link>
      <description>&lt;P&gt;Thanks for updating us, Mike!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This is super helpful info for other developers and their future integrations, so I really appreciate you coming back and posting it here.&lt;/P&gt;</description>
      <pubDate>Tue, 27 Dec 2016 19:32:28 GMT</pubDate>
      <guid>https://community.developer.cybersource.com/t5/Integration-and-Testing/ANet-Java-SDK-ExceptionInInitializerError-coming-from/m-p/56528#M31314</guid>
      <dc:creator>Aaron</dc:creator>
      <dc:date>2016-12-27T19:32:28Z</dc:date>
    </item>
  </channel>
</rss>

