0 0

报错java.lang.IndexOutOfBoundsException10

Java项目,部署项目后,启动tomcat6.0没报错,在浏览器键入访问地址http://localhost:8080/gyqp,显示:无法显示该页面,Myeclipse后台报异常,异常信息如下:

信息: Server startup in 12175 ms
2012-1-6 15:49:07 org.apache.jk.common.MsgAjp processHeader
严重: BAD packet signature 18245
2012-1-6 15:49:07 org.apache.jk.common.ChannelSocket processConnection
严重: Error, processing connection
java.lang.IndexOutOfBoundsException
    at java.io.BufferedInputStream.read(BufferedInputStream.java:306)
    at org.apache.jk.common.ChannelSocket.read(ChannelSocket.java:628)
    at org.apache.jk.common.ChannelSocket.receive(ChannelSocket.java:585)
    at org.apache.jk.common.ChannelSocket.processConnection(ChannelSocket.java:693)
    at org.apache.jk.common.ChannelSocket$SocketConnection.runIt(ChannelSocket.java:898)
    at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:690)
    at java.lang.Thread.run(Thread.java:595)

搞了好几天都不知道是什么原因,请大家帮帮我。谢谢了。



问题补充:项目就是在那个Service.xml文件里面配置的,配置信息: <br /><span style="color: red"><strong>&lt;Connector <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; port="8080" <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; redirectPort="7443" <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; protocol="AJP/1.3"&gt; <br />&nbsp;&nbsp;&nbsp; &lt;/Connector&gt; <br />&nbsp;&nbsp;&nbsp; &lt;Engine defaultHost="localhost" name="Catalina3"&gt; <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;Realm className="org.apache.catalina.realm.UserDatabaseRealm"/&gt; <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;Host appBase="webapps" name="localhost"&gt; <br /> &lt;Context path="/gyqp" docBase="E:\workspaces\gyqp_new\web" privileged="true" debug="0" reloadable="true"&gt;&lt;/Context&gt; <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;/Host&gt;</span> <br />&nbsp;&nbsp;&nbsp; &lt;/Engine&gt;</strong> <br /><div class="quote_title">housen1987 写道</div><div class="quote_div">把tomcat配置文件service.xml中的相关内容注解掉就可以了。 <br /> <br /><pre name="code" class="xml">
&lt;!– &lt;Connector port="8009" protocol="AJP/1.3" redirectPort="8443" /&gt;   –&gt;
</pre></div> <br />

问题补充:谢谢大家的回答,可是我的问题还是一如既往,现在都已经把端口号都改掉了,真想不通哪里的问题了。我把server.xml配置文件传上去。麻烦大家帮我看看,非常感谢!<div class="quote_title">xiaoZ5919 写道</div><div class="quote_div">你贴出配置就能明显地找出错误你的协议用错了你应该用protocol的值应该是http\1.1(BIO),或者NIO具体类名我记不太清楚了回头到公司了再详细查查,一个CONTEXT可以使用多个CONNECTOR但端口不同,你配置的ajp协议占用了8080,再用http协议去访问肯定报错不是一个协议啊</div> <br />

问题补充:~~~~(&gt;_&lt;)~~~~ ,我的问题解决不了啊!换了tomcat5.0&nbsp; 配置是没错误的了,也还是报这个错误。<div class="quote_title">xiaoZ5919 写道</div><div class="quote_div">哦! 得将port换成其他的不能和在service名为Catalina的connector端口重复</div> <br />

