You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@jena.apache.org by Minakshi Bhardwaj <bm...@gmail.com> on 2018/08/23 13:32:02 UTC

My Java program using Jena working fine in eclipse but throws an exception when I run jar file from tomcat

I have written a java program to get some queries from an ontology. Its
working fine in eclipse where I developed it, however, when I run it using
jar file stored in tomcat an exception is thrown which is give below
*Warning*: Unchecked exception detected:
[[o:Response$UndeclaredThrowableErrorMarker]:"FATAL: Undeclared
java.lang.RuntimeException detected. java.lang.Exception: Invoke failed:
[[c:test]]->drawmap((o:String)[o:String]). Cause:
java.lang.IndexOutOfBoundsException: Index: 0, Size: 0 VM: 1.8.0_181@
http://java.oracle.com/" at: #-14 java.util.ArrayList.rangeCheck(Unknown
Source) #-13 java.util.ArrayList.get(Unknown Source) #-12
cononto.test.traverse(test.java:64) #-11
cononto.test.drawmap(test.java:976) #-10 sun.re[...]ppedResult(true) #3
http://localhost:8080/JavaBridge/java/Java.inc(588):
java_Client->getResult() #4
http://localhost:8080/JavaBridge/java/Java.inc(1795):
java_Client->invokeMethod(1, 'drawmap', Array) #5
http://localhost:8080/JavaBridge/java/Java.inc(1894):
java_JavaProxy->__call('drawmap', Array) #6
http://localhost:8080/JavaBridge/java/Java.inc(2042):
java_AbstractJava->__call('drawmap', Array) #7
C:\xampp\htdocs\javab.php(6): Java->__call('drawmap', Array) #8
{main}] in *http://localhost:8080/JavaBridge/java/Java.inc
<http://localhost:8080/JavaBridge/java/Java.inc>* on line *230*
[[o:Response$UndeclaredThrowableErrorMarker]:"FATAL: Undeclared
java.lang.RuntimeException detected. java.lang.Exception: Invoke failed:
[[c:test]]->drawmap((o:String)[o:String]). Cause:
java.lang.IndexOutOfBoundsException: Index: 0, Size: 0 VM: 1.8.0_181@
http://java.oracle.com/" at: #-14 java.util.ArrayList.rangeCheck(Unknown
Source) #-13 java.util.ArrayList.get(Unknown Source) #-12
cononto.test.traverse(test.java:64) #-11
cononto.test.drawmap(test.java:976) #-10
sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) #-9
sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) #-8
sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) #-7
java.lang.reflect.Method.invoke(Unknown Source) #-6
php.java.bridge.JavaBridge.Invoke(JavaBridge.java:1068) #-5
php.java.bridge.parser.Request.handleRequest(Request.java:426) #-4
php.java.bridge.parser.Request.handleRequests(Request.java:509) #-3
php.java.bridge.http.ContextRunner.run(ContextRunner.java:143) #-2
php.java.bridge.util.ThreadPool$Delegate.run(ThreadPool.java:60) #-1
php.java.bridge.util.AppThreadPool$Delegate.run(AppThreadPool.java:58) #0
http://localhost:8080/JavaBridge/java/Java.inc(260):
java_ThrowExceptionProxyFactory->getProxy(2, 'cononto.test', 'F', true) #1
http://localhost:8080/JavaBridge/java/Java.inc(388):
java_Arg->getResult(true) #2
http://localhost:8080/JavaBridge/java/Java.inc(394):
java_Client->getWrappedResult(true) #3
http://localhost:8080/JavaBridge/java/Java.inc(588):
java_Client->getResult() #4
http://localhost:8080/JavaBridge/java/Java.inc(1795):
java_Client->invokeMethod(1, 'drawmap', Array) #5
http://localhost:8080/JavaBridge/java/Java.inc(1894):
java_JavaProxy->__call('drawmap', Array) #6
http://localhost:8080/JavaBridge/java/Java.inc(2042):
java_AbstractJava->__call('drawmap', Array) #7
C:\xampp\htdocs\javab.php(6): Java->__call('drawmap', Array) #8 {main}]
*Fatal error*: An unchecked exception occured during script execution.
Please check the server log files for details. in
*http://localhost:8080/JavaBridge/java/Java.inc
<http://localhost:8080/JavaBridge/java/Java.inc>* on line *807*

I am attaching my java code and a sample ontology.

Please help.

Re: My Java program using Jena working fine in eclipse but throws an exception when I run jar file from tomcat

Posted by Minakshi Bhardwaj <bm...@gmail.com>.
Thanks everyone. Problem solved. I was wronglyy combining jar files.

On Fri, Aug 24, 2018 at 12:49 AM Andy Seaborne <an...@apache.org> wrote:

>  >      Read
> https://jena.apache.org/documentation/notes/jena-repack.html > but how
> to use Maven shade with eclipse?
>
> The jars will work find if you include in a war file don't repack them.
> (are you using a war file?)
>
>
> On 23/08/18 17:52, Rob Vesse wrote:
> > As I responded earlier this does not appear to be a Jena problem.  Your
> stack trace has no reference to Jena code in it.  The problem is with some
> other aspect of your code which you will need to track down yourself.
>
> Quite - the problem looks like it is in test.java
>
> >
> > You could try attaching a debugger to Tomcat per
> https://wiki.apache.org/tomcat/FAQ/Developing#Q1 to see what is going on
> in your web application
> >
> > Rob
> >
> > On 23/08/2018, 16:46, "Minakshi Bhardwaj" <bm...@gmail.com> wrote:
> >
> >      My server log contains the following:
> >      Aug 23, 2018 8:53:07 PM org.apache.catalina.core.ApplicationContext
> log
> >      SEVERE: java.lang.IndexOutOfBoundsException: Index: 0, Size: 0
> >      java.lang.IndexOutOfBoundsException: Index: 0, Size: 0
> >      at java.util.ArrayList.rangeCheck(Unknown Source)
> >      at java.util.ArrayList.get(Unknown Source)
> >      at cononto.test.traverse(test.java:64)
> >      at cononto.test.drawmap(test.java:976)
> >      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 php.java.bridge.JavaBridge.Invoke(JavaBridge.java:1068)
> >      at php.java.bridge.parser.Request.handleRequest(Request.java:426)
> >      at php.java.bridge.parser.Request.handleRequests(Request.java:509)
> >      at php.java.bridge.http.ContextRunner.run(ContextRunner.java:143)
> >      at php.java.bridge.util.ThreadPool$Delegate.run(ThreadPool.java:60)
> >      at
> php.java.bridge.util.AppThreadPool$Delegate.run(AppThreadPool.java:58)
> >
> >      Aug 23, 2018 8:53:07 PM org.apache.catalina.core.ApplicationContext
> log
> >      INFO: WARNING: 68ee72@fe008 FATAL: Undeclared
> java.lang.RuntimeException
> >      detected. java.lang.Exception: Invoke failed:
> >      [[c:test]]->drawmap((o:String)[o:String]). Cause:
> >      java.lang.IndexOutOfBoundsException: Index: 0, Size: 0 VM:
> 1.8.0_181@
> >      http://java.oracle.com/
> >
> >      I have created my application in eclipse oxygen and added jena jar
> files
> >      there in user libraries. The application is working fine there.
> Then I
> >      exported the application as jar file to tomcat server on xampp from
> where
> >      it is being run from a php file. I also copied jar files from
> jena/lib to
> >      tomcat/webapps/web-inf/lib. I only have eclipse oxygen installed in
> my
> >      system to build applications.
> >
> >      Read https://jena.apache.org/documentation/notes/jena-repack.html
> but how
> >      to use Maven shade with eclipse?
> >
> >      On Thu, Aug 23, 2018 at 7:15 PM Andy Seaborne <an...@apache.org>
> wrote:
> >
> >      > Hi there,
> >      >
> >      > How did you make the jar file?
> >      > Did you follow the notes in
> >      > https://jena.apache.org/documentation/notes/jena-repack.html?
> >      >
> >      > > Please check the server log files for details
> >      > What is in the server log?
> >      >
> >      >      Andy
> >      >
> >      > On 23/08/18 14:32, Minakshi Bhardwaj wrote:
> >      > > I have written a java program to get some queries from an
> ontology.
> >      > > Its working fine in eclipse where I developed it, however, when
> I run
> >      > > it using jar file stored in tomcat an exception is thrown which
> is
> >      > > give below
> >      > > *Warning*: Unchecked exception detected:
> >      > > [[o:Response$UndeclaredThrowableErrorMarker]:"FATAL: Undeclared
> >      > > java.lang.RuntimeException detected. java.lang.Exception: Invoke
> >      > > failed: [[c:test]]->drawmap((o:String)[o:String]). Cause:
> >      > > java.lang.IndexOutOfBoundsException: Index: 0, Size: 0 VM:
> >      > > 1.8.0_181@http://java.oracle.com/" at: #-14
> >      > > java.util.ArrayList.rangeCheck(Unknown Source) #-13
> >      > > java.util.ArrayList.get(Unknown Source) #-12
> >      > > cononto.test.traverse(test.java:64) #-11
> >      > > cononto.test.drawmap(test.java:976) #-10 sun.re
> >      > > <http://sun.re>[...]ppedResult(true) #3
> >      > > http://localhost:8080/JavaBridge/java/Java.inc(588)
> >      > > <http://localhost:8080/JavaBridge/java/Java.inc%28588%29>:
> >      > > java_Client->getResult() #4
> >      > > http://localhost:8080/JavaBridge/java/Java.inc(1795)
> >      > > <http://localhost:8080/JavaBridge/java/Java.inc%281795%29>:
> >      > > java_Client->invokeMethod(1, 'drawmap', Array) #5
> >      > > http://localhost:8080/JavaBridge/java/Java.inc(1894)
> >      > > <http://localhost:8080/JavaBridge/java/Java.inc%281894%29>:
> >      > > java_JavaProxy->__call('drawmap', Array) #6
> >      > > http://localhost:8080/JavaBridge/java/Java.inc(2042)
> >      > > <http://localhost:8080/JavaBridge/java/Java.inc%282042%29>:
> >      > > java_AbstractJava->__call('drawmap', Array) #7
> >      > > C:\xampp\htdocs\javab.php(6): Java->__call('drawmap', Array) #8
> >      > > {main}] in *http://localhost:8080/JavaBridge/java/Java.inc* on
> line
> >      > *230*
> >      > > [[o:Response$UndeclaredThrowableErrorMarker]:"FATAL: Undeclared
> >      > > java.lang.RuntimeException detected. java.lang.Exception: Invoke
> >      > > failed: [[c:test]]->drawmap((o:String)[o:String]). Cause:
> >      > > java.lang.IndexOutOfBoundsException: Index: 0, Size: 0 VM:
> >      > > 1.8.0_181@http://java.oracle.com/" at: #-14
> >      > > java.util.ArrayList.rangeCheck(Unknown Source) #-13
> >      > > java.util.ArrayList.get(Unknown Source) #-12
> >      > > cononto.test.traverse(test.java:64) #-11
> >      > > cononto.test.drawmap(test.java:976) #-10
> >      > > sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) #-9
> >      > > sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) #-8
> >      > > sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
> #-7
> >      > > java.lang.reflect.Method.invoke(Unknown Source) #-6
> >      > > php.java.bridge.JavaBridge.Invoke(JavaBridge.java:1068) #-5
> >      > > php.java.bridge.parser.Request.handleRequest(Request.java:426)
> #-4
> >      > > php.java.bridge.parser.Request.handleRequests(Request.java:509)
> #-3
> >      > > php.java.bridge.http.ContextRunner.run(ContextRunner.java:143)
> #-2
> >      > >
> php.java.bridge.util.ThreadPool$Delegate.run(ThreadPool.java:60) #-1
> >      > >
> php.java.bridge.util.AppThreadPool$Delegate.run(AppThreadPool.java:58)
> >      > > #0 http://localhost:8080/JavaBridge/java/Java.inc(260)
> >      > > <http://localhost:8080/JavaBridge/java/Java.inc%28260%29>:
> >      > > java_ThrowExceptionProxyFactory->getProxy(2, 'cononto.test',
> 'F',
> >      > > true) #1 http://localhost:8080/JavaBridge/java/Java.inc(388)
> >      > > <http://localhost:8080/JavaBridge/java/Java.inc%28388%29>:
> >      > > java_Arg->getResult(true) #2
> >      > > http://localhost:8080/JavaBridge/java/Java.inc(394)
> >      > > <http://localhost:8080/JavaBridge/java/Java.inc%28394%29>:
> >      > > java_Client->getWrappedResult(true) #3
> >      > > http://localhost:8080/JavaBridge/java/Java.inc(588)
> >      > > <http://localhost:8080/JavaBridge/java/Java.inc%28588%29>:
> >      > > java_Client->getResult() #4
> >      > > http://localhost:8080/JavaBridge/java/Java.inc(1795)
> >      > > <http://localhost:8080/JavaBridge/java/Java.inc%281795%29>:
> >      > > java_Client->invokeMethod(1, 'drawmap', Array) #5
> >      > > http://localhost:8080/JavaBridge/java/Java.inc(1894)
> >      > > <http://localhost:8080/JavaBridge/java/Java.inc%281894%29>:
> >      > > java_JavaProxy->__call('drawmap', Array) #6
> >      > > http://localhost:8080/JavaBridge/java/Java.inc(2042)
> >      > > <http://localhost:8080/JavaBridge/java/Java.inc%282042%29>:
> >      > > java_AbstractJava->__call('drawmap', Array) #7
> >      > > C:\xampp\htdocs\javab.php(6): Java->__call('drawmap', Array) #8
> {main}]
> >      > > *Fatal error*: An unchecked exception occured during script
> execution.
> >      > > Please check the server log files for details. in
> >      > > *http://localhost:8080/JavaBridge/java/Java.inc* on line *807*
> >      > >
> >      > > I am attaching my java code and a sample ontology.
> >      > >
> >      > > Please help.
> >      >
> >      >
> >
> >
> >
> >
> >
>

