Problems with eclipse and maven war plugin overlay - eclipse

I have a project where I am replacing out the web.xml and other files using a war overlay in maven. Everything works great and then I try to import into eclipse and have all kinds of problems.
To start with I use mvn eclipse:eclipse to generate my Eclipse files. This works but the imported project does not contain the Dynamic Web facet.
Once the Dynamic Web facet (version 2.5) is added, the project still recognizes the deployment descriptor as 2.4 and gives me errors anyway even though it is;
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<web-app version="2.5" xmlns="http://java.sun.com/xml/ns/j2ee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="
http://java.sun.com/xml/ns/j2ee
http://java.sun.com/xml/ns/j2ee/web-app_2_5.xsd">
Has anyone struggled through this type of thing before?

Related

Eclipse Maven Update cleans jaxb generated classes and Regenerates them without taking the class name tag into account

I have troubles with eclipse / maven in Netbeans it's working as expected.
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<jxb:bindings xmlns:jxb="http://java.sun.com/xml/ns/jaxb"
xmlns:xjc="http://java.sun.com/xml/ns/jaxb/xjc"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/jxb http://java.sun.com/xml/ns/jaxb/bindingschema_2_0.xsd"
jxb:extensionBindingPrefixes="xjc"
version="2.1">
<jxb:bindings schemaLocation="http://myserver/schemas/CustomerOrder_v1.7.xsd" node="/xsd:schema">
<jxb:bindings node="//xsd:element[#name='customerOrder']">
<jxb:class name="ElectronicCustomerOrder"/>
</jxb:bindings>
<jxb:bindings node="//xsd:element[#name='deliveryDate']" multiple="true">
<xjc:javaType adapter="com.prodega.xml.JodaTimeDateAdapter" name="org.joda.time.LocalDate" />
</jxb:bindings>
</jxb:bindings>
</jxb:bindings>
if i do a maven update in eclipse (photon or mars) it generates a class called CustomerOrder into the target:
image
But i'm expecting a class named ElectronicCustomerOrder. As soon i make a change in the xjb file and save it, it renames the class in the target folder. But then the building workspace part is done and it didn't find the class ElectronicCustomerOrder. Can someone Tell me what's happening here since it's anoying to build on commandline and then do a refresh in eclipse.
A normal mvn clean install command will work also properly.

eclipse webapp welcome file display error

I m new to eclipse and facing difficulties at the beginning of a new webapp.
index.jsp doesnt display.
web.xml:
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd" id="WebApp_ID" version="3.0">
<display-name>PizzaOrderApp</display-name>
<welcome-file-list>
<welcome-file>index.jsp</welcome-file>
</welcome-file-list>
</web-app>
I already tryed with http://localhost:8080/PizzaOrderApp/index.jsp and http://localhost:8080/PizzaOrderApp/jsp/index.jsp
after remove-readd tomcat server:
Have you tried putting the .jsp file directly in the WebContent folder rather than creating a folder for the JSP pages?
You did not define the Spring dispatcher servlet in web.xml. You can either copy index.jsp outside of WEB-INF directory (into webcontent), or you should have a deep look into the Spring MVC documentation.
I also faced this problem but what i was doing wrong is, I created
Dynamic project in eclipse with Dynamic Web Module version 3.0. It
won't give you Web.xml file.I added Web.xml file from other project
but still Welcome File is not getting.
Then i deleted the project and i created the project with Dynamic Web
Module Version 2.4 and it given me Web.xml file. I again Configure the
Welcome File in the Web.xml file, After that its working fine.Server
which i am using is Tomcat 7 and java 1.7,Eclipse Luna.

Liferay - Eclipse alloy tag library error

I am developing a portlet that runs on Liferay portal (I have currently Liferay+Tomcat7 bundle, it will later run on JBoss). I am using Eclipse Helios with Liferay IDE and Liferay SDK.
In my .jsp files, I use Alloy:
<%# taglib uri="http://liferay.com/tld/aui" prefix="aui" %>
Everything works fine - the portlet gets successfully deployed and is shown correctly.
The only problem is, that Eclipse is marking it as an error:
Description Resource Path Location Type
Can not find the tag library descriptor for "http://liferay.com/tld/aui" edit.jsp /PortletVisual-portlet/docroot line 2 JSP Problem
This is mainly a cosmetic error. Liferay IDE in Eclipse evidently doesnt understand these dependencies, although the project itself works fine. I can live with this "error marker", it doesnt bother me that much. I was just curious if there is a way to fix it.
Thanks for any tips!
EDIT: this is my web.xml file:
<?xml version="1.0" encoding="UTF-8"?>
<web-app id="WebApp_ID" version="2.4" xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">
<display-name>PortletVisual-portlet</display-name>
<jsp-config>
<taglib>
<taglib-uri>http://java.sun.com/portlet_2_0</taglib-uri>
<taglib-location>/WEB-INF/tld/liferay-portlet.tld</taglib-location>
</taglib>
<taglib>
<taglib-uri>http://liferay.com/tld/aui</taglib-uri>
<taglib-location>/WEB-INF/tld/aui.tld
</taglib-location>
</taglib>
</jsp-config>
</web-app>
Try this one:
<taglib>
<taglib-uri>http://liferay.com/tld/aui</taglib-uri>
<taglib-location>/WEB-INF/tld/liferay-aui.tld</taglib-location>
</taglib>
If not working try here
Hope I helped! Good luck!!!!

Web-app version is overridden when launching Tomcat 7 from Eclipse

I'm developping a web application that is using web-fragment.xml files.
AFAIK, the web-framgent.xml files of the JAR in WEB-INF/lib should be merged and resolved to an effective web.xml.
So, I activate the logEffectiveWebXml option of my Tomcat 7 server to see the resulting file.
Hereby the beginning of the effective web.xml file:
Case 1: When the application is deploy on a standalone Tomcat 7:
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd"
version="3.0"
metadata-complete="true">
Case 2: When the application is deploy on a Tomcat 7 in Eclipse IDE:
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd"
version="2.5"
metadata-complete="true">
You notice that the version attribute is replaced with "2.5".
Besides, the effective web.xml is correct when deploying the app on the standalone Tomcat (the content of web-fragments.xml files are merged) whereas these contents are absent when launching Tomcat from Eclipse.
I think this is due to the version override.
Do you know why the version attribute is overriden when launching in Eclipse?
I inspect Eclipse configuration, projects configuration (they all use dynamic web module 3.0) and workspace directory ".metadata.plugins\org.eclipse.wst.server.core" but I don't manage to find something wrong...
NOTE: I also notice that the version is overridden even if I don't deploy my application (= fresh Tomcat install).
Thanks for your help.

How can I deploy a web app with sbt 0.11?

it seems that both the jetty-run and jetty commands are missing from SBT 0.11. Either that or I am doing something very wrong. I am simply running sbt, then trying to run jetty-run. I have defined a web.xml file in src/main/webapp/WEB-INF/web.xml which contains the following information:
<?xml version="1.0" encoding="UTF-8"?>
<web-app version="2.5" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee"> </web-app>
I am simply trying to deploy a blank web-app using the latest SBT. I cannot find any documentation or updated examples for doing so. Any ideas?
Thank you in advance.
Starting from sbt 0.8 (xsbt branch), if I remember correctly, web support goes as a standalone plugin. Here you can find instructions on how to install and use it. In general, this new plugin fully supports the regular workflow of a legacy SBT (e.g., jetty-run, jetty-reload, etc.).