I have been trying to follow http://www.liferay.com/documentation/liferay-portal/6.1/development/-/ai/developing-an-ext-plug-4 to deploy the ext plugin and i am getting this issue now even when i do the clean deployment(deleting everything and use "ant deploy"). Why would the server try to find web.xml file in temp folder when i am doing the clean re-deployment(as mentioned in the document). Any help will be appreciated.

The full stack trace is as below:

Jun 9, 2015 2:09:46 PM org.apache.catalina.core.AprLifecycleListener init
INFO: The APR based Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: .:/Library/Java/Extensions:/System/Library/Java/Extensions:/usr/lib/java
Jun 9, 2015 2:09:46 PM org.apache.coyote.AbstractProtocol init
INFO: Initializing ProtocolHandler ["http-bio-8080"]
Jun 9, 2015 2:09:46 PM org.apache.coyote.AbstractProtocol init
INFO: Initializing ProtocolHandler ["ajp-bio-8009"]
Jun 9, 2015 2:09:46 PM org.apache.catalina.startup.Catalina load
INFO: Initialization processed in 845 ms
Jun 9, 2015 2:09:46 PM org.apache.catalina.core.StandardService startInternal
INFO: Starting service Catalina
Jun 9, 2015 2:09:46 PM org.apache.catalina.core.StandardEngine startInternal
INFO: Starting Servlet Engine: Apache Tomcat/7.0.40
Jun 9, 2015 2:09:46 PM org.apache.catalina.startup.HostConfig deployDescriptor
INFO: Deploying configuration descriptor /Users/sampleuser/company/tools/liferay-portal-6.1-ee-ga3-sp4/tomcat-7.0.40/conf/Catalina/localhost/ROOT.xml
Loading jar:file:/Users/sampleuser/company/tools/liferay-portal-6.1-ee-ga3-sp4/tomcat-7.0.40/webapps/ROOT/WEB-INF/lib/portal-impl.jar!/system.properties
Loading jar:file:/Users/sampleuser/company/tools/liferay-portal-6.1-ee-ga3-sp4/tomcat-7.0.40/webapps/ROOT/WEB-INF/lib/portal-impl.jar!/portal.properties
Loading jar:file:/Users/sampleuser/company/tools/liferay-portal-6.1-ee-ga3-sp4/tomcat-7.0.40/webapps/ROOT/WEB-INF/lib/portal-impl.jar!/portal-patched.properties
Loading file:/Users/sampleuser/company/tools/liferay-portal-6.1-ee-ga3-sp4/portal-setup-wizard.properties
Loading file:/Users/sampleuser/company/tools/liferay-portal-6.1-ee-ga3-sp4/portal-ide.properties
Loading file:/Users/sampleuser/company/tools/liferay-portal-6.1-ee-ga3-sp4/tomcat-7.0.40/webapps/ROOT/WEB-INF/classes/portal-developer.properties
Jun 9, 2015 2:09:56 PM org.apache.catalina.core.ApplicationContext log
INFO: Initializing Spring root WebApplicationContext
14:10:03,193 INFO  [localhost-startStop-1][DialectDetector:71] Determine dialect for HSQL Database Engine 2
14:10:03,197 WARN  [localhost-startStop-1][DialectDetector:86] Liferay is configured to use Hypersonic as its database. Do NOT use Hypersonic in production. Hypersonic is an embedded database useful for development and demo'ing purposes. The database settings can be changed in portal-ext.properties.
14:10:03,270 INFO  [localhost-startStop-1][DialectDetector:136] Found dialect org.hibernate.dialect.HSQLDialect
Starting Liferay Portal Enterprise Edition 6.1.30 EE (Paton / Build 6130 / August 16, 2013)
14:10:24,434 INFO  [localhost-startStop-1][StartupAction:80] The following patches are installed: business-productivity-3-6130, administration-8-6130, search-6-6130, asset-framework-12-6130, user-interface-13-6130, dynamic-data-lists-9-6130, development-8-6130, platform-31-6130, social-networking-4-6130, wcm-core-18-6130, collaboration-12-6130, misc-7-6130, document-management-15-6130, web-content-15-6130
14:10:24,936 INFO  [localhost-startStop-1][BaseDB:478] Database supports case sensitive queries
14:10:25,306 INFO  [localhost-startStop-1][LicenseManager:?] Portal Development license validation passed
14:10:25,319 INFO  [localhost-startStop-1][ServerDetector:156] Server supports hot deploy
14:10:25,324 INFO  [localhost-startStop-1][PluginPackageUtil:1046] Reading plugin package for the root context
14:10:28,174 INFO  [localhost-startStop-1][AutoDeployDir:144] Auto deploy scanner started for /Users/sampleuser/company/tools/liferay-portal-6.1-ee-ga3-sp4/deploy
14:10:29,852 INFO  [liferay/scheduler_dispatch-1][PluginPackageUtil:1308] Reloading repositories
Jun 9, 2015 2:10:30 PM org.apache.catalina.core.ApplicationContext log
INFO: Initializing Spring FrameworkServlet 'Remoting Servlet'
Jun 9, 2015 2:10:33 PM org.apache.catalina.startup.HostConfig  deployDirectory
INFO: Deploying web application directory /Users/sampleuser/company/tools/liferay-portal-6.1-ee-ga3-sp4/tomcat-7.0.40/webapps/companycs-ext
14:10:35,069 INFO  [localhost-startStop-1][HotDeployImpl:156] Deploying companycs-ext from queue
14:10:35,071 INFO  [localhost-startStop-1][PluginPackageUtil:1049] Reading   plugin package for companycs-ext
Jun 9, 2015 2:10:35 PM org.apache.catalina.core.ApplicationContext log
INFO: Initializing Spring root WebApplicationContext
14:10:35,280 INFO  [localhost-startStop-1][ExtHotDeployListener:119] Registering extension environment for companycs-ext
java.lang.StringIndexOutOfBoundsException: String index out of range: -325
    at java.lang.String.substring(String.java:1937)
    at com.liferay.portal.tools.WebXMLBuilder.getCustomContent(WebXMLBuilder.java:136)
    at com.liferay.portal.tools.WebXMLBuilder.<init>(WebXMLBuilder.java:88)
    at com.liferay.portal.tools.WebXMLBuilder.main(WebXMLBuilder.java:45)
    at com.liferay.portal.deploy.hot.ExtHotDeployListener.mergeWebXml(ExtHotDeployListener.java:246)
    at com.liferay.portal.deploy.hot.ExtHotDeployListener.installExt(ExtHotDeployListener.java:222)
    at com.liferay.portal.deploy.hot.ExtHotDeployListener.doInvokeDeploy(ExtHotDeployListener.java:167)
    at com.liferay.portal.deploy.hot.ExtHotDeployListener.invokeDeploy(ExtHotDeployListener.java:56)
    at com.liferay.portal.deploy.hot.HotDeployImpl.doFireDeployEvent(HotDeployImpl.java:214)
    at com.liferay.portal.deploy.hot.HotDeployImpl.fireDeployEvent(HotDeployImpl.java:98)
    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 com.liferay.portal.security.lang.DoPrivilegedHandler.doInvoke(DoPrivilegedHandler.java:88)
    at com.liferay.portal.security.lang.DoPrivilegedHandler.invoke(DoPrivilegedHandler.java:56)
    at com.sun.proxy.$Proxy30.fireDeployEvent(Unknown Source)
    at com.liferay.portal.kernel.deploy.hot.HotDeployUtil.fireDeployEvent(HotDeployUtil.java:28)
    at com.liferay.portal.kernel.servlet.PluginContextListener.fireDeployEvent(PluginContextListener.java:164)
    at com.liferay.portal.kernel.servlet.PluginContextListener.doPortalInit(PluginContextListener.java:154)
    at com.liferay.portal.kernel.util.BasePortalLifecycle.portalInit(BasePortalLifecycle.java:44)
    at com.liferay.portal.kernel.util.PortalLifecycleUtil.register(PortalLifecycleUtil.java:74)
    at com.liferay.portal.kernel.util.PortalLifecycleUtil.register(PortalLifecycleUtil.java:58)
    at   com.liferay.portal.kernel.util.BasePortalLifecycle.registerPortalLifecycle(BasePortalLifecycle.java:54)
    at   com.liferay.portal.kernel.servlet.PluginContextListener.contextInitialized(PluginContextListener.java:116)
    at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4887)
    at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5381)
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
    at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:901)
    at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:877)
    at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:633)
    at  org.apache.catalina.startup.HostConfig.deployDirectory(HostConfig.java:1114)
    at  org.apache.catalina.startup.HostConfig$DeployDirectory.run(HostConfig.java:1672)
    at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:439)
    at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
    at java.util.concurrent.FutureTask.run(FutureTask.java:138)
    at  java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:895)
    at   java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:918)
    at java.lang.Thread.run(Thread.java:695)