问题补充:这个 tomcat都开启不了了。报一连串的:严重: Parse Fatal Error at line 1 column 10: The processing instruction target matching "[xX][mM][lL]" is not allowed. <br />org.xml.sax.SAXParseException: The processing instruction target matching "[xX][mM][lL]" is not allowed. <br /> at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.createSAXParseException(ErrorHandlerWrapper.java:236) <br /> at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.fatalError(ErrorHandlerWrapper.java:215) <br /> at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:386) <br /> at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:316) <br /> at com.sun.org.apache.xerces.internal.impl.XMLScanner.reportFatalError(XMLScanner.java:1438) <br /> at com.sun.org.apache.xerces.internal.impl.XMLScanner.scanPIData(XMLScanner.java:689) <br /> at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanPIData(XMLDocumentFragmentScannerImpl.java:750) <br /> at com.sun.org.apache.xerces.internal.impl.XMLScanner.scanPI(XMLScanner.java:664) <br /> at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl$PrologDispatcher.dispatch(XMLDocumentScannerImpl.java:845) <br /> at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:368) <br /> at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:834) <br /> at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:764) <br /> at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:148) <br /> at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:1242) <br /> at org.apache.tomcat.util.digester.Digester.parse(Digester.java:1642) <br /> at org.apache.catalina.startup.Catalina.load(Catalina.java:524) <br /> at org.apache.catalina.startup.Catalina.start(Catalina.java:582) <br /> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) <br /> at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) <br /> at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) <br /> at java.lang.reflect.Method.invoke(Method.java:585) <br /> at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:289) <br /> at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:414) <br />2012-1-10 11:30:08 org.apache.catalina.startup.Catalina load <br />警告: Catalina.start using conf/server.xml: <div class="quote_title">xiaoZ5919 写道</div><div class="quote_div"><pre name="code" class="java">
&lt;?xml version='1.0' encoding='utf-8'?&gt;
&lt;!--
  Licensed to the Apache Software Foundation (ASF) under one or more
  contributor license agreements.  See the NOTICE file distributed with
  this work for additional information regarding copyright ownership.
  The ASF licenses this file to You under the Apache License, Version 2.0
  (the "License"); you may not use this file except in compliance with
  the License.  You may obtain a copy of the License at

      http://www.apache.org/licenses/LICENSE-2.0

  Unless required by applicable law or agreed to in writing, software
  distributed under the License is distributed on an "AS IS" BASIS,
  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  See the License for the specific language governing permissions and
  limitations under the License.
--&gt;
&lt;!-- Note:  A "Server" is not itself a "Container", so you may not
     define subcomponents such as "Valves" at this level.
     Documentation at /docs/config/server.html
