Eclipse - Tomcat 7 - java.lang.IndexOutOfBoundsException on publish

后端 未结 4 1443
时光取名叫无心
时光取名叫无心 2021-02-18 18:32

I have a Webproject using maven and when I try to deploy it to Tomcat 7, I get the following message:

Publishing failed
Could not publish to the server.
java.lan         


        
相关标签:
4条回答
  • 2021-02-18 18:35

    Most probably some jar of your local maven repo that are included in your .war as dependency are corrupted. As jtsnr suggested, you can deploy your .war outside Eclipse to discover which jar is corrupted. But there is a quicker solution. Just locate the /target dir of your maven project (or just unzip the .war) and locate inside the *.jar files (should be under WEB-INF/lib). Now, with a simple zip tool (e.g.: 7-Zip) select all and extract. You will receive a prompt for each corrupted file you have: after this, locate the file in your Maven repo and delete the entire version for that file. In this way, if you have a big repo, you gain a lot of time avoiding to re-download the entire jar ecosystem :) HTH..

    0 讨论(0)
  • 2021-02-18 18:44

    The maven repository can be corrupt. It is best to remove the complete repository and update all projects in the workspace.

    0 讨论(0)
  • 2021-02-18 18:47

    Lets try once the way it is mentioned below. so please delete the previous installation. Step 1 Create a new Server run time (Window -> Preferences -> Server -> Runtime Environments). Step 2 Add Server to Eclipse (Window -> Show View -> Servers) add a new server configuration (right-click and select New -> Server) but DO NOT ADD ANY PROJECTS TO IT. Step 3 Open Server Overview page Double click the new server configuration to bring up the Server Overview page where we set port and time out for the Server. Step 4

    Under Server Locations select Use Tomcat installation. Save.

    You should be able to start your server now. Now add your project to the server and you're ready to go.

    0 讨论(0)
  • 2021-02-18 18:52

    Although this question has been answered - it was a problem with a corrupt repository, it is possible to determine which jar in your repository is corrupt by deploying the war to Tomcat outside of eclipse.

    In my situation Tomcat then reported in its log where the problem lay (guava-13.0.1.jar):

    SEVERE: Unable to process Jar entry [com/google/common/collect/package-info.class] from Jar
    [jar:file:/C:/Java/tomcat/apache-tomcat-7.0.42/webapps/myapp/WEB-INF/lib/guava-13.0.1.jar!/] for annotations
    java.util.zip.ZipException: invalid LOC header (bad signature)
    
    0 讨论(0)
提交回复
热议问题