Re: My Java program using Jena working fine in eclipse but throws an exception when I run jar file from tomcat

Posted by Andy Seaborne <an...@apache.org>.
 >      Read 
https://jena.apache.org/documentation/notes/jena-repack.html > but how 
to use Maven shade with eclipse?

The jars will work find if you include in a war file don't repack them.
(are you using a war file?)


On 23/08/18 17:52, Rob Vesse wrote:
> As I responded earlier this does not appear to be a Jena problem.  Your stack trace has no reference to Jena code in it.  The problem is with some other aspect of your code which you will need to track down yourself.

Quite - the problem looks like it is in test.java

> 
> You could try attaching a debugger to Tomcat per https://wiki.apache.org/tomcat/FAQ/Developing#Q1 to see what is going on in your web application
> 
> Rob
> 
> On 23/08/2018, 16:46, "Minakshi Bhardwaj" <bm...@gmail.com> wrote:
> 
>      My server log contains the following:
>      Aug 23, 2018 8:53:07 PM org.apache.catalina.core.ApplicationContext log
>      SEVERE: java.lang.IndexOutOfBoundsException: Index: 0, Size: 0
>      java.lang.IndexOutOfBoundsException: Index: 0, Size: 0
>      at java.util.ArrayList.rangeCheck(Unknown Source)
>      at java.util.ArrayList.get(Unknown Source)
>      at cononto.test.traverse(test.java:64)
>      at cononto.test.drawmap(test.java:976)
>      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 php.java.bridge.JavaBridge.Invoke(JavaBridge.java:1068)
>      at php.java.bridge.parser.Request.handleRequest(Request.java:426)
>      at php.java.bridge.parser.Request.handleRequests(Request.java:509)
>      at php.java.bridge.http.ContextRunner.run(ContextRunner.java:143)
>      at php.java.bridge.util.ThreadPool$Delegate.run(ThreadPool.java:60)
>      at php.java.bridge.util.AppThreadPool$Delegate.run(AppThreadPool.java:58)
>      
>      Aug 23, 2018 8:53:07 PM org.apache.catalina.core.ApplicationContext log
>      INFO: WARNING: 68ee72@fe008 FATAL: Undeclared java.lang.RuntimeException
>      detected. java.lang.Exception: Invoke failed:
>      [[c:test]]->drawmap((o:String)[o:String]). Cause:
>      java.lang.IndexOutOfBoundsException: Index: 0, Size: 0 VM: 1.8.0_181@
>      http://java.oracle.com/
>      
>      I have created my application in eclipse oxygen and added jena jar files
>      there in user libraries. The application is working fine there. Then I
>      exported the application as jar file to tomcat server on xampp from where
>      it is being run from a php file. I also copied jar files from jena/lib to
>      tomcat/webapps/web-inf/lib. I only have eclipse oxygen installed in my
>      system to build applications.
>      
>      Read https://jena.apache.org/documentation/notes/jena-repack.html but how
>      to use Maven shade with eclipse?
>      
>      On Thu, Aug 23, 2018 at 7:15 PM Andy Seaborne <an...@apache.org> wrote:
>      
>      > Hi there,
>      >
>      > How did you make the jar file?
>      > Did you follow the notes in
>      > https://jena.apache.org/documentation/notes/jena-repack.html?
>      >
>      > > Please check the server log files for details
>      > What is in the server log?
>      >
>      >      Andy
>      >
>      > On 23/08/18 14:32, Minakshi Bhardwaj wrote:
>      > > I have written a java program to get some queries from an ontology.
>      > > Its working fine in eclipse where I developed it, however, when I run
>      > > it using jar file stored in tomcat an exception is thrown which is
>      > > give below
>      > > *Warning*: Unchecked exception detected:
>      > > [[o:Response$UndeclaredThrowableErrorMarker]:"FATAL: Undeclared
>      > > java.lang.RuntimeException detected. java.lang.Exception: Invoke
>      > > failed: [[c:test]]->drawmap((o:String)[o:String]). Cause:
>      > > java.lang.IndexOutOfBoundsException: Index: 0, Size: 0 VM:
>      > > 1.8.0_181@http://java.oracle.com/" at: #-14
>      > > java.util.ArrayList.rangeCheck(Unknown Source) #-13
>      > > java.util.ArrayList.get(Unknown Source) #-12
>      > > cononto.test.traverse(test.java:64) #-11
>      > > cononto.test.drawmap(test.java:976) #-10 sun.re
>      > > <http://sun.re>[...]ppedResult(true) #3
>      > > http://localhost:8080/JavaBridge/java/Java.inc(588)
>      > > <http://localhost:8080/JavaBridge/java/Java.inc%28588%29>:
>      > > java_Client->getResult() #4
>      > > http://localhost:8080/JavaBridge/java/Java.inc(1795)
>      > > <http://localhost:8080/JavaBridge/java/Java.inc%281795%29>:
>      > > java_Client->invokeMethod(1, 'drawmap', Array) #5
>      > > http://localhost:8080/JavaBridge/java/Java.inc(1894)
>      > > <http://localhost:8080/JavaBridge/java/Java.inc%281894%29>:
>      > > java_JavaProxy->__call('drawmap', Array) #6
>      > > http://localhost:8080/JavaBridge/java/Java.inc(2042)
>      > > <http://localhost:8080/JavaBridge/java/Java.inc%282042%29>:
>      > > java_AbstractJava->__call('drawmap', Array) #7
>      > > C:\xampp\htdocs\javab.php(6): Java->__call('drawmap', Array) #8
>      > > {main}] in *http://localhost:8080/JavaBridge/java/Java.inc* on line
>      > *230*
>      > > [[o:Response$UndeclaredThrowableErrorMarker]:"FATAL: Undeclared
>      > > java.lang.RuntimeException detected. java.lang.Exception: Invoke
>      > > failed: [[c:test]]->drawmap((o:String)[o:String]). Cause:
>      > > java.lang.IndexOutOfBoundsException: Index: 0, Size: 0 VM:
>      > > 1.8.0_181@http://java.oracle.com/" at: #-14
>      > > java.util.ArrayList.rangeCheck(Unknown Source) #-13
>      > > java.util.ArrayList.get(Unknown Source) #-12
>      > > cononto.test.traverse(test.java:64) #-11
>      > > cononto.test.drawmap(test.java:976) #-10
>      > > sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) #-9
>      > > sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) #-8
>      > > sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) #-7
>      > > java.lang.reflect.Method.invoke(Unknown Source) #-6
>      > > php.java.bridge.JavaBridge.Invoke(JavaBridge.java:1068) #-5
>      > > php.java.bridge.parser.Request.handleRequest(Request.java:426) #-4
>      > > php.java.bridge.parser.Request.handleRequests(Request.java:509) #-3
>      > > php.java.bridge.http.ContextRunner.run(ContextRunner.java:143) #-2
>      > > php.java.bridge.util.ThreadPool$Delegate.run(ThreadPool.java:60) #-1
>      > > php.java.bridge.util.AppThreadPool$Delegate.run(AppThreadPool.java:58)
>      > > #0 http://localhost:8080/JavaBridge/java/Java.inc(260)
>      > > <http://localhost:8080/JavaBridge/java/Java.inc%28260%29>:
>      > > java_ThrowExceptionProxyFactory->getProxy(2, 'cononto.test', 'F',
>      > > true) #1 http://localhost:8080/JavaBridge/java/Java.inc(388)
>      > > <http://localhost:8080/JavaBridge/java/Java.inc%28388%29>:
>      > > java_Arg->getResult(true) #2
>      > > http://localhost:8080/JavaBridge/java/Java.inc(394)
>      > > <http://localhost:8080/JavaBridge/java/Java.inc%28394%29>:
>      > > java_Client->getWrappedResult(true) #3
>      > > http://localhost:8080/JavaBridge/java/Java.inc(588)
>      > > <http://localhost:8080/JavaBridge/java/Java.inc%28588%29>:
>      > > java_Client->getResult() #4
>      > > http://localhost:8080/JavaBridge/java/Java.inc(1795)
>      > > <http://localhost:8080/JavaBridge/java/Java.inc%281795%29>:
>      > > java_Client->invokeMethod(1, 'drawmap', Array) #5
>      > > http://localhost:8080/JavaBridge/java/Java.inc(1894)
>      > > <http://localhost:8080/JavaBridge/java/Java.inc%281894%29>:
>      > > java_JavaProxy->__call('drawmap', Array) #6
>      > > http://localhost:8080/JavaBridge/java/Java.inc(2042)
>      > > <http://localhost:8080/JavaBridge/java/Java.inc%282042%29>:
>      > > java_AbstractJava->__call('drawmap', Array) #7
>      > > C:\xampp\htdocs\javab.php(6): Java->__call('drawmap', Array) #8 {main}]
>      > > *Fatal error*: An unchecked exception occured during script execution.
>      > > Please check the server log files for details. in
>      > > *http://localhost:8080/JavaBridge/java/Java.inc* on line *807*
>      > >
>      > > I am attaching my java code and a sample ontology.
>      > >
>      > > Please help.
>      >
>      >
>      
> 
> 
> 
> 

