Issue in Struts migration from 2.1.8 to 2.3.32 - struts2

Caught exception while registering interceptor class
org.apache.struts2.interceptor.validation.AnnotationValidationInterceptor-interceptor
Facing this error while migrate Struts from 2.1.8 to 2.3.32

AnnotationValidationInterceptor is already registered in struts-default.xml.
To use this interceptor your package should extend struts-default. See how to package configuration.
<struts>
<package name="employee" extends="struts-default"...

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?

TeamFoundation 11 Client Libraries in Nuget?

I have inherited a code base that has .dll's in the source code repository.
:::::::Gasssssssssssssssssspppppppp::::::::::
\ThirdPartyReferences\FromProgramFiles.11.0\Microsoft.TeamFoundation.Client.dll" "11.0.60315.1 built by: Q11REL"
\ThirdPartyReferences\FromProgramFiles.11.0\Microsoft.TeamFoundation.Common.dll" "11.0.60315.1"
\ThirdPartyReferences\FromProgramFiles.11.0\Microsoft.TeamFoundation.dll" "11.0.50727.1"
\ThirdPartyReferences\FromProgramFiles.11.0\Microsoft.TeamFoundation.WorkItemTracking.Client.dll" "11.0.61030.0"
\ThirdPartyReferences\FromProgramFiles.11.0\Microsoft.TeamFoundation.Build.Client.dll" "11.0.60315.1"
\ThirdPartyReferences\FromProgramFiles.11.0\Microsoft.TeamFoundation.VersionControl.Common.dll" "11.0.61219.0 built by: Q11REL"
\ThirdPartyReferences\Microsoft.TeamFoundation.Build.Workflow.dll" "11.0.61030.0"
\ThirdPartyReferences\Microsoft.TeamFoundation.TestManagement.Client.dll" "11.0.61030.0"
\ThirdPartyReferences\Microsoft.TeamFoundation.TestImpact.BuildIntegration.dll" "11.0.61030.0"
\ThirdPartyReferences\FromGAC\Microsoft.TeamFoundation.TestImpact.Client.dll" "11.0.61219.0"
I cannot find a Nuget package that houses these.
This package
<package id="Microsoft.TeamFoundation.11" version="11.0.50727.1" targetFramework="net45" />
has these files
\packages\Microsoft.TeamFoundation.11.11.0.50727.1\Microsoft.TeamFoundation.11.0.0.0\lib\Microsoft.TeamFoundation.Client.dll" "11.0.50727.1 built by: RTMREL"
\packages\Microsoft.TeamFoundation.11.11.0.50727.1\Microsoft.TeamFoundation.11.0.0.0\lib\Microsoft.TeamFoundation.Common.dll" "11.0.50727.1"
\packages\Microsoft.TeamFoundation.11.11.0.50727.1\Microsoft.TeamFoundation.11.0.0.0\lib\Microsoft.TeamFoundation.dll" "11.0.50727.1"
\packages\Microsoft.TeamFoundation.11.11.0.50727.1\Microsoft.TeamFoundation.11.0.0.0\lib\Microsoft.TeamFoundation.WorkItemTracking.Client.dll" "11.0.50727.1"
Any idea where to find the others?
You can find the package at nuget.org.
TeamFoundation.11 is located here

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?

Upgrade WebLogic 10.3.0 to JSF 2 via webapp-provided JAR

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

Resources