--&gt;
&lt;Server port="8005" shutdown="SHUTDOWN"&gt;

  &lt;!--APR library loader. Documentation at /docs/apr.html --&gt;
  &lt;Listener className="org.apache.catalina.core.AprLifecycleListener" SSLEngine="on" /&gt;
  &lt;!--Initialize Jasper prior to webapps are loaded. Documentation at /docs/jasper-howto.html --&gt;
  &lt;Listener className="org.apache.catalina.core.JasperListener" /&gt;
  &lt;!-- Prevent memory leaks due to use of particular java/javax APIs--&gt;
  &lt;Listener className="org.apache.catalina.core.JreMemoryLeakPreventionListener" /&gt;
  &lt;!-- JMX Support for the Tomcat server. Documentation at /docs/non-existent.html --&gt;
  &lt;Listener className="org.apache.catalina.mbeans.ServerLifecycleListener" /&gt;
  &lt;Listener className="org.apache.catalina.mbeans.GlobalResourcesLifecycleListener" /&gt;

  &lt;!-- Global JNDI resources
       Documentation at /docs/jndi-resources-howto.html
  --&gt;
  &lt;GlobalNamingResources&gt;
    &lt;!-- Editable user database that can also be used by
         UserDatabaseRealm to authenticate users
    --&gt;
    &lt;Resource name="UserDatabase" auth="Container"
              type="org.apache.catalina.UserDatabase"
              description="User database that can be updated and saved"
              factory="org.apache.catalina.users.MemoryUserDatabaseFactory"
              pathname="conf/tomcat-users.xml" /&gt;
  &lt;/GlobalNamingResources&gt;

  &lt;!-- A "Service" is a collection of one or more "Connectors" that share
       a single "Container" Note:  A "Service" is not itself a "Container",
       so you may not define subcomponents such as "Valves" at this level.
       Documentation at /docs/config/service.html
   --&gt;
  &lt;Service name="Catalina"&gt;
 
    &lt;!--The connectors can use a shared executor, you can define one or more named thread pools--&gt;
    &lt;!--
    &lt;Executor name="tomcatThreadPool" namePrefix="catalina-exec-"
        maxThreads="150" minSpareThreads="4"/&gt;
    --&gt;
   
   
    &lt;!-- A "Connector" represents an endpoint by which requests are received
         and responses are returned. Documentation at :
         Java HTTP Connector: /docs/config/http.html (blocking &amp; non-blocking)
         Java AJP  Connector: /docs/config/ajp.html
         APR (HTTP/AJP) Connector: /docs/apr.html
         Define a non-SSL HTTP/1.1 Connector on port 8080
    --&gt;
    &lt;Connector port="8088" protocol="HTTP/1.1"
               connectionTimeout="20000"
               redirectPort="8443" /&gt;
    &lt;!-- A "Connector" using the shared thread pool--&gt;
    &lt;!--
    &lt;Connector executor="tomcatThreadPool"
               port="8080" protocol="HTTP/1.1"
               connectionTimeout="20000"
               redirectPort="8443" /&gt;
    --&gt;          
    &lt;!-- Define a SSL HTTP/1.1 Connector on port 8443
         This connector uses the JSSE configuration, when using APR, the
         connector should be using the OpenSSL style configuration
         described in the APR documentation --&gt;
    &lt;!--
    &lt;Connector port="8443" protocol="HTTP/1.1" SSLEnabled="true"
               maxThreads="150" scheme="https" secure="true"
               clientAuth="false" sslProtocol="TLS" /&gt;
    --&gt;

    &lt;!-- Define an AJP 1.3 Connector on port 8009 --&gt;
    &lt;Connector port="8009" protocol="AJP/1.3" redirectPort="8443" /&gt;


    &lt;!-- An Engine represents the entry point (within Catalina) that processes
         every request.  The Engine implementation for Tomcat stand alone
         analyzes the HTTP headers included with the request, and passes them
         on to the appropriate Host (virtual host).
         Documentation at /docs/config/engine.html --&gt;

    &lt;!-- You should set jvmRoute to support load-balancing via AJP ie :
    &lt;Engine name="Catalina" defaultHost="localhost" jvmRoute="jvm1"&gt;        
    --&gt;
    &lt;Engine name="Catalina" defaultHost="localhost"&gt;

      &lt;!--For clustering, please take a look at documentation at:
          /docs/cluster-howto.html  (simple how to)
          /docs/config/cluster.html (reference documentation) --&gt;
      &lt;!--
      &lt;Cluster className="org.apache.catalina.ha.tcp.SimpleTcpCluster"/&gt;
      --&gt;       

      &lt;!-- The request dumper valve dumps useful debugging information about
           the request and response data received and sent by Tomcat.
           Documentation at: /docs/config/valve.html --&gt;
      &lt;!--
      &lt;Valve className="org.apache.catalina.valves.RequestDumperValve"/&gt;
      --&gt;

      &lt;!-- This Realm uses the UserDatabase configured in the global JNDI
           resources under the key "UserDatabase".  Any edits
           that are performed against this UserDatabase are immediately
           available for use by the Realm.  --&gt;
      &lt;Realm className="org.apache.catalina.realm.UserDatabaseRealm"
             resourceName="UserDatabase"/&gt;

      &lt;!-- Define the default virtual host
           Note: XML Schema validation will not work with Xerces 2.2.
       --&gt;
      &lt;Host name="localhost"  appBase="webapps"
            unpackWARs="true" autoDeploy="true"
            xmlValidation="false" xmlNamespaceAware="false"&gt;

        &lt;!-- SingleSignOn valve, share authentication between web applications
             Documentation at: /docs/config/valve.html --&gt;
        &lt;!--
        &lt;Valve className="org.apache.catalina.authenticator.SingleSignOn" /&gt;
        --&gt;

        &lt;!-- Access log processes all example.
             Documentation at: /docs/config/valve.html --&gt;
        &lt;!--
        &lt;Valve className="org.apache.catalina.valves.AccessLogValve" directory="logs" 
               prefix="localhost_access_log." suffix=".txt" pattern="common" resolveHosts="false"/&gt;
        --&gt;

      &lt;/Host&gt;
    &lt;/Engine&gt;
  &lt;/Service&gt;
 
  &lt;Service  name="Catalina3"&gt;
    &lt;Connector
        port="8080"
        redirectPort="7443"
        minSpareThreads="25"
        connectionTimeout="20000"
        maxSpareThreads="75"
        maxThreads="150"