14:10:35,537 ERROR [localhost-startStop-1][HotDeployImpl:111] com.liferay.portal.kernel.deploy.hot.HotDeployException: Error registering extension environment for companycs-ext
com.liferay.portal.kernel.deploy.hot.HotDeployException: Error registering extension environment for companycs-ext
    at com.liferay.portal.kernel.deploy.hot.BaseHotDeployListener.throwHotDeployException(BaseHotDeployListener.java:46)
    at         com.liferay.portal.deploy.hot.ExtHotDeployListener.invokeDeploy(ExtHotDeployListener.java:59)
    at   com.liferay.portal.deploy.hot.HotDeployImpl.doFireDeployEvent(HotDeployImpl.java:214)
    at com.liferay.portal.deploy.hot.HotDeployImpl.fireDeployEvent(HotDeployImpl.java:98)
    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 com.liferay.portal.security.lang.DoPrivilegedHandler.doInvoke(DoPrivilegedHandler.java:88)
    at com.liferay.portal.security.lang.DoPrivilegedHandler.invoke(DoPrivilegedHandler.java:56)
    at com.sun.proxy.$Proxy30.fireDeployEvent(Unknown Source)
    at com.liferay.portal.kernel.deploy.hot.HotDeployUtil.fireDeployEvent(HotDeployUtil.java:28)
    at com.liferay.portal.kernel.servlet.PluginContextListener.fireDeployEvent(PluginContextListener.java:164)
    at com.liferay.portal.kernel.servlet.PluginContextListener.doPortalInit(PluginContextListener.java:154)
    at com.liferay.portal.kernel.util.BasePortalLifecycle.portalInit(BasePortalLifecycle.java:44)
    at com.liferay.portal.kernel.util.PortalLifecycleUtil.register(PortalLifecycleUtil.java:74)
    at com.liferay.portal.kernel.util.PortalLifecycleUtil.register(PortalLifecycleUtil.java:58)
    at com.liferay.portal.kernel.util.BasePortalLifecycle.registerPortalLifecycle(BasePortalLifecycle.java:54)
    at com.liferay.portal.kernel.servlet.PluginContextListener.contextInitialized(PluginContextListener.java:116)
    at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4887)
    at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5381)
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
    at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:901)
    at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:877)
    at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:633)
    at org.apache.catalina.startup.HostConfig.deployDirectory(HostConfig.java:1114)
    at org.apache.catalina.startup.HostConfig$DeployDirectory.run(HostConfig.java:1672)
    at  java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:439)
    at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
    at java.util.concurrent.FutureTask.run(FutureTask.java:138)
    at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:895)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:918)
    at java.lang.Thread.run(Thread.java:695)
