Upgrade WebLogic 10.3.0 to JSF 2 via webapp-provided JAR - jsf-2

I have a Java EE 5 Web Application running on WebLogic 10.3.0.
I want to use JSF 2.x, but WebLogic 10.x only supports JSF 1.2.
So I did the following in order to use JSF 2.x instead.
I deployed a WAR cointaining those JARs:
wls.jsf.di.jar
glassfish.jstl_1.2.0.1.jar
javax.jsf_1.0.0.0_2-0.jar (jsf 2.0)
glassfish.jsf_1.0.0.0_2-0-4.jar
I added the following JARs to build path purely for compilation:
javax.faces-2.1.26.jar
jstl-1.2.jar
Created a Servlet 2.5 compatible web.xml and a weblogic.xml (1.0).
Included this in weblogic.xml:
<library-ref>
<library-name>jsf</library-name>
<specification-version>2.0</specification-version>
<implementation-version>1.0.0.0_2-0-2</implementation-version>
<exact-match>false</exact-match>
</library-ref>
<container-descriptor>
<prefer-web-inf-classes>true</prefer-web-inf-classes>
</container-descriptor>
For EL 2.2-like method arguments support in EL 2.1, I added this JAR:
jboss-el-2.0.0.GA.jar
And placed this in web.xml:
<context-param>
<param-name>com.sun.faces.injectionProvider</param-name>
<param-value>
com.sun.faces.vendor.WebContainerInjectionProvider
</param-value>
</context-param>
After all this changes WebLogic Console is still saying the following:
Initializing Sun's JavaServer Faces implementation (1.2_03-b04-FCS)
for context
As you can see, it is still using JSF 1.2. What else can i do to fully use JSF 2?

Well, after doing some tests i was really using JSF 2! So yes, that is enough to make Weblogic 10.3.0 work with JSF 2. I don't remember if i got rid of the "Initializing JSF 1.2" message tho, i recommend to just ignore it

Related

Grails 5.2 can't deploy to JBoss EAP 7.4

Grails 5.2
create-app helloworld
create-controller hello (add render "Hello"
line)
Add the jboss-deployment-structure.xml file to WEB-INF folder for JBoss logging compatibility.
run-app (works)
war
Deploy to JBoss EAP 7.4 and get following error
ERROR [org.springframework.boot.SpringApplication] (ServerService Thread Pool -- 85) Application run failed: io.micronaut.context.exceptions.NoSuchBeanException: No bean of type [io.micronaut.context.event.ApplicationEventPublisher<io.micronaut.context.event.StartupEvent>] exists. Make sure the bean is not disabled by bean requirements (enable trace logging for 'io.micronaut.context.condition' to check) and if the bean is enabled then ensure the class is declared a bean and annotation processing is enabled (for Java and Kotlin the 'micronaut-inject-java' dependency should be configured as an annotation processor).
at io.micronaut.context.DefaultBeanContext.resolveBeanRegistration(DefaultBeanContext.java:2778)
I did set the logging level to TRACE for is.micronaut.context.condition but nothing is logged at the TRACE level.
The JBoss jboss-deployment-structure.xml file that I added, which I think is standard for JBoss EAP, looks like this. I do not believe this is related, I'm just including it here so that others can reproduce what I did to generate the war file.
<jboss-deployment-structure>
<deployment>
<!-- Exclusions allow you to prevent the server from automatically adding some dependencies -->
<exclusions>
<module name="org.slf4j" />
<module name="org.slf4j.impl" />
</exclusions>
</deployment>
How can I make a grails 5 app deployable to JBoss EAP 7.4?

Migrating old JSP to Facelet (managed bean not instantiated) [duplicate]

I'm creating my first project Java EE 7, but I'm having trouble. Appreciate any help.
Tomcat 7.0.34
JSF 2.2
Primefaces 3.5
javaee-api-7.0.jar
When the application start, the Tomcat log shows the following message:
"validateJarFile (C:\...\build\web\WEB-INF\lib\javaee-api-7.0.jar)-jar not loaded. See Servlet 2.3 Spec, section 9.7.2. Offending class: javax/servlet/Servlet .class"
when I click on the button that calls the managed bean, I get the error:
AdvertĂȘncia: /index.xhtml #18,66 value="#{indexMB.user}": Target Unreachable, identifier 'indexMB' resolved to null
javax.el.PropertyNotFoundException: /index.xhtml #18,66 value="#{indexMB.user}": Target Unreachable, identifier 'indexMB' resolved to null
IndexMB
#Named("indexMB")
#RequestScoped
public class IndexMB {
private String password;
private String user;
public String loginTest(){
return (this.user.equals("admin") ? "adminPage" : "inOutPage");
}
// getters and setters
}
index.xhtml
<html ...>
<f:loadBundle basename="i18n" var="bundle" />
<h:head>
<title>#{bundle['index_title']}</title>
</h:head>
<h:body>
#{bundle['index_appname']}
<br />
<h:form id="frmIndex">
<p:panelGrid columns="2">
<p:outputLabel for="user" value="#{bundle['lblUser']}" />
<p:inputText id="user" value="#{indexMB.user}" />
<p:outputLabel for="password" value="#{bundle['lblPassword']}" />
<p:password id="password" value="#{indexMB.password}" />
</p:panelGrid>
<p:commandButton action="#{indexMB.loginTest}" value="#{bundle['btn_login']}" />
</h:form>
</h:body>
faces-config.xml
<?xml version='1.0' encoding='UTF-8'?>
<faces-config version="2.2"
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-facesconfig_2_2.xsd">
<application>
<locale-config>
<default-locale>pt_BR</default-locale>
<supported-locale>en</supported-locale>
<supported-locale>fr</supported-locale>
</locale-config>
</application>
These topics have not helped me:
Java EE 6 #javax.annotation.ManagedBean vs. #javax.inject.Named vs. #javax.faces.ManagedBean
Target Unreachable identifier resolved to null
Target Unreachable, identifier resolved to null
javax.el.PropertyNotFoundException : Target Unreachable, identifier 'login' resolved to null Spring + JSF
http://www.andrejkoelewijn.com/blog/2010/03/05/jee-cdi-tip-target-unreachable-identifier-resolved-to-null/
Tomcat as being a barebones JSP/Servlet container doesn't support CDI out the box. It is not correct to drop jakartaee-api.jar or javaee-api.jar in /WEB-INF/lib just to get your code to compile. The JEE API JAR contains solely the API classes, not the concrete implementation. Get rid of the whole JAR. It can cause many other portability troubles like as the ones described in this answer: How do I import the javax.servlet / jakarta.servlet API in my Eclipse project? You should actually be installing the concrete implementation along with the specific API.
You have 2 options:
Drop Tomcat and go for a true Jakarta EE container. As you're using Tomcat, just step over to TomEE. It's really simple, download the TomEE web profile zip file, extract it and integrate it in Eclipse exactly the same way as you did for Tomcat. Don't forget to remove the Jakarta EE JAR file from webapp and alter the Targeted Runtime property in project's properties from Tomcat to TomEE so that Jakarta EE dependencies are properly resolved. See also What exactly is Java EE?
No additional JARs or configuration is necessary. You can even remove the manually installed JSF/JSTL/CDI/BV/JPA/EJB/JTA/JSONPJAX-RS/etc/etc libraries from your webapp. TomEE as being a true Jakarta EE container already provides them all out the box. In case you're using Maven, the below coordinate is sufficient.
<dependency>
<groupId>jakarta.platform</groupId>
<artifactId>jakarta.jakartaee-web-api</artifactId>
<version><!-- e.g. 10.0.0 or 9.1.0 --></version>
<scope>provided</scope>
</dependency>
Note the importance of provided and its meaning as in "the target runtime already provides this out the box". See also How to properly configure Jakarta EE libraries in Maven pom.xml for Tomcat? for detailed pom.xml examples of Tomcat and normal JEE containers.
If you want to stick to Tomcat, then you need to manually install a true CDI implementation via the webapp. Below instructions assume Tomcat 10+. Weld is one of the available CDI implementations. In the Weld installation guide you can find instructions how to integrate it in Tomcat. For sake of completeness and future reference, here are the steps:
For Tomcat 10.1.x, drop the weld-servlet-shaded.jar of version 5.x in webapp's /WEB-INF/lib. In case you're using Maven, use this coordinate:
<dependency>
<groupId>org.jboss.weld.servlet</groupId>
<artifactId>weld-servlet-shaded</artifactId>
<version>5.1.0.Final</version>
</dependency>
For Tomcat 10.x, use weld-servlet-shaded.jar of version 4.x instead:
<dependency>
<groupId>org.jboss.weld.servlet</groupId>
<artifactId>weld-servlet-shaded</artifactId>
<version>4.0.3.Final</version>
</dependency>
Optionally, create a /META-INF/context.xml file in webapp with following content:
<Context>
<Resource name="BeanManager"
auth="Container"
type="jakarta.enterprise.inject.spi.BeanManager"
factory="org.jboss.weld.resources.ManagerObjectFactory"/>
</Context>
This step is is only necessary when the CDI-dependent library tries to manually find it in JNDI. This step is not necessary when you're using for example Jakarta Faces / JSF version 2.3 or newer.
Create a /WEB-INF/beans.xml file in webapp to trigger activation of CDI. It can be kept empty.
That's it.
In case you prefer OpenWebBeans above Weld as CDI implementation, or need to install CDI in Tomcat 9.x or older, head to this blog for detailed Maven installation instructions: How to install CDI in Tomcat?
Other possible option is leaving beans.xml in your deployment.