URIEncoding="UTF-8"&gt;
    &lt;/Connector&gt;
    &lt;Connector
        port="8010"
        redirectPort="7443"
        protocol="AJP/1.3"&gt;
    &lt;/Connector&gt;


    &lt;Engine defaultHost="localhost" name="Catalina3"&gt;
      &lt;Realm className="org.apache.catalina.realm.UserDatabaseRealm"/&gt;
      &lt;Host appBase="webapps" name="localhost"&gt;
&lt;Context path="/gyqp" docBase="E:\workspaces\gyqp_new\web" privileged="true" debug="0" reloadable="true"&gt;&lt;/Context&gt;
      &lt;/Host&gt;
    &lt;/Engine&gt;
  &lt;/Service&gt;
&lt;/Server&gt;
</pre> <br /> <br />不应该啊 邪门!</div> <br />

问题补充:嗯嗯、Thank you!<div class="quote_title">xiaoZ5919 写道</div><div class="quote_div">我就是把你的xml service名为Catalina3的http connector那段注释去掉 并且改了一下端口 <br />service是多个connector和host(context)的组合,你的catalina3中只有ajp3,没有http并且你用http+ajp的那个端口去访问,会被ajp connector接受但是协议不用所以处理出错 自己找原因吧</div> <br />
2012年1月06日 16:14

10个答案 按时间排序 按投票排序

0 0

采纳的答案

我就是把你的xml service名为Catalina3的http connector那段注释去掉 并且改了一下端口
service是多个connector和host(context)的组合,你的catalina3中只有ajp3,没有http并且你用http+ajp的那个端口去访问,会被ajp connector接受但是协议不用所以处理出错 自己找原因吧

2012年1月10日 11:40
0 0

同时访问时输入的端口不能是protocol="AJP/1.3"指定的端口,而是8080端口。

2013年9月14日 11:38
0 0

我也遇到同样的问题:java.lang.IndexOutOfBoundsException

原因是:<Context crossContext="true" docBase="G:\web\workspace\apexWeb\WebRoot" path="" reloadable="false"></Context>
这没有配置或其docBase的路径指出错误。

2013年9月14日 11:33
0 0

<?xml version='1.0' encoding='utf-8'?>
<!--
  Licensed to the Apache Software Foundation (ASF) under one or more
  contributor license agreements.  See the NOTICE file distributed with
  this work for additional information regarding copyright ownership.
  The ASF licenses this file to You under the Apache License, Version 2.0
  (the "License"); you may not use this file except in compliance with
  the License.  You may obtain a copy of the License at

      http://www.apache.org/licenses/LICENSE-2.0

  Unless required by applicable law or agreed to in writing, software
  distributed under the License is distributed on an "AS IS" BASIS,
  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  See the License for the specific language governing permissions and
  limitations under the License.
-->
<!-- Note:  A "Server" is not itself a "Container", so you may not
     define subcomponents such as "Valves" at this level.
     Documentation at /docs/config/server.html
 -->
