title: Run Scales XML's pullXml in weblogic server
body: <p>I used pullXml due to the file size is quite large, > 100M, I wrote a sample program as follows:</p>
  
  <pre><code>object TestXml {
      val mc = new java.math.MathContext(1024)
      val zero = BigDecimal(0, mc)
  
      def calculate(infile: String, encoding: String): BigDecimal = {
          val inStream = new FileInputStream(infile)
          val pull = pullXml(new InputSource(new InputStreamReader(inStream, encoding)))
          val ns = Namespace("urn:abcaus.onair.sintecmedia.com")
          val qnames = List(ns("ePGResp"), "EPGResponse"l, "Event"l)
          def eventStream = iterate(qnames, pull).toStream 
          var count = zero
          eventStream foreach { event =&gt; count += eventId(event) }
          inStream.close
          count
      }
  
      def eventId(event: XmlPath): Long =
          text(event.\*("EventID")).toLong
  
      def main(args: Array[String]): Unit = args.toList match {
          case infile :: encoding :: Nil =&gt; println(calculate(infile, encoding))
          case _ =&gt; println("usage scala -cp classpath au.net.abc.epg.TestLoadXml infile encoding")
      }
  }
  </code></pre>
  
  <p>I run the program on a command line as follows:</p>
  
  <pre><code>    $JAVA_HOME/bin/java -cp JarContainsSampleProgram.jar:scala-library-2.10.2.jar:scala-reflect-2.10.2.jar:scalalogging-slf4j_2.10-1.0.1.jar:scalaz-core_2.10-7.0.0.jar:scalaz-effect_2.10-7.0.0.jar:scalaz-iterv_2.10-7.0.0.jar:scales-xml_2.10-0.6.0-M1.jar:slf4j-api-1.6.4.jar TestLoadXml /home/wonga4d/EPG/Huge.xml utf-16
  </code></pre>
  
  <p>It runs successfully returning a value, say, 879452677392.</p>
  
  <p>However, when I deploy it as a oracle service bus Java callout (which is ok because Scala is JVM lang) to be used by an OSB proxy, still use the same input file and encoding, I got the following error </p>
  
  <pre><code>Callout to java method "public static scala.math.BigDecimal au.net.abc.epg.TestLoadXml.calculate(java.lang.String,java.lang.String)" resulted in exception: Got an event (Text()) that should not be in the prolog java.lang.RuntimeException: Got an event (Text()) that should not be in the prolog
  at scala.sys.package$.error(package.scala:27)
  at scala.Predef$.error(Predef.scala:142)
  at scales.utils.package$.error(package.scala:19)
  at scales.xml.parser.pull.PullUtils$$anonfun$getMisc$1.apply(PullIterator.scala:144)
  at scales.xml.parser.pull.PullUtils$$anonfun$getMisc$1.apply(PullIterator.scala:141)
  at scala.util.Either.fold(Either.scala:97)
  at scales.xml.parser.pull.PullUtils$.getMisc(PullIterator.scala:141)
  at scales.xml.parser.pull.XmlPull$class.start(PullIterator.scala:89)
  at scales.xml.parser.pull.XmlPulls$$anon$1.start(XmlPull.scala:134)
  at scales.xml.parser.pull.XmlPulls$$anon$1.&lt;init&gt;(XmlPull.scala:156)
  at scales.xml.parser.pull.XmlPulls$class.pullXml(XmlPull.scala:134)
  at scales.xml.package$.pullXml(package.scala:7)
  at TestXml$.calculate(TestLoadXml.scala:23)
  at TestXml.calculate(TestLoadXml.scala)
  at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
  at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
  at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
  at java.lang.reflect.Method.invoke(Method.java:597)
  at stages.transform.runtime.JavaCalloutRuntimeStep$1.run(JavaCalloutRuntimeStep.java:173)
  at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:363)
  at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:146)
  at weblogic.security.Security.runAs(Security.java:61)
  at stages.transform.runtime.JavaCalloutRuntimeStep.processMessage(JavaCalloutRuntimeStep.java:195)
  at com.bea.wli.sb.pipeline.debug.DebuggerRuntimeStep.processMessage(DebuggerRuntimeStep.java:74)
  at com.bea.wli.sb.stages.StageMetadataImpl$WrapperRuntimeStep.processMessage(StageMetadataImpl.java:346)
  at com.bea.wli.sb.pipeline.PipelineStage.processMessage(PipelineStage.java:84)
  </code></pre>
  
  <p>It fails at pullXml.  But it always succeeds when running on a commandline which I showed before.  If I don't use pullXml but loadXml, it will always succeed even when running in a weblogic server.  But loadXml will get a problem if loading a huge xml file.  Both pullXml &amp;  loadXml methods are located in the same jar, scales-xml_2.10-0.6.0-M1.jar.</p>
  
  <p>Just wonder if anyone ever used scales xml in weblogic server.  Sounds like I got to give up using scales xml if weblogic server is the execution environment.</p>
  
  <p>Thanks</p>