Re: My Java program using Jena working fine in eclipse but throws an exception when I run jar file from tomcat

Posted by Rob Vesse <rv...@dotnetrdf.org>.
As I responded earlier this does not appear to be a Jena problem.  Your stack trace has no reference to Jena code in it.  The problem is with some other aspect of your code which you will need to track down yourself.

You could try attaching a debugger to Tomcat per https://wiki.apache.org/tomcat/FAQ/Developing#Q1 to see what is going on in your web application

Rob

On 23/08/2018, 16:46, "Minakshi Bhardwaj" <bm...@gmail.com> wrote:

    My server log contains the following:
    Aug 23, 2018 8:53:07 PM org.apache.catalina.core.ApplicationContext log
    SEVERE: java.lang.IndexOutOfBoundsException: Index: 0, Size: 0
    java.lang.IndexOutOfBoundsException: Index: 0, Size: 0
    at java.util.ArrayList.rangeCheck(Unknown Source)
    at java.util.ArrayList.get(Unknown Source)
    at cononto.test.traverse(test.java:64)
    at cononto.test.drawmap(test.java:976)
    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 php.java.bridge.JavaBridge.Invoke(JavaBridge.java:1068)
    at php.java.bridge.parser.Request.handleRequest(Request.java:426)
    at php.java.bridge.parser.Request.handleRequests(Request.java:509)
    at php.java.bridge.http.ContextRunner.run(ContextRunner.java:143)
    at php.java.bridge.util.ThreadPool$Delegate.run(ThreadPool.java:60)
    at php.java.bridge.util.AppThreadPool$Delegate.run(AppThreadPool.java:58)
    
    Aug 23, 2018 8:53:07 PM org.apache.catalina.core.ApplicationContext log
    INFO: WARNING: 68ee72@fe008 FATAL: Undeclared java.lang.RuntimeException
    detected. java.lang.Exception: Invoke failed:
    [[c:test]]->drawmap((o:String)[o:String]). Cause:
    java.lang.IndexOutOfBoundsException: Index: 0, Size: 0 VM: 1.8.0_181@
    http://java.oracle.com/
    
    I have created my application in eclipse oxygen and added jena jar files
    there in user libraries. The application is working fine there. Then I
    exported the application as jar file to tomcat server on xampp from where
    it is being run from a php file. I also copied jar files from jena/lib to
    tomcat/webapps/web-inf/lib. I only have eclipse oxygen installed in my
    system to build applications.
    
    Read https://jena.apache.org/documentation/notes/jena-repack.html but how
    to use Maven shade with eclipse?
    
    On Thu, Aug 23, 2018 at 7:15 PM Andy Seaborne <an...@apache.org> wrote:
    
    > Hi there,
    >
    > How did you make the jar file?
    > Did you follow the notes in
    > https://jena.apache.org/documentation/notes/jena-repack.html?
    >
    > > Please check the server log files for details
    > What is in the server log?
    >
    >      Andy
    >
    > On 23/08/18 14:32, Minakshi Bhardwaj wrote:
    > > I have written a java program to get some queries from an ontology.
    > > Its working fine in eclipse where I developed it, however, when I run
    > > it using jar file stored in tomcat an exception is thrown which is
    > > give below
    > > *Warning*: Unchecked exception detected:
    > > [[o:Response$UndeclaredThrowableErrorMarker]:"FATAL: Undeclared
    > > java.lang.RuntimeException detected. java.lang.Exception: Invoke
    > > failed: [[c:test]]->drawmap((o:String)[o:String]). Cause:
    > > java.lang.IndexOutOfBoundsException: Index: 0, Size: 0 VM:
    > > 1.8.0_181@http://java.oracle.com/" at: #-14
    > > java.util.ArrayList.rangeCheck(Unknown Source) #-13
    > > java.util.ArrayList.get(Unknown Source) #-12
    > > cononto.test.traverse(test.java:64) #-11
    > > cononto.test.drawmap(test.java:976) #-10 sun.re
    > > <http://sun.re>[...]ppedResult(true) #3
    > > http://localhost:8080/JavaBridge/java/Java.inc(588)
    > > <http://localhost:8080/JavaBridge/java/Java.inc%28588%29>:
    > > java_Client->getResult() #4
    > > http://localhost:8080/JavaBridge/java/Java.inc(1795)
    > > <http://localhost:8080/JavaBridge/java/Java.inc%281795%29>:
    > > java_Client->invokeMethod(1, 'drawmap', Array) #5
    > > http://localhost:8080/JavaBridge/java/Java.inc(1894)
    > > <http://localhost:8080/JavaBridge/java/Java.inc%281894%29>:
    > > java_JavaProxy->__call('drawmap', Array) #6
    > > http://localhost:8080/JavaBridge/java/Java.inc(2042)
    > > <http://localhost:8080/JavaBridge/java/Java.inc%282042%29>:
    > > java_AbstractJava->__call('drawmap', Array) #7
    > > C:\xampp\htdocs\javab.php(6): Java->__call('drawmap', Array) #8
    > > {main}] in *http://localhost:8080/JavaBridge/java/Java.inc* on line
    > *230*
    > > [[o:Response$UndeclaredThrowableErrorMarker]:"FATAL: Undeclared
    > > java.lang.RuntimeException detected. java.lang.Exception: Invoke
    > > failed: [[c:test]]->drawmap((o:String)[o:String]). Cause:
    > > java.lang.IndexOutOfBoundsException: Index: 0, Size: 0 VM:
    > > 1.8.0_181@http://java.oracle.com/" at: #-14
    > > java.util.ArrayList.rangeCheck(Unknown Source) #-13
    > > java.util.ArrayList.get(Unknown Source) #-12
    > > cononto.test.traverse(test.java:64) #-11
    > > cononto.test.drawmap(test.java:976) #-10
    > > sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) #-9
    > > sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) #-8
    > > sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) #-7
    > > java.lang.reflect.Method.invoke(Unknown Source) #-6
    > > php.java.bridge.JavaBridge.Invoke(JavaBridge.java:1068) #-5
    > > php.java.bridge.parser.Request.handleRequest(Request.java:426) #-4
    > > php.java.bridge.parser.Request.handleRequests(Request.java:509) #-3
    > > php.java.bridge.http.ContextRunner.run(ContextRunner.java:143) #-2
    > > php.java.bridge.util.ThreadPool$Delegate.run(ThreadPool.java:60) #-1
    > > php.java.bridge.util.AppThreadPool$Delegate.run(AppThreadPool.java:58)
    > > #0 http://localhost:8080/JavaBridge/java/Java.inc(260)
    > > <http://localhost:8080/JavaBridge/java/Java.inc%28260%29>:
    > > java_ThrowExceptionProxyFactory->getProxy(2, 'cononto.test', 'F',
    > > true) #1 http://localhost:8080/JavaBridge/java/Java.inc(388)
    > > <http://localhost:8080/JavaBridge/java/Java.inc%28388%29>:
    > > java_Arg->getResult(true) #2
    > > http://localhost:8080/JavaBridge/java/Java.inc(394)
    > > <http://localhost:8080/JavaBridge/java/Java.inc%28394%29>:
    > > java_Client->getWrappedResult(true) #3
    > > http://localhost:8080/JavaBridge/java/Java.inc(588)
    > > <http://localhost:8080/JavaBridge/java/Java.inc%28588%29>:
    > > java_Client->getResult() #4
    > > http://localhost:8080/JavaBridge/java/Java.inc(1795)
    > > <http://localhost:8080/JavaBridge/java/Java.inc%281795%29>:
    > > java_Client->invokeMethod(1, 'drawmap', Array) #5
    > > http://localhost:8080/JavaBridge/java/Java.inc(1894)
    > > <http://localhost:8080/JavaBridge/java/Java.inc%281894%29>:
    > > java_JavaProxy->__call('drawmap', Array) #6
    > > http://localhost:8080/JavaBridge/java/Java.inc(2042)
    > > <http://localhost:8080/JavaBridge/java/Java.inc%282042%29>:
    > > java_AbstractJava->__call('drawmap', Array) #7
    > > C:\xampp\htdocs\javab.php(6): Java->__call('drawmap', Array) #8 {main}]
    > > *Fatal error*: An unchecked exception occured during script execution.
    > > Please check the server log files for details. in
    > > *http://localhost:8080/JavaBridge/java/Java.inc* on line *807*
    > >
    > > I am attaching my java code and a sample ontology.
    > >
    > > Please help.
    >
    >
    