<Server port="8005" shutdown="SHUTDOWN">

  <!--APR library loader. Documentation at /docs/apr.html -->
  <Listener className="org.apache.catalina.core.AprLifecycleListener" SSLEngine="on" />
  <!--Initialize Jasper prior to webapps are loaded. Documentation at /docs/jasper-howto.html -->
  <Listener className="org.apache.catalina.core.JasperListener" />
  <!-- Prevent memory leaks due to use of particular java/javax APIs-->
  <Listener className="org.apache.catalina.core.JreMemoryLeakPreventionListener" />
  <!-- JMX Support for the Tomcat server. Documentation at /docs/non-existent.html -->
  <Listener className="org.apache.catalina.mbeans.ServerLifecycleListener" />
  <Listener className="org.apache.catalina.mbeans.GlobalResourcesLifecycleListener" />

  <!-- Global JNDI resources
       Documentation at /docs/jndi-resources-howto.html
  -->
  <GlobalNamingResources>
    <!-- Editable user database that can also be used by
         UserDatabaseRealm to authenticate users
    -->
    <Resource name="UserDatabase" auth="Container"
              type="org.apache.catalina.UserDatabase"
              description="User database that can be updated and saved"
              factory="org.apache.catalina.users.MemoryUserDatabaseFactory"
              pathname="conf/tomcat-users.xml" />
  </GlobalNamingResources>

  <!-- A "Service" is a collection of one or more "Connectors" that share
       a single "Container" Note:  A "Service" is not itself a "Container", 
       so you may not define subcomponents such as "Valves" at this level.
       Documentation at /docs/config/service.html
   -->
  <Service name="Catalina">
  
    <!--The connectors can use a shared executor, you can define one or more named thread pools-->
    <!--
    <Executor name="tomcatThreadPool" namePrefix="catalina-exec-" 
        maxThreads="150" minSpareThreads="4"/>
    -->
    
    
    <!-- A "Connector" represents an endpoint by which requests are received
         and responses are returned. Documentation at :
         Java HTTP Connector: /docs/config/http.html (blocking & non-blocking)
         Java AJP  Connector: /docs/config/ajp.html
         APR (HTTP/AJP) Connector: /docs/apr.html
         Define a non-SSL HTTP/1.1 Connector on port 8080
    -->
    <Connector port="8088" protocol="HTTP/1.1" 
               connectionTimeout="20000" 
               redirectPort="8443" />
    <!-- A "Connector" using the shared thread pool-->
    <!--
    <Connector executor="tomcatThreadPool"
               port="8080" protocol="HTTP/1.1" 
               connectionTimeout="20000" 
               redirectPort="8443" />
    -->           
    <!-- Define a SSL HTTP/1.1 Connector on port 8443
         This connector uses the JSSE configuration, when using APR, the 
         connector should be using the OpenSSL style configuration
         described in the APR documentation -->
    <!--
    <Connector port="8443" protocol="HTTP/1.1" SSLEnabled="true"
               maxThreads="150" scheme="https" secure="true"
               clientAuth="false" sslProtocol="TLS" />
    -->

    <!-- Define an AJP 1.3 Connector on port 8009 -->
    <Connector port="8009" protocol="AJP/1.3" redirectPort="8443" />


    <!-- An Engine represents the entry point (within Catalina) that processes
         every request.  The Engine implementation for Tomcat stand alone
         analyzes the HTTP headers included with the request, and passes them
         on to the appropriate Host (virtual host).
         Documentation at /docs/config/engine.html -->

    <!-- You should set jvmRoute to support load-balancing via AJP ie :
    <Engine name="Catalina" defaultHost="localhost" jvmRoute="jvm1">         
    --> 
    <Engine name="Catalina" defaultHost="localhost">

      <!--For clustering, please take a look at documentation at:
          /docs/cluster-howto.html  (simple how to)
          /docs/config/cluster.html (reference documentation) -->
      <!--
      <Cluster className="org.apache.catalina.ha.tcp.SimpleTcpCluster"/>
      -->        

      <!-- The request dumper valve dumps useful debugging information about
           the request and response data received and sent by Tomcat.
           Documentation at: /docs/config/valve.html -->
      <!--
      <Valve className="org.apache.catalina.valves.RequestDumperValve"/>
      -->

      <!-- This Realm uses the UserDatabase configured in the global JNDI
           resources under the key "UserDatabase".  Any edits
           that are performed against this UserDatabase are immediately
           available for use by the Realm.  -->
      <Realm className="org.apache.catalina.realm.UserDatabaseRealm"
             resourceName="UserDatabase"/>

      <!-- Define the default virtual host
           Note: XML Schema validation will not work with Xerces 2.2.
       -->
      <Host name="localhost"  appBase="webapps"
            unpackWARs="true" autoDeploy="true"
            xmlValidation="false" xmlNamespaceAware="false">

        <!-- SingleSignOn valve, share authentication between web applications
             Documentation at: /docs/config/valve.html -->
        <!--
        <Valve className="org.apache.catalina.authenticator.SingleSignOn" />
        -->

        <!-- Access log processes all example.
             Documentation at: /docs/config/valve.html -->
        <!--
        <Valve className="org.apache.catalina.valves.AccessLogValve" directory="logs"  
               prefix="localhost_access_log." suffix=".txt" pattern="common" resolveHosts="false"/>
        -->

      </Host>
    </Engine>
  </Service>
  
  <Service  name="Catalina3">
    <Connector
        port="8080"
        redirectPort="7443"
        minSpareThreads="25"
        connectionTimeout="20000"
        maxSpareThreads="75"
        maxThreads="150"
		URIEncoding="UTF-8">
    </Connector> 
    <Connector
        port="8010"
        redirectPort="7443"
        protocol="AJP/1.3">
    </Connector>
	
	
    <Engine defaultHost="localhost" name="Catalina3">
      <Realm className="org.apache.catalina.realm.UserDatabaseRealm"/>
      <Host appBase="webapps" name="localhost">
			<Context path="/gyqp" docBase="E:\workspaces\gyqp_new\web" privileged="true" debug="0" reloadable="true"></Context>
      </Host>
    </Engine>
  </Service>
