f



String index out of range: -1 only occurs when using java.lang.Thread

I have a JSP script I stripped down to just this one scriptlet:

<%

   Thread t = new Thread(new Runnable() {
        public void run() {
          System.out.println("Hello World");
        }
   });

   t.start();
   t.join(5000);
%>
<html>
<head>
<title>Hello</title>
</head>
<body>Hello World</body>
</html>

Whenever I try to run this I get the following output:

Error 500: String index out of range: -1

It doesn't give line number or any other explanation, furthermore, the
logs have no entry of anything for the time period whereby I ran this
script via browser.

Whenever I take out the Thread reference the script runs just fine,
even if I add other scriptlets with JSP code elsewhere, otherwise, as
long as this "empty" or "useless" thread exists, I get the weird and
very nondescript error.

Ideas?

Phil
0
phillip
3/4/2008 6:02:13 PM
comp.lang.java.help 13340 articles. 0 followers. Post Follow

1 Replies
932 Views

Similar Articles

[PageSpeed] 53

phillip.s.powell@gmail.com wrote:
> I have a JSP script I stripped down to just this one scriptlet:
> 
> <%
> 
>    Thread t = new Thread(new Runnable() {
>         public void run() {
>           System.out.println("Hello World");
>         }
>    });
> 
>    t.start();
>    t.join(5000);
> %>
> <html>
> <head>
> <title>Hello</title>
> </head>
> <body>Hello World</body>
> </html>
> 
> Whenever I try to run this I get the following output:
> 
> Error 500: String index out of range: -1
> 
> It doesn't give line number or any other explanation, furthermore, the
> logs have no entry of anything for the time period whereby I ran this
> script via browser.
> 
> Whenever I take out the Thread reference the script runs just fine,
> even if I add other scriptlets with JSP code elsewhere, otherwise, as
> long as this "empty" or "useless" thread exists, I get the weird and
> very nondescript error.
> 
> Ideas?

Works fine for me on both tomcat 5.5.26 and 6.0.16. What version are you 
running?

-- 
Roger Lindsj´┐Ż
0
ISO
3/9/2008 6:34:41 PM
Reply: