Generate Deployment Descriptor Stub menu missing in Eclipse webapp project - java

The menu in the title is missing.
I created a Maven webapp project as instructed in my book, and my book is now saying generate a web.xml by right-clicking on the project , Java EE Tools -> Generate Deployment Descriptor Stub , but that submenu is missing.
I have checked project facets and Dynamic Web Module is checked, with version no. 2.3.
Do I need to convert this Maven webapp project to a Dynamic Web project? It seems a Maven webapp project is somehow not a Java EE project. Is that correct?
Thanks in advance.
Edit: I have checked a lot of similar questions but have not been able to find an answer to this apparently trivial problem.
Edit: FWIW there is some information about conflicts in the Project Facets window:

Solved. The things I did to solve this were:
1, edit [projectname]\.settings\org.eclipse.wst.common.project.facet.core.xml. I changed the "jst.web" version to 4.0:
<?xml version="1.0" encoding="UTF-8"?>
<faceted-project>
<runtime name="Apache Tomcat v9.0"/>
<fixed facet="wst.jsdt.web"/>
<installed facet="jst.web" version="4.0"/>
<installed facet="wst.jsdt.web" version="1.0"/>
<installed facet="java" version="1.8"/>
<installed facet="jst.jsf" version="2.2"/>
</faceted-project>
2, tried the usual, F5, Project Clean.., Maven->Update Project, etc to no avail.
3, restarted eclipse, to no avail
4, noticed there was now a WEB-INF/web.xml but it needed editing to bring it into line with the dynamic web module version (4), so I changed it to this:
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns="http://xmlns.jcp.org/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee
http://xmlns.jcp.org/xml/ns/javaee/web-app_4_0.xsd"
version="4.0">
<display-name>Archetype Created Web Application</display-name>
</web-app>
5, F5, Project Clean.., Maven->Update Project, "mvn clean install" and it seems eclipse is happy.

Related

WebLogic 10.3.6 Upgrade to 12c, Migration from JSF 1.1 to 1.2 results in errors specifically when trying to find the JSF 1.2 library

As the title states we recently upgraded from WebLogic 10.3.6 to 12c. Our application was using JSF 1.1 but with 12c you have to use 1.2 or 2.0. The issue I'm running into is when updating the application to 1.2, deploying 1.2 in WebLogic, and then also updating the weblogic.xml the errors do not go away and a 500 error is returned on the front end.
Updating the application and weblogic.xml:
First removed jsf-api.jar and jsf-impl.jar from WEB-INF/lib.
weblogic.xml:
<?xml version="1.0" encoding="UTF-8"?>
<wls:weblogic-web-app xmlns:wls="http://xmlns.oracle.com/weblogic/weblogic-web-app" 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/ejb-jar_3_0.xsd http://xmlns.oracle.com/weblogic/weblogic-web-app http://xmlns.oracle.com/weblogic/weblogic-web-app/1.4/weblogic-web-app.xsd">
<wls:container-descriptor>
<wls:show-archived-real-path-enabled>true</wls:show-archived-real-path-enabled>
</wls:container-descriptor>
<wls:library-ref>
<wls:library-name>jsf</wls:library-name>
<wls:specification-version>1.2</wls:specification-version>
<wls:implementation-version>1.2.9.0</wls:implementation-version>
<wls:exact-match>false</wls:exact-match>
</wls:library-ref>
</wls:weblogic-web-app>
JSF Deployed to server
Errors received:
Unresolved Webapp Library references for "WebAppModule(ExampleDeployment)", defined in weblogic.xml [Extension-Name: jsf, Specification-Version: 1.2, Implementation-Version: 1.2.9.0, exact-match: false]
The TagExtraInfo class : "com.sun.faces.taglib.FacesTagExtraInfo" specified by this tag could not be instantiated.
This may or may not be a unique scenario but the weblogic.xml is only located in one of my ear files and is not used in the others. The first error came from the ear with the weblogic.xml in it and the second came from one without. I'm assuming this was due to the jsf jars being used in the WEB-INF/lib prior to me taking over.
Thank you for any responses!
Edit 2/3:
Commented out com.sun.faces.taglib.FacesTagExtraInfo in html_basic.tld and jsf_core.tld. This removed the com.sun.faces.taglib.FacesTagExtraInfo error I was receiving. Now I'm getting:
java.lang.ClassCastException: Unable to convert "display: inline;" to type "javax.el.ValueExpression" for attribute "style"
Edit 2/4:
Found that even though my libraries are deployed my J2EE applications are not popping up in the "Applications that reference this library" section under any of the libraries.
This issue ended up being fixed by adding a weblogic.xml to each of the projects that did not have them and add in filtering into them to use project local libraries instead of what is provided by the server. This is not best practice probably but is also what was advised by Oracle. The project that did already have the weblogic.xml was just updated to include the filtering.
<?xml version="1.0" encoding="UTF-8"?>
<wls:weblogic-web-app xmlns:wls="http://xmlns.oracle.com/weblogic/weblogic-web-app" 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_2_5.xsd http://xmlns.oracle.com/weblogic/weblogic-web-app http://xmlns.oracle.com/weblogic/weblogic-web-app/1.4/weblogic-web-app.xsd">
<wls:container-descriptor>
<wls:prefer-application-packages>
<wls:package-name>javax.faces.*</wls:package-name>
<wls:package-name>com.sun.faces.*</wls:package-name>
<wls:package-name>com.bea.faces.*</wls:package-name>
</wls:prefer-application-packages>
<wls:prefer-application-resources>
<wls:resource-name>javax.faces.*</wls:resource-name>
<wls:resource-name>com.sun.faces.*</wls:resource-name>
<wls:resource-name>com.bea.faces.*</wls:resource-name>
<wls:resource-name>META-INF/services/javax.servlet.ServletContainerInitializer</wls:resource-name>
<wls:resource-name>META-INF/services/com.sun.faces.*</wls:resource-name>
</wls:prefer-application-resources>
</wls:container-descriptor>
</wls:weblogic-web-app
>

Eclipse can't find JSF 2.2 taglibs

I am using JSF 2.2 taglibs but Eclipse is displaying the following warning message:
Can't find facelet tag library for uri http://xmlns.jcp.org/jsf
What bugs me is that I've faced this issue before and it was related to classpath JARs, but now it is only affecting JSF 2.2 tag libs.
Taglib xmlns:h="http://xmlns.jcp.org/jsf/html" is working fine, the warning is shown to JSF 2.2 specifics like "/jsf" and "/jsf/passthrough". Here is an image showing warnings for JSF 2.2. tag libs, but prior namespaces are loaded correctly.
I have tried to solve the issue with help of posts like this but none of the procedures (clean, restart, close/open, validate, etc) have worked for me.
Dependencies for JSF (derived from WildFly 10.1 pom.xml):
<dependency>
<groupId>com.sun.faces</groupId>
<artifactId>jsf-api</artifactId>
<version>2.2.13</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.sun.faces</groupId>
<artifactId>jsf-impl</artifactId>
<version>2.2.13.SP1</version>
<scope>provided</scope>
</dependency>
Eclipse info:
Version: Neon.1a Release (4.6.1)
Build id: 20161007-1200
Update
After looking into the taglib files I found no "passthrough" or "friendly markup" reference. So there is no surprise Eclipse won't find it...
There is no file under com.sun.faces.metadata.taglib for Friendly Markup and Passthrough, for both Glassfish and JBoss implementations.
The question now is where should these files be?
Update: opened issue WFLY-9579
It seems that the taglib files are missing from the implementation JARs, for both Glassfish and JBoss projects. I hope to be wrong but I found no other explanation.
I've posted a thread so this behavior can be investigated.
https://developer.jboss.org/thread/274046
Workaround
To stop the IDE from warning simply create empty taglibs files and associate to the web.xml. Files should go under /WEB-INF/ and have the appropriate extension taglib.xml.
The JSF implementation will behave normally and should process the facelets correctly.
friendly_markup.taglib.xml
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<facelet-taglib xmlns="http://xmlns.jcp.org/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-facelettaglibrary_2_2.xsd"
version="2.2">
<namespace>http://xmlns.jcp.org/jsf</namespace>
</facelet-taglib>
passthrough.taglib.xml
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<facelet-taglib xmlns="http://xmlns.jcp.org/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-facelettaglibrary_2_2.xsd"
version="2.2">
<namespace>http://xmlns.jcp.org/jsf/passthrough</namespace>
</facelet-taglib>
web.xml
<context-param>
<param-name>javax.faces.FACELETS_LIBRARIES</param-name>
<param-value>/WEB-INF/passthrough.taglib.xml;/WEB-INF/friendly_markup.taglib.xml</param-value>
</context-param>
Here is what it looks like. Now the warnings are gone (and my OCD is calm again). I would like to try and make JAR dependency for it, if I find some spare time.

Eclipse error. valve The content of element type "jboss-web" must match ... jboss-web.xml

I use eclipse mars.2
I'm trying to import existing ecplipse project and i'm getting an error:
The content of element type "jboss-web" must match "(class-loading?,security-domain?,context-root?,virtual-host*,use-session-cookies?,replication-config?,resource-env-ref*,resource-ref*,security-role*,ejb-ref*,ejb-local-ref*,message-destination-ref*,message-destination*,webservice-description*,service-ref*,depends*,servlet*,authenticators*)".
jboss-web.xml file
<!DOCTYPE jboss-web PUBLIC
"-//JBoss//DTD Web Application 2.4//EN"
"http://www.jboss.org/j2ee/dtd/jboss-web_4_0.dtd">
<jboss-web>
<security-domain>java:/jaas/SPNEGO</security-domain>
<valve>
<class-name>org.jboss.security.negotiation.NegotiationAuthenticator</class-name>
</valve>
</jboss-web>
I don't understand why jboss-web_4_0.dtd doesn't contain vavlve.
When i delete valve - the error disapears. But i need it.
Please help me.
Alan,
you should use different xml declaration for jboss-web.xml as this element was introduced first in JBoss AS 7. Your file uses dtd file for JBoss AS 4.0.x. ;)
<?xml version="1.0" encoding="UTF-8"?>
<jboss-web xmlns="http://www.jboss.com/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.jboss.org/schema/jbossas
http://www.jboss.org/schema/jbossas/jboss-web_7_0.xsd">
...
</jboss-web>

Maven Websphere JNDI Resource Binding

I have a small issue in which my maven project does not have a Target Resource JNDI Name.
A brief overview of this project. I have three java projects:
The Maven Ear, the back end (base livraries) project and the UI project. All of which are maven, have dependencies I need, compile and run with a main app which emulates the WAS.
So far the most relevant help I could find was to make sure I have a ibm-web-bnd.xml
I do have this file as I converted an existing UI project to a maven project. The project looks like this.
In my web.xml I also have
<resource-ref>
<description>
</description>
<res-ref-name>jdbc/DataSource</res-ref-name>
<res-type>javax.sql.DataSource</res-type>
<res-auth>Container</res-auth>
<res-sharing-scope>Shareable</res-sharing-scope>
</resource-ref>
In my ibm-web-bnd.xml
<?xml version="1.0" encoding="UTF-8"?>
<web-bnd
xmlns="http://websphere.ibm.com/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://websphere.ibm.com/xml/ns/javaee http://websphere.ibm.com/xml/ns/javaee/ibm-web-bnd_1_0.xsd"
version="1.0">
<virtual-host name="default_host" />
<resource-ref name="jdbc/DataSource" binding-name="jdbc/DataSource"/>
As it has been pointed out, I did not ask a question.
My question is how do I set a JNDI Resource Reference for my Maven UI project in WebSphere. I have all the required files and bindings for the project yet I can not run the maven EAR with the UI project in it.
I always get the error:
A resource reference binding could not be found for the jdbc/DataSource resource reference, defined for the codecoverageUI component.

How to disable WELD on WildFly

How to fully disable WELD on WildFly. I don't need it, because I use another DI framework.
Exception 0 :
javax.enterprise.inject.UnsatisfiedResolutionException: Unable to resolve a bean for 'org.springframework.data.mongodb.core.MongoOperations' with qualifiers [#javax.enterprise.inject.Any(), #javax.enterprise.inject.Default()].
at org.springframework.data.mongodb.repository.cdi.MongoRepositoryExtension.createRepositoryBean(MongoRepositoryExtension.java:104)
at org.springframework.data.mongodb.repository.cdi.MongoRepositoryExtension.afterBeanDiscovery(MongoRepositoryExtension.java:79)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at org.jboss.weld.injection.MethodInjectionPoint.invokeOnInstanceWithSpecialValue(MethodInjectionPoint.java:93)
at org.jboss.weld.event.ObserverMethodImpl.sendEvent(ObserverMethodImpl.java:266)
at org.jboss.weld.event.ExtensionObserverMethodImpl.sendEvent(ExtensionObserverMethodImpl.java:125)
at org.jboss.weld.event.ObserverMethodImpl.sendEvent(ObserverMethodImpl.java:253)
at org.jboss.weld.event.ObserverMethodImpl.notify(ObserverMethodImpl.java:232)
at org.jboss.weld.event.ObserverNotifier.notifyObserver(ObserverNotifier.java:169)
I tried
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:weld="http://jboss.org/schema/weld/beans"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/beans_1_0.xsd
http://jboss.org/schema/weld/beans http://jboss.org/schema/weld/beans_1_1.xsd
http://jboss.org/schema/weld/beans ">
<weld:scan>
<weld:exclude name="com.google.**"/>
<weld:exclude name="org.springframework.data.mongodb.**"/>
</weld:scan>
But it did not resolve my problem.
There's the standard way:
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://xmlns.jcp.org/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee
http://xmlns.jcp.org/xml/ns/javaee/beans_1_1.xsd"
version="1.1" bean-discovery-mode="none">
</beans>
Option 1: jboss-all.xml in the war
This is Weld-specific, but it disables Weld's automatic bean scanning for an entire deployment (eg a war file and all the jars inside it). This is handy when you can't easily add beans.xml to a third-party jar, such as jboss-seam-resteasy.jar.
Save as WEB-INF/jboss-all.xml for wars, META-INF/jboss-all.xml otherwise:
<jboss xmlns="urn:jboss:1.0">
<weld xmlns="urn:jboss:weld:1.0" require-bean-descriptor="true"/>
</jboss>
See Per-deployment configuration.
Option 2: standalone.xml in WildFly
Another option, which doesn't require changing the application itself, is to configure the weld subsystem not to treat random jars as CDI libraries. Just edit the configuration for weld in WildFly's standalone.xml to look like this:
<subsystem xmlns="urn:jboss:domain:weld:2.0" require-bean-descriptor="true"/>
Try deleting or commenting out the org.jboss.as.weld extension in the extensions list on the beginning of $JBOSS_HOME/standalone/configuration/standalone.xml. You may also want to delete <subsystem xmlns="urn:jboss:domain:weld:1.0"/> from <profile>. This should cause disabling Weld for all applications deployed on the server.

Categories