Re: My Java program using Jena working fine in eclipse but throws an exception when I run jar file from tomcat

Posted by Minakshi Bhardwaj <bm...@gmail.com>.
My server log contains the following:
Aug 23, 2018 8:53:07 PM org.apache.catalina.core.ApplicationContext log
SEVERE: java.lang.IndexOutOfBoundsException: Index: 0, Size: 0
java.lang.IndexOutOfBoundsException: Index: 0, Size: 0
at java.util.ArrayList.rangeCheck(Unknown Source)
at java.util.ArrayList.get(Unknown Source)
at cononto.test.traverse(test.java:64)
at cononto.test.drawmap(test.java:976)
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 php.java.bridge.JavaBridge.Invoke(JavaBridge.java:1068)
at php.java.bridge.parser.Request.handleRequest(Request.java:426)
at php.java.bridge.parser.Request.handleRequests(Request.java:509)
at php.java.bridge.http.ContextRunner.run(ContextRunner.java:143)
at php.java.bridge.util.ThreadPool$Delegate.run(ThreadPool.java:60)
at php.java.bridge.util.AppThreadPool$Delegate.run(AppThreadPool.java:58)

Aug 23, 2018 8:53:07 PM org.apache.catalina.core.ApplicationContext log
INFO: WARNING: 68ee72@fe008 FATAL: Undeclared java.lang.RuntimeException
detected. java.lang.Exception: Invoke failed:
[[c:test]]->drawmap((o:String)[o:String]). Cause:
java.lang.IndexOutOfBoundsException: Index: 0, Size: 0 VM: 1.8.0_181@
http://java.oracle.com/

I have created my application in eclipse oxygen and added jena jar files
there in user libraries. The application is working fine there. Then I
exported the application as jar file to tomcat server on xampp from where
it is being run from a php file. I also copied jar files from jena/lib to
tomcat/webapps/web-inf/lib. I only have eclipse oxygen installed in my
system to build applications.

Read https://jena.apache.org/documentation/notes/jena-repack.html but how
to use Maven shade with eclipse?

On Thu, Aug 23, 2018 at 7:15 PM Andy Seaborne <an...@apache.org> wrote:

> Hi there,
>
> How did you make the jar file?
> Did you follow the notes in
> https://jena.apache.org/documentation/notes/jena-repack.html?
>
> > Please check the server log files for details
> What is in the server log?
>
>      Andy
>
> On 23/08/18 14:32, Minakshi Bhardwaj wrote:
> > I have written a java program to get some queries from an ontology.
> > Its working fine in eclipse where I developed it, however, when I run
> > it using jar file stored in tomcat an exception is thrown which is
> > give below
> > *Warning*: Unchecked exception detected:
> > [[o:Response$UndeclaredThrowableErrorMarker]:"FATAL: Undeclared
> > java.lang.RuntimeException detected. java.lang.Exception: Invoke
> > failed: [[c:test]]->drawmap((o:String)[o:String]). Cause:
> > java.lang.IndexOutOfBoundsException: Index: 0, Size: 0 VM:
> > 1.8.0_181@http://java.oracle.com/" at: #-14
> > java.util.ArrayList.rangeCheck(Unknown Source) #-13
> > java.util.ArrayList.get(Unknown Source) #-12
> > cononto.test.traverse(test.java:64) #-11
> > cononto.test.drawmap(test.java:976) #-10 sun.re
> > <http://sun.re>[...]ppedResult(true) #3
> > http://localhost:8080/JavaBridge/java/Java.inc(588)
> > <http://localhost:8080/JavaBridge/java/Java.inc%28588%29>:
> > java_Client->getResult() #4
> > http://localhost:8080/JavaBridge/java/Java.inc(1795)
> > <http://localhost:8080/JavaBridge/java/Java.inc%281795%29>:
> > java_Client->invokeMethod(1, 'drawmap', Array) #5
> > http://localhost:8080/JavaBridge/java/Java.inc(1894)
> > <http://localhost:8080/JavaBridge/java/Java.inc%281894%29>:
> > java_JavaProxy->__call('drawmap', Array) #6
> > http://localhost:8080/JavaBridge/java/Java.inc(2042)
> > <http://localhost:8080/JavaBridge/java/Java.inc%282042%29>:
> > java_AbstractJava->__call('drawmap', Array) #7
> > C:\xampp\htdocs\javab.php(6): Java->__call('drawmap', Array) #8
> > {main}] in *http://localhost:8080/JavaBridge/java/Java.inc* on line
> *230*
> > [[o:Response$UndeclaredThrowableErrorMarker]:"FATAL: Undeclared
> > java.lang.RuntimeException detected. java.lang.Exception: Invoke
> > failed: [[c:test]]->drawmap((o:String)[o:String]). Cause:
> > java.lang.IndexOutOfBoundsException: Index: 0, Size: 0 VM:
> > 1.8.0_181@http://java.oracle.com/" at: #-14
> > java.util.ArrayList.rangeCheck(Unknown Source) #-13
> > java.util.ArrayList.get(Unknown Source) #-12
> > cononto.test.traverse(test.java:64) #-11
> > cononto.test.drawmap(test.java:976) #-10
> > sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) #-9
> > sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) #-8
> > sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) #-7
> > java.lang.reflect.Method.invoke(Unknown Source) #-6
> > php.java.bridge.JavaBridge.Invoke(JavaBridge.java:1068) #-5
> > php.java.bridge.parser.Request.handleRequest(Request.java:426) #-4
> > php.java.bridge.parser.Request.handleRequests(Request.java:509) #-3
> > php.java.bridge.http.ContextRunner.run(ContextRunner.java:143) #-2
> > php.java.bridge.util.ThreadPool$Delegate.run(ThreadPool.java:60) #-1
> > php.java.bridge.util.AppThreadPool$Delegate.run(AppThreadPool.java:58)
> > #0 http://localhost:8080/JavaBridge/java/Java.inc(260)
> > <http://localhost:8080/JavaBridge/java/Java.inc%28260%29>:
> > java_ThrowExceptionProxyFactory->getProxy(2, 'cononto.test', 'F',
> > true) #1 http://localhost:8080/JavaBridge/java/Java.inc(388)
> > <http://localhost:8080/JavaBridge/java/Java.inc%28388%29>:
> > java_Arg->getResult(true) #2
> > http://localhost:8080/JavaBridge/java/Java.inc(394)
> > <http://localhost:8080/JavaBridge/java/Java.inc%28394%29>:
> > java_Client->getWrappedResult(true) #3
> > http://localhost:8080/JavaBridge/java/Java.inc(588)
> > <http://localhost:8080/JavaBridge/java/Java.inc%28588%29>:
> > java_Client->getResult() #4
> > http://localhost:8080/JavaBridge/java/Java.inc(1795)
> > <http://localhost:8080/JavaBridge/java/Java.inc%281795%29>:
> > java_Client->invokeMethod(1, 'drawmap', Array) #5
> > http://localhost:8080/JavaBridge/java/Java.inc(1894)
> > <http://localhost:8080/JavaBridge/java/Java.inc%281894%29>:
> > java_JavaProxy->__call('drawmap', Array) #6
> > http://localhost:8080/JavaBridge/java/Java.inc(2042)
> > <http://localhost:8080/JavaBridge/java/Java.inc%282042%29>:
> > java_AbstractJava->__call('drawmap', Array) #7
> > C:\xampp\htdocs\javab.php(6): Java->__call('drawmap', Array) #8 {main}]
> > *Fatal error*: An unchecked exception occured during script execution.
> > Please check the server log files for details. in
> > *http://localhost:8080/JavaBridge/java/Java.inc* on line *807*
> >
> > I am attaching my java code and a sample ontology.
> >
> > Please help.
>
>

Re: My Java program using Jena working fine in eclipse but throws an exception when I run jar file from tomcat

Posted by Andy Seaborne <an...@apache.org>.
Hi there,

How did you make the jar file?
Did you follow the notes in 
https://jena.apache.org/documentation/notes/jena-repack.html?

> Please check the server log files for details
What is in the server log?

     Andy

On 23/08/18 14:32, Minakshi Bhardwaj wrote:
> I have written a java program to get some queries from an ontology. 
> Its working fine in eclipse where I developed it, however, when I run 
> it using jar file stored in tomcat an exception is thrown which is 
> give below
> *Warning*: Unchecked exception detected: 
> [[o:Response$UndeclaredThrowableErrorMarker]:"FATAL: Undeclared 
> java.lang.RuntimeException detected. java.lang.Exception: Invoke 
> failed: [[c:test]]->drawmap((o:String)[o:String]). Cause: 
> java.lang.IndexOutOfBoundsException: Index: 0, Size: 0 VM: 
> 1.8.0_181@http://java.oracle.com/" at: #-14 
> java.util.ArrayList.rangeCheck(Unknown Source) #-13 
> java.util.ArrayList.get(Unknown Source) #-12 
> cononto.test.traverse(test.java:64) #-11 
> cononto.test.drawmap(test.java:976) #-10 sun.re 
> <http://sun.re>[...]ppedResult(true) #3 
> http://localhost:8080/JavaBridge/java/Java.inc(588) 
> <http://localhost:8080/JavaBridge/java/Java.inc%28588%29>: 
> java_Client->getResult() #4 
> http://localhost:8080/JavaBridge/java/Java.inc(1795) 
> <http://localhost:8080/JavaBridge/java/Java.inc%281795%29>: 
> java_Client->invokeMethod(1, 'drawmap', Array) #5 
> http://localhost:8080/JavaBridge/java/Java.inc(1894) 
> <http://localhost:8080/JavaBridge/java/Java.inc%281894%29>: 
> java_JavaProxy->__call('drawmap', Array) #6 
> http://localhost:8080/JavaBridge/java/Java.inc(2042) 
> <http://localhost:8080/JavaBridge/java/Java.inc%282042%29>: 
> java_AbstractJava->__call('drawmap', Array) #7 
> C:\xampp\htdocs\javab.php(6): Java->__call('drawmap', Array) #8 
> {main}] in *http://localhost:8080/JavaBridge/java/Java.inc* on line *230*
> [[o:Response$UndeclaredThrowableErrorMarker]:"FATAL: Undeclared 
> java.lang.RuntimeException detected. java.lang.Exception: Invoke 
> failed: [[c:test]]->drawmap((o:String)[o:String]). Cause: 
> java.lang.IndexOutOfBoundsException: Index: 0, Size: 0 VM: 
> 1.8.0_181@http://java.oracle.com/" at: #-14 
> java.util.ArrayList.rangeCheck(Unknown Source) #-13 
> java.util.ArrayList.get(Unknown Source) #-12 
> cononto.test.traverse(test.java:64) #-11 
> cononto.test.drawmap(test.java:976) #-10 
> sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) #-9 
> sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) #-8 
> sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) #-7 
> java.lang.reflect.Method.invoke(Unknown Source) #-6 
> php.java.bridge.JavaBridge.Invoke(JavaBridge.java:1068) #-5 
> php.java.bridge.parser.Request.handleRequest(Request.java:426) #-4 
> php.java.bridge.parser.Request.handleRequests(Request.java:509) #-3 
> php.java.bridge.http.ContextRunner.run(ContextRunner.java:143) #-2 
> php.java.bridge.util.ThreadPool$Delegate.run(ThreadPool.java:60) #-1 
> php.java.bridge.util.AppThreadPool$Delegate.run(AppThreadPool.java:58) 
> #0 http://localhost:8080/JavaBridge/java/Java.inc(260) 
> <http://localhost:8080/JavaBridge/java/Java.inc%28260%29>: 
> java_ThrowExceptionProxyFactory->getProxy(2, 'cononto.test', 'F', 
> true) #1 http://localhost:8080/JavaBridge/java/Java.inc(388) 
> <http://localhost:8080/JavaBridge/java/Java.inc%28388%29>: 
> java_Arg->getResult(true) #2 
> http://localhost:8080/JavaBridge/java/Java.inc(394) 
> <http://localhost:8080/JavaBridge/java/Java.inc%28394%29>: 
> java_Client->getWrappedResult(true) #3 
> http://localhost:8080/JavaBridge/java/Java.inc(588) 
> <http://localhost:8080/JavaBridge/java/Java.inc%28588%29>: 
> java_Client->getResult() #4 
> http://localhost:8080/JavaBridge/java/Java.inc(1795) 
> <http://localhost:8080/JavaBridge/java/Java.inc%281795%29>: 
> java_Client->invokeMethod(1, 'drawmap', Array) #5 
> http://localhost:8080/JavaBridge/java/Java.inc(1894) 
> <http://localhost:8080/JavaBridge/java/Java.inc%281894%29>: 
> java_JavaProxy->__call('drawmap', Array) #6 
> http://localhost:8080/JavaBridge/java/Java.inc(2042) 
> <http://localhost:8080/JavaBridge/java/Java.inc%282042%29>: 
> java_AbstractJava->__call('drawmap', Array) #7 
> C:\xampp\htdocs\javab.php(6): Java->__call('drawmap', Array) #8 {main}]
> *Fatal error*: An unchecked exception occured during script execution. 
> Please check the server log files for details. in 
> *http://localhost:8080/JavaBridge/java/Java.inc* on line *807*
>
> I am attaching my java code and a sample ontology.
>
> Please help.


Re: My Java program using Jena working fine in eclipse but throws an exception when I run jar file from tomcat

Posted by Rob Vesse <rv...@dotnetrdf.org>.
Attachments are generally not accepted by Apache mailing lists.  You can use a hosting service like PasteBin or GitHub Gists to share code by providing links to your uploaded code.

 

I notice that the stack trace you show doesn’t have any references to any Jena code.  It looks like you are using some Java to PHP bridge in your code and that is failing which is likely a dependency/environmental problem.

 

As it stands this does not look like a Jena problem.  If you can provide more detail that implicates Jena then we can try to help but otherwise you may be better asking this question elsewhere

 

Rob

 

From: Minakshi Bhardwaj <bm...@gmail.com>
Reply-To: <de...@jena.apache.org>
Date: Thursday, 23 August 2018 at 14:32
To: <de...@jena.apache.org>
Subject: My Java program using Jena working fine in eclipse but throws an exception when I run jar file from tomcat

 

I have written a java program to get some queries from an ontology. Its working fine in eclipse where I developed it, however, when I run it using jar file stored in tomcat an exception is thrown which is give below