Caused by: Warning: Could not find file /Users/sampleuser/company/tools/liferay-portal-6.1-ee-ga3-sp4/tomcat-7.0.40/temp/20150609141035295/web.xml to copy.
    at org.apache.tools.ant.taskdefs.Copy.copySingleFile(Copy.java:619)
    at org.apache.tools.ant.taskdefs.Copy.execute(Copy.java:444)
    at com.liferay.util.ant.CopyTask.copyFile(CopyTask.java:137)
    at com.liferay.util.ant.CopyTask.copyFile(CopyTask.java:101)
    at com.liferay.util.ant.CopyTask.copyFile(CopyTask.java:93)
    at com.liferay.portal.deploy.hot.ExtHotDeployListener.mergeWebXml(ExtHotDeployListener.java:258)
    at com.liferay.portal.deploy.hot.ExtHotDeployListener.installExt(ExtHotDeployListener.java:222)
    at com.liferay.portal.deploy.hot.ExtHotDeployListener.doInvokeDeploy(ExtHotDeployListener.java:167)
    at  com.liferay.portal.deploy.hot.ExtHotDeployListener.invokeDeploy(ExtHotDeployListener.java:56)
    ... 31 more
Jun 9, 2015 2:10:35 PM org.apache.catalina.startup.HostConfig deployDirectory
INFO: Deploying web application directory   /Users/sampleuser/company/tools/liferay-portal-6.1-ee-ga3-sp4/tomcat-7   7.0.40/webapps/kaleo-designer-portlet
14:10:36,624 INFO  [localhost-startStop-1][HotDeployEvent:124] Plugin kaleo-designer-portlet requires kaleo-web, portal-compat-hook
14:10:36,659 INFO  [localhost-startStop-1][HotDeployImpl:156] Queueing kaleo-designer-portlet for deploy because it is missing kaleo-web, portal-compat-hook
Jun 9, 2015 2:10:36 PM org.apache.catalina.startup.HostConfig deployDirectory
INFO: Deploying web application directory /Users/sampleuser/company/tools/liferay-portal-6.1-ee-ga3-sp4/tomcat- 7.0.40/webapps/kaleo-forms-portlet
14:10:38,019 INFO  [localhost-startStop-1][HotDeployEvent:124] Plugin kaleo-forms-portlet requires kaleo-designer-portlet, kaleo-web, portal-compat-hook
14:10:38,036 INFO  [localhost-startStop-1][HotDeployImpl:156] Queueing kaleo-forms-portlet for deploy because it is missing kaleo-designer-portlet, kaleo-web, portal-compat-hook
1

There are 1 best solutions below

2
On

Liferay tries to merge the web.xml of your ext plugin with the original one - into a temporary file. As the merging is only "rudimentary" it has some problems with "unusual" formats.

Either your web.xml has a closing </web-app> (for example in a comment) before the <web-app> tag:

<!-- </web-app> ... -->
<web-app>
    ...
</web-app>

Here you just need to remove the comment.

Or you have no </web-app> at all:

<web-app ... />

In that case you should change it to:

<web-app ...>
</web-app>