</Server>


不应该啊 邪门!

2012年1月10日 11:22
0 0

哦! 得将port换成其他的不能和在service名为Catalina的connector端口重复

2012年1月09日 12:00
0 0


<Connector port="8088" protocol="HTTP/1.1"
               connectionTimeout="20000"
               redirectPort="8443" />

添加在service Catalina3中

2012年1月09日 11:46
0 0

你贴出配置就能明显地找出错误你的协议用错了你应该用protocol的值应该是http\1.1(BIO),或者NIO具体类名我记不太清楚了回头到公司了再详细查查,一个CONTEXT可以使用多个CONNECTOR但端口不同,你配置的ajp协议占用了8080,再用http协议去访问肯定报错不是一个协议啊

2012年1月07日 08:22
0 0

port="8080"  是否被占用。

2012年1月07日 07:53
0 0

引用
严重: BAD packet signature 18245


<Connector port="8009"  
               enableLookups="false" redirectPort="8443" protocol="AJP/1.3" /> 
查看一下是否有访问8009端口的程序。关闭这个程序或者换一个其他端口

2012年1月06日 17:27
0 0

把tomcat配置文件service.xml中的相关内容注解掉就可以了。

<!– <Connector port="8009" protocol="AJP/1.3" redirectPort="8443" />   –>

2012年1月06日 16:27

相关推荐

    在Java中异常分析

    - **异常路径**:`java.lang.Object -&gt; java.lang.Throwable -&gt; java.lang.Exception -&gt; java.lang.RuntimeException -&gt; java.lang.IndexOutOfBoundsException -&gt; java.lang.ArrayIndexOutOfBoundsException` ...

    java.lang.IndexOutOfBoundsException(解决方案).md

    项目中碰到的,已解决,写个文档记录一下

    java异常类型.txt

    2. **`java.lang.IndexOutOfBoundsException`** - 访问数组时索引超出范围时抛出此异常。 3. **`java.lang.ArrayIndexOutOfBoundsException`** - 数组索引越界异常,当数组索引超出数组边界时发生。 4. **`java.lang...

    java 数组下标越界异常(ArrayIndexOutOfBoundsException)

    这个异常属于`java.lang.IndexOutOfBoundsException`类的子类,是Java运行时系统在检测到错误的数组索引时抛出的。 ### 数组的基本概念 数组在内存中占据连续的空间,每个元素通过索引来访问,索引通常是从0开始的...

    Java常见异常和错误总结

    java.lang.IndexOutOfBoundsException - **定义**: 访问数组或字符串的下标超出其有效范围时触发的异常。 - **常见场景**: - 使用变量作为下标时。 - 数组长度动态决定时。 - **解决方法**: - 在访问前检查数组...

    JAVA讲义第6章.pdf

    文件片段还提到了一些Java的核心类库,如`java.lang.Object`、`java.lang.Throwable`、`java.lang.Exception`、`java.lang.RuntimeException`、`java.lang.Non_RuntimeException`等。这里提到了Java的基本类型层次...

    RecyclerView索引溢出异常的解决方法

    java.lang.IndexOutOfBoundsException: Inconsistency detected. Invalid view holder adapter positionViewHolder 继承并重写LinearLayoutManager.onLayoutChildren()方法 class WrappedLinearLayoutManager : ...

    JAVA相关基础知识

    运行时异常在程序运行过程中可能出现,常见的如NullPointerException和IndexOutOfBoundsException等。 Servlet生命周期涉及几个重要的方法:init()、service()、doGet()、doPost()、destroy()等。Servlet在容器启动...

    java常见异常总结

    `java.lang.IndexOutOfBoundsException` - **定义**:当试图访问数组或集合中的一个不存在的索引时,会抛出此类异常。 - **常见场景**: - 使用了超出数组长度的索引。 - 计算索引时出现逻辑错误。 - **示例**:...

    JAVA项目常用异常处理汇总

    4.数组下标越界异常(java.lang.IndexOutOfBoundsException) 这种异常的原因是数组下标越界,解决方法是检查数组的长度,在对数组进行操作时建议先用length获取其数组长度,从而规避错误。 5.数学运算异常(java....

    Java面试题集.rar

    JAVA面试题集 基础知识: 1.C++或Java中的异常处理机制的简单原理和应用。 当JAVA程序违反了JAVA的语义规则时,JAVA虚拟机就会将发生的错误表示为一个异常。...所有的异常都是java.lang.Thowable 的子类。

    Java程序常见异常及处理汇总

    3. java.lang.IndexOutOfBoundsException(数组下标越界异常) 原因:查看程序中调用的数组或者字符串的下标值是不是超出了数组的范围。解决方法:检查数组的下标值是否超出了数组的范围。 4. java.lang....

    各大公司Java面试题

    基础知识:1.C++或Java中的异常处理机制的简单原理和应用。当JAVA程序违反了JAVA的语义规则时,JAVA虚拟机就会将发生的错误表示为一个异常。违反语义规则包括2种情况。...所有的异常都是java.lang.Thowable的子类。

    Java面试题笔试题大全

    java面试题集 1.C++或Java中的异常处理机制的简单原理和应用。 当JAVA程序违反了JAVA的语义规则时,JAVA虚拟机就会将发生的错误表示为一个异常。违反语义规则包括2种情况...所有的异常都是java.lang.Thowable的子类。

    编程语言Java试卷.pdf

    - java.lang包包含Java语言的核心类,如Object、Throwable、String、Math等。 - java.util包提供了一系列的实用工具类,例如Scanner用于输入输出。 5. Java编程技巧: - 在循环中使用for-each结构,可以简化对数组...

    收藏的JAVA面试题大全

    所有的异常都是java.lang.Thowable的子类。 2. Java的接口和C++的虚类的相同和不同处。 由 于Java不支持多继承,而有可能某个类或对象要使用分别在几个类或对象里面的方法或属性,现有的单继承机制就不能满足...

    Java API文档中文版

    例如,`java.lang`包是最基础的包,其中包含了所有Java程序都会用到的基本类型和系统类,如`String`、`Object`、`System`等。`java.util`包提供了集合框架、日期时间、散列映射、队列等常用工具类,如`ArrayList`、`...

    java面试.docx

    异常都是`java.lang.Throwable`的子类,程序员可以通过`throw`关键字自定义异常。 2. **接口与虚类**:Java的接口类似于C++的虚类,但不完全相同。接口没有实现代码,而C++的虚类可以有。Java中一个类可以实现多个...

    java 索引越界异常(IndexOutOfBoundsException)

    Java中的“索引越界异常”(IndexOutOfBoundsException)是编程时常见的错误类型,尤其是在处理数组、集合或字符串等数据结构时。这个异常通常发生在尝试访问一个不存在的位置时,比如访问数组的一个负索引或者超出...

Global site tag (gtag.js) - Google Analytics