Up gradation issue while migrate the struts version 2.2.1 from struts 2.3.24.1

Server: Weblogic
IDE: Intellej IDEA
Hi, I'm trying to migrate the struts version from 2.2.1 to 2.3.24.1
Added the required jars for Struts version 2.3.24.1 by following the below URL's
http://mvnrepository.com/artifact/org.apache.struts/struts2-core/2.3.24.1
http://mvnrepository.com/artifact/org.apache.struts.xwork/xwork-core/2.3.24.1
but getting the following error:
Could not load user defined filter in web.xml: org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter.
java.lang.NoClassDefFoundError: org/apache/commons/lang3/StringUtils
at com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.register(XmlConfigurationProvider.java:213)
at org.apache.struts2.config.StrutsXmlConfigurationProvider.register(StrutsXmlConfigurationProvider.java:102)
at com.opensymphony.xwork2.config.impl.DefaultConfiguration.reloadContainer(DefaultConfiguration.java:240)
at com.opensymphony.xwork2.config.ConfigurationManager.getConfiguration(ConfigurationManager.java:67)
at org.apache.struts2.dispatcher.Dispatcher.getContainer(Dispatcher.java:967)
Truncated. see log file for complete stacktrace
As error suggests "StringUtils" class not found in the Commons-lang3 jar but i already added the commons-lang3-3.2 jar
but still I'm facing the same error above i mentioned.
Added Jars in the pom.xml
struts2-core 2.3.24.1,commons-fileupload 1.3.1,commons-io 2.4,ognl 3.0.6,javassist 3.11.0.GA,freemarker 2.3.22,xwork-core 2.3.24.1,asm 3.3,asm-commons 3.3,commons-lang3 3.2,servlet-api 2.4,jsp-api 2.0,log4j 1.2.17
Could anyone suggest me how to solve this issue?

Is it possible to run Spring Security from vaading4spring together with Vaadin Spring Boot?

Is it possible to run Spring Security from vaading4spring together with Vaadin Spring Boot?
When I mix both at build.gradle as
// Official VaadinSpring Integration
compile("com.vaadin:vaadin-spring:1.0.0.beta2")
compile("com.vaadin:vaadin-spring-boot:1.0.0.beta2")
compile("com.vaadin:vaadin-spring-boot-starter:1.0.0.beta2")
// Supporting (unofficial) vaadin4spring
compile("org.vaadin.spring:spring-vaadin:0.0.5.RELEASE")
compile("org.vaadin.spring:spring-boot-vaadin:0.0.5.RELEASE")
compile("org.vaadin.spring:spring-vaadin-security:0.0.5.RELEASE")
new annotations (such as #SpringUI) does not work.
when I remove
compile("org.vaadin.spring:spring-vaadin:0.0.5.RELEASE")
compile("org.vaadin.spring:spring-boot-vaadin:0.0.5.RELEASE")
from build.gradle,
I got an exception says
Caused by: org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type [org.vaadin.spring.http.HttpService] found for dependency: expected at least 1 bean which qualifies as autowire candidate for this dependency. Dependency annotations: {#org.springframework.beans.factory.annotation.Autowired(required=true)}
at org.springframework.beans.factory.support.DefaultListableBeanFactory.raiseNoSuchBeanDefinitionException(DefaultListableBeanFactory.java:1301)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1047)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:942)
at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:533)
... 77 more
I appreciate any help.
vaadin4spring 0.0.5 is the last standalone release and you should use it as such (don't mix!). the next version of vaadin4spring will build on the official spring vaadin addon, but this is work in progress (Details about this are here: https://github.com/peholmst/vaadin4spring/issues/164)
For your specific problem see https://github.com/peholmst/vaadin4spring/issues/206
for a spring security example see the vaadin4spring:
https://github.com/peholmst/vaadin4spring/tree/v0.0.5/samples/security-sample

JSF2 upgrade to existing project

Im tring to upgrade existing project JSF2.I faced so many problems with combination of SUN RI and myfaces so i eliminated all SUN RI's from classpath now combination of facelets and myfaces is giving problem. I wanted to know if we eliminate facelets and make use of just apache myfaces what should be the taglib namespace?? im getting this error
27 Dec, 2010 7:08:28 PM org.apache.myfaces.view.facelets.FaceletViewHandler handleRenderException SEVERE: Error Rendering View[/login.xhtml]
java.lang.NullPointerException at org.apache.myfaces.view.facelets.compiler.NamespaceHandler.apply(NamespaceHandler.java:57)
at org.apache.myfaces.view.facelets.compiler.EncodingHandler.apply(EncodingHandler.java:45)
at org.apache.myfaces.view.facelets.impl.DefaultFacelet.include(DefaultFacelet.java:322)
at org.apache.myfaces.view.facelets.impl.DefaultFacelet.include(DefaultFacelet.java:369)
at org.apache.myfaces.view.facelets.impl.DefaultFaceletContext.includeFacelet(DefaultFaceletContext.java:363)
at org.apache.myfaces.view.facelets.tag.UserTagHandler.apply(UserTagHandler.java:116)
at javax.faces.view.facelets.CompositeFaceletHandler.apply(CompositeFaceletHandler.java:51)
at org.apache.myfaces.view.facelets.compiler.NamespaceHandler.apply(NamespaceHandler.java:57) at javax.faces.view.facelets.CompositeFaceletHandler.apply(CompositeFaceletHandler.java:51)
Please help me if anyone worked on JSF2 upgrade..
I'm currently working on a JSF 2 / Facelets project using MyFaces 2.0.2. I have only the myfaces-impl and myfaces-api JARs plus some from Apache Commons in the classpath.
My Facelets namespace declaration is xmlns:ui="http://java.sun.com/jsf/facelets".

Resources