Warning: Unchecked exception detected: [[o:Response$UndeclaredThrowableErrorMarker]:"FATAL: Undeclared java.lang.RuntimeException detected. java.lang.Exception: Invoke failed: [[c:test]]->drawmap((o:String)[o:String]). Cause: java.lang.IndexOutOfBoundsException: Index: 0, Size: 0 VM: 1.8.0_181@http://java.oracle.com/" at: #-14 java.util.ArrayList.rangeCheck(Unknown Source) #-13 java.util.ArrayList.get(Unknown Source) #-12 cononto.test.traverse(test.java:64) #-11 cononto.test.drawmap(test.java:976) #-10 sun.re[...]ppedResult(true) #3 http://localhost:8080/JavaBridge/java/Java.inc(588): java_Client->getResult() #4 http://localhost:8080/JavaBridge/java/Java.inc(1795): java_Client->invokeMethod(1, 'drawmap', Array) #5 http://localhost:8080/JavaBridge/java/Java.inc(1894): java_JavaProxy->__call('drawmap', Array) #6 http://localhost:8080/JavaBridge/java/Java.inc(2042): java_AbstractJava->__call('drawmap', Array) #7 C:\xampp\htdocs\javab.php(6): Java->__call('drawmap', Array) #8 {main}] in http://localhost:8080/JavaBridge/java/Java.inc on line 230
[[o:Response$UndeclaredThrowableErrorMarker]:"FATAL: Undeclared java.lang.RuntimeException detected. java.lang.Exception: Invoke failed: [[c:test]]->drawmap((o:String)[o:String]). Cause: java.lang.IndexOutOfBoundsException: Index: 0, Size: 0 VM: 1.8.0_181@http://java.oracle.com/" at: #-14 java.util.ArrayList.rangeCheck(Unknown Source) #-13 java.util.ArrayList.get(Unknown Source) #-12 cononto.test.traverse(test.java:64) #-11 cononto.test.drawmap(test.java:976) #-10 sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) #-9 sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) #-8 sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) #-7 java.lang.reflect.Method.invoke(Unknown Source) #-6 php.java.bridge.JavaBridge.Invoke(JavaBridge.java:1068) #-5 php.java.bridge.parser.Request.handleRequest(Request.java:426) #-4 php.java.bridge.parser.Request.handleRequests(Request.java:509) #-3 php.java.bridge.http.ContextRunner.run(ContextRunner.java:143) #-2 php.java.bridge.util.ThreadPool$Delegate.run(ThreadPool.java:60) #-1 php.java.bridge.util.AppThreadPool$Delegate.run(AppThreadPool.java:58) #0 http://localhost:8080/JavaBridge/java/Java.inc(260): java_ThrowExceptionProxyFactory->getProxy(2, 'cononto.test', 'F', true) #1 http://localhost:8080/JavaBridge/java/Java.inc(388): java_Arg->getResult(true) #2 http://localhost:8080/JavaBridge/java/Java.inc(394): java_Client->getWrappedResult(true) #3 http://localhost:8080/JavaBridge/java/Java.inc(588): java_Client->getResult() #4 http://localhost:8080/JavaBridge/java/Java.inc(1795): java_Client->invokeMethod(1, 'drawmap', Array) #5 http://localhost:8080/JavaBridge/java/Java.inc(1894): java_JavaProxy->__call('drawmap', Array) #6 http://localhost:8080/JavaBridge/java/Java.inc(2042): java_AbstractJava->__call('drawmap', Array) #7 C:\xampp\htdocs\javab.php(6): Java->__call('drawmap', Array) #8 {main}] 
Fatal error: An unchecked exception occured during script execution. Please check the server log files for details. in http://localhost:8080/JavaBridge/java/Java.inc on line 807 

 

I am attaching my java code and a sample ontology.

 

Please help. 


Re: My Java program using Jena working fine in eclipse but throws an exception when I run jar file from tomcat

Posted by ajs6f <aj...@apache.org>.
This list does not accept attachments. Please put your code and data somewhere web-accessible like pastebin or gist.

ajs6f

> On Aug 23, 2018, at 9:32 AM, Minakshi Bhardwaj <bm...@gmail.com> wrote:
> 
> I have written a java program to get some queries from an ontology. Its working fine in eclipse where I developed it, however, when I run it using jar file stored in tomcat an exception is thrown which is give below
> Warning: Unchecked exception detected: [[o:Response$UndeclaredThrowableErrorMarker]:"FATAL: Undeclared java.lang.RuntimeException detected. java.lang.Exception: Invoke failed: [[c:test]]->drawmap((o:String)[o:String]). Cause: java.lang.IndexOutOfBoundsException: Index: 0, Size: 0 VM: 1.8.0_181@http://java.oracle.com/" at: #-14 java.util.ArrayList.rangeCheck(Unknown Source) #-13 java.util.ArrayList.get(Unknown Source) #-12 cononto.test.traverse(test.java:64) #-11 cononto.test.drawmap(test.java:976) #-10 sun.re[...]ppedResult(true) #3 http://localhost:8080/JavaBridge/java/Java.inc(588): java_Client->getResult() #4 http://localhost:8080/JavaBridge/java/Java.inc(1795): java_Client->invokeMethod(1, 'drawmap', Array) #5 http://localhost:8080/JavaBridge/java/Java.inc(1894): java_JavaProxy->__call('drawmap', Array) #6 http://localhost:8080/JavaBridge/java/Java.inc(2042): java_AbstractJava->__call('drawmap', Array) #7 C:\xampp\htdocs\javab.php(6): Java->__call('drawmap', Array) #8 {main}] in http://localhost:8080/JavaBridge/java/Java.inc on line 230
> [[o:Response$UndeclaredThrowableErrorMarker]:"FATAL: Undeclared java.lang.RuntimeException detected. java.lang.Exception: Invoke failed: [[c:test]]->drawmap((o:String)[o:String]). Cause: java.lang.IndexOutOfBoundsException: Index: 0, Size: 0 VM: 1.8.0_181@http://java.oracle.com/" at: #-14 java.util.ArrayList.rangeCheck(Unknown Source) #-13 java.util.ArrayList.get(Unknown Source) #-12 cononto.test.traverse(test.java:64) #-11 cononto.test.drawmap(test.java:976) #-10 sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) #-9 sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) #-8 sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) #-7 java.lang.reflect.Method.invoke(Unknown Source) #-6 php.java.bridge.JavaBridge.Invoke(JavaBridge.java:1068) #-5 php.java.bridge.parser.Request.handleRequest(Request.java:426) #-4 php.java.bridge.parser.Request.handleRequests(Request.java:509) #-3 php.java.bridge.http.ContextRunner.run(ContextRunner.java:143) #-2 php.java.bridge.util.ThreadPool$Delegate.run(ThreadPool.java:60) #-1 php.java.bridge.util.AppThreadPool$Delegate.run(AppThreadPool.java:58) #0 http://localhost:8080/JavaBridge/java/Java.inc(260): java_ThrowExceptionProxyFactory->getProxy(2, 'cononto.test', 'F', true) #1 http://localhost:8080/JavaBridge/java/Java.inc(388): java_Arg->getResult(true) #2 http://localhost:8080/JavaBridge/java/Java.inc(394): java_Client->getWrappedResult(true) #3 http://localhost:8080/JavaBridge/java/Java.inc(588): java_Client->getResult() #4 http://localhost:8080/JavaBridge/java/Java.inc(1795): java_Client->invokeMethod(1, 'drawmap', Array) #5 http://localhost:8080/JavaBridge/java/Java.inc(1894): java_JavaProxy->__call('drawmap', Array) #6 http://localhost:8080/JavaBridge/java/Java.inc(2042): java_AbstractJava->__call('drawmap', Array) #7 C:\xampp\htdocs\javab.php(6): Java->__call('drawmap', Array) #8 {main}] 
> Fatal error: An unchecked exception occured during script execution. Please check the server log files for details. in http://localhost:8080/JavaBridge/java/Java.inc on line 807 
> 
> I am attaching my java code and a sample ontology.
> 
> Please help.