JSF JSTL Functions - jstl

I use JSF Mojarra 2.2.9 in combination with the JSP Standard Tag Library (JSTL) 1.2.1.
The files javax.faces-2.2.9.jar and javax.servlet.jsp.jstl-api-1.2.1.jar I imported in the libs folder in WEB-INF.
But I can't use its functions.
When I load this facelet:
<?xml version="1.0" encoding="UTF-8"?>
<ui:composition xmlns="http://www.w3.org/1999/xhtml"
xmlns:composite="http://xmlns.jcp.org/jsf/composite"
xmlns:ui="http://xmlns.jcp.org/jsf/facelets" xmlns:jsf="http://xmlns.jcp.org/jsf"
xmlns:h="http://java.sun.com/jsf/html" xmlns:p="http://primefaces.org/ui"
xmlns:pt="http://xmlns.jcp.org/jsf/passthrough" xmlns:fn="http://java.sun.com/jsp/jstl/functions"
xmlns:c="http://java.sun.com/jsp/jstl/core">
...
<composite:implementation>
Name: #{fn:replace(cc.clientId, '-', '')}
</composite:implementation>
</ui:composition>
I get this error:
Caused by: javax.el.ELException: Function 'fn:replace' not found
at org.apache.el.lang.ExpressionBuilder.visit(ExpressionBuilder.java:209)
at org.apache.el.parser.SimpleNode.accept(SimpleNode.java:142)
at org.apache.el.lang.ExpressionBuilder.prepare(ExpressionBuilder.java:151)
at org.apache.el.lang.ExpressionBuilder.build(ExpressionBuilder.java:169)
at org.apache.el.lang.ExpressionBuilder.createValueExpression(ExpressionBuilder.java:232)
at org.apache.el.ExpressionFactoryImpl.createValueExpression(ExpressionFactoryImpl.java:67)
at com.sun.faces.facelets.el.ELText.parse(Unknown Source)
at com.sun.faces.facelets.el.ELText.parse(Unknown Source)
at com.sun.faces.facelets.compiler.TextUnit.flushTextBuffer(Unknown Source)
at com.sun.faces.facelets.compiler.TextUnit.addInstruction(Unknown Source)
at com.sun.faces.facelets.compiler.TextUnit.endTag(Unknown Source)
at com.sun.faces.facelets.compiler.CompilationManager.popTag(Unknown Source)
at com.sun.faces.facelets.compiler.SAXCompiler$CompilationHandler.endElement(Unknown Source)
at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.endElement(AbstractSAXParser.java:609)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanEndElement(XMLDocumentFragmentScannerImpl.java:1783)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDriver.next(XMLDocumentFragmentScannerImpl.java:2970)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(XMLDocumentScannerImpl.java:606)
at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.next(XMLNSDocumentScannerImpl.java:118)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:510)
at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:848)
at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:777)
at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:141)
at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:1213)
at com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl$JAXPSAXParser.parse(SAXParserImpl.java:643)
at com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl.parse(SAXParserImpl.java:327)
at javax.xml.parsers.SAXParser.parse(SAXParser.java:195)
at com.sun.faces.facelets.compiler.SAXCompiler.doCompile(Unknown Source)
at com.sun.faces.facelets.compiler.SAXCompiler.doCompile(Unknown Source)
at com.sun.faces.facelets.compiler.Compiler.compile(Unknown Source)
at com.sun.faces.facelets.impl.DefaultFaceletFactory.createFacelet(Unknown Source)
at com.sun.faces.facelets.impl.DefaultFaceletFactory.access$100(Unknown Source)
at com.sun.faces.facelets.impl.DefaultFaceletFactory$1.newInstance(Unknown Source)
at com.sun.faces.facelets.impl.DefaultFaceletFactory$1.newInstance(Unknown Source)
at com.sun.faces.facelets.impl.DefaultFaceletCache$1.newInstance(Unknown Source)
at com.sun.faces.facelets.impl.DefaultFaceletCache$1.newInstance(Unknown Source)
at com.sun.faces.util.ExpiringConcurrentCache$1.call(Unknown Source)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at com.sun.faces.util.ExpiringConcurrentCache.get(Unknown Source)
at com.sun.faces.facelets.impl.DefaultFaceletCache.getFacelet(Unknown Source)
at com.sun.faces.facelets.impl.DefaultFaceletCache.getFacelet(Unknown Source)
at com.sun.faces.facelets.impl.DefaultFaceletFactory.getFacelet(Unknown Source)
... 107 more
My Maven dependencies:
<properties>
<!-- Apache Tomcat -->
<tomcat.version>8.0.22</tomcat.version>
<!-- JSF -->
<!-- JSF Mojarra -->
<jsf.version>2.2.9</jsf.version>
<!-- JSP Standard Tag Library (JSTL) -->
<jstl.version>1.2.1</jstl.version>
<!-- Expression Language API -->
<el.api.version>2.2</el.api.version>
<!-- PrimeFaces -->
<primefaces.version>5.3</primefaces.version>
</properties>
<dependencies>
<dependency>
<groupId>org.apache.tomcat</groupId>
<artifactId>tomcat-servlet-api</artifactId>
<version>${tomcat.version}</version>
</dependency>
<dependency>
<groupId>org.glassfish</groupId>
<artifactId>javax.faces</artifactId>
<version>${jsf.version}</version>
</dependency>
<dependency>
<groupId>javax.servlet.jsp.jstl</groupId>
<artifactId>javax.servlet.jsp.jstl-api</artifactId>
<version>${jstl.version}</version>
</dependency>
<dependency>
<groupId>javax.el</groupId>
<artifactId>el-api</artifactId>
<version>${el.api.version}</version>
</dependency>
<dependency>
<groupId>org.primefaces</groupId>
<artifactId>primefaces</artifactId>
<version>${primefaces.version}</version>
</dependency>
</dependencies>
Any suggestions?

There are two bugs with JSTL functions in JSF 2.2.
One bug, is the one you are having. And that JSF will not fix now or in the future. So that is now a feature.
The second one is the one I am having, for which the following sample application was created:
https://github.com/99sono/jsf-2-2-fn-replace-not-found-bug/blob/master/README.md
In the case of your bug the explanation can be found in:
https://java.net/jira/browse/JAVASERVERFACES-3469
The problem you are having is that according to the comments on the glassfish, jira, you are not allowed to use INLINE fn:replace functions in composite components, which are complex enough as it is.
Please try to work-around your issue by encapsulating the fn:replace function in the "value" attirbute of an .
And I quote Manfred Riem:
While I understand that inline EL is a nice convenience as you already
have found out it is problematic with respect to composite components.
When you are using composite components please replace # {xx} with
and everything will work as you expect.
A little background to the problem the SAXCompiler (the internal
Facelets class that converts the markup does not convert inline EL to

Related

Gatling using JDBC feeder connecting to SQL Server with Windows Authentication throws error "java.lang.NoSuchMethodError"

Learning from this documentation , I tried to use Gatling JDBC feeder to grab data from our SQL Server with Windows Authentication.
I add this dependency in my POM.xml
<!-- https://mvnrepository.com/artifact/dev.code-n-roll.gatling/jdbc-gatling -->
<dependency>
<groupId>dev.code-n-roll.gatling</groupId>
<artifactId>jdbc-gatling_2.12</artifactId>
<version>2.3.0</version>
</dependency>
<!-- https://mvnrepository.com/artifact/io.gatling/gatling-jdbc -->
<dependency>
<groupId>io.gatling</groupId>
<artifactId>gatling-jdbc</artifactId>
<version>3.4.2</version>
</dependency>
<!-- https://mvnrepository.com/artifact/com.microsoft.sqlserver/mssql-jdbc -->
<dependency>
<groupId>com.microsoft.sqlserver</groupId>
<artifactId>mssql-jdbc</artifactId>
<version>7.4.1.jre8</version>
</dependency>
My connection string looks like this
import io.gatling.jdbc.Predef._
val databaseUrl = "jdbc:sqlserver://CentralSQLServer:1433;databaseName=CustomerDB;integratedSecurity=true"
I added integratedSecurity=true because the access method to the SQL server is using Windows Authentication, not using username & password. This works fine when I use vanilla Java with JDBC.
Then I define the JDBC Feeder
val mySQLFeeder = jdbcFeeder(databaseUrl, "", "", "SELECT * FROM [CustomerDB].[dbo].[Users]")
I put empty String in username and password sections , since I don't have it.
Running the Gatling test using mvn gatling:test , I see this error is thrown by Gatling
02:05:29.920 [ERROR] i.g.a.Gatling$ - Run crashed
java.lang.NoSuchMethodError: io.gatling.core.feeder.SourceFeederBuilder$.apply(Lio/gatling/core/feeder/FeederSource;Lio/gatling/core/config/GatlingConfiguration;)Lio/gatling/core/feeder/SourceFeederBuilder;
at io.gatling.jdbc.Predef$.jdbcFeeder(Predef.scala:26)
at testCases.Delete.<init>(Delete.scala:49)
... 16 common frames omitted
Wrapped by: java.lang.reflect.InvocationTargetException: null
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
at io.gatling.app.Runner.run0(Runner.scala:74)
at io.gatling.app.Runner.run(Runner.scala:60)
at io.gatling.app.Gatling$.start(Gatling.scala:80)
at io.gatling.app.Gatling$.fromArgs(Gatling.scala:46)
at io.gatling.app.Gatling$.main(Gatling.scala:38)
at io.gatling.app.Gatling.main(Gatling.scala)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at io.gatling.mojo.MainWithArgsInFile.runMain(MainWithArgsInFile.java:50)
at io.gatling.mojo.MainWithArgsInFile.main(MainWithArgsInFile.java:33)
java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at io.gatling.mojo.MainWithArgsInFile.runMain(MainWithArgsInFile.java:50)
at io.gatling.mojo.MainWithArgsInFile.main(MainWithArgsInFile.java:33)
Caused by: java.lang.reflect.InvocationTargetException
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
at io.gatling.app.Runner.run0(Runner.scala:74)
at io.gatling.app.Runner.run(Runner.scala:60)
at io.gatling.app.Gatling$.start(Gatling.scala:80)
at io.gatling.app.Gatling$.fromArgs(Gatling.scala:46)
at io.gatling.app.Gatling$.main(Gatling.scala:38)
at io.gatling.app.Gatling.main(Gatling.scala)
... 6 more
Caused by: java.lang.NoSuchMethodError: io.gatling.core.feeder.SourceFeederBuilder$.apply(Lio/gatling/core/feeder/FeederSource;Lio/gatling/core/config/GatlingConfiguration;)Lio/gatling/core/feeder/SourceFeederBuilder;
at io.gatling.jdbc.Predef$.jdbcFeeder(Predef.scala:26)
at testCases.Delete.<init>(Delete.scala:49)
... 16 more
It looks like Gatling JDBCFeeder method complains about my connection string using integratedSecurity=true since in the documentation we should use username and password. The thing is there are no username and password in my case.
Is there any way to solve this issue?
Thanks.
Thanks #GeorgeLeung and #StephaneLandelle .
The issue is caused by dependency version conflict.
The gatling-jdbc version must align with the gatling-core version.
Change the dependencies in POM.xml to this below does solve the issue.
<properties>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
<encoding>UTF-8</encoding>
<gatling.version>3.3.1</gatling.version>
<gatling-maven-plugin.version>3.0.5</gatling-maven-plugin.version>
<scala-maven-plugin.version>4.3.1</scala-maven-plugin.version>
<maven-jar-plugin.version>3.2.0</maven-jar-plugin.version>
<scala.version>2.12.10</scala.version>
</properties>
<dependencies>
<dependency>
<groupId>io.gatling.highcharts</groupId>
<artifactId>gatling-charts-highcharts</artifactId>
<version>${gatling.version}</version>
</dependency>
<dependency>
<groupId>io.gatling</groupId>
<artifactId>gatling-app</artifactId>
<version>${gatling.version}</version>
</dependency>
<dependency>
<groupId>io.gatling</groupId>
<artifactId>gatling-recorder</artifactId>
<version>${gatling.version}</version>
</dependency>
<!-- https://mvnrepository.com/artifact/com.microsoft.sqlserver/mssql-jdbc -->
<dependency>
<groupId>com.microsoft.sqlserver</groupId>
<artifactId>mssql-jdbc</artifactId>
<version>7.4.1.jre8</version>
</dependency>
</dependencies>
The gatling-app does include the gatling-jdbc , so we don't need to extra add it.

javax.management.InstanceNotFoundException: org.springframework.boot:type=Admin,name=SpringApplication

I developed a Spring boot application and the functionality of the application is working fine. However, at the time of startup, I see the below exception multiple times.
When I ran the same application a couple of weeks back I did not see any such exception. The code base has not changed after that. I am wondering if it has to do something with the environment.
The reason for my post is I would like to understand more about the cause of the exception and how to fix it. I could not find much help when I googled. This here did not work.
The Spring batch process extracts data from Oracle DB and writes it into a JSON file after some processing. I have posted the pom.xml.
javax.management.InstanceNotFoundException: org.springframework.boot:type=Admin,name=SpringApplication
at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.getMBean(DefaultMBeanServerInterceptor.java:1095) ~[na:1.8.0_161]
at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.getClassLoaderFor(DefaultMBeanServerInterceptor.java:1444) ~[na:1.8.0_161]
at com.sun.jmx.mbeanserver.JmxMBeanServer.getClassLoaderFor(JmxMBeanServer.java:1324) ~[na:1.8.0_161]
at javax.management.remote.rmi.RMIConnectionImpl$6.run(RMIConnectionImpl.java:1365) ~[na:1.8.0_161]
at java.security.AccessController.doPrivileged(Native Method) [na:1.8.0_161]
at javax.management.remote.rmi.RMIConnectionImpl.getClassLoaderFor(RMIConnectionImpl.java:1362) ~[na:1.8.0_161]
at javax.management.remote.rmi.RMIConnectionImpl.invoke(RMIConnectionImpl.java:813) ~[na:1.8.0_161]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.8.0_161]
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:1.8.0_161]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.8.0_161]
at java.lang.reflect.Method.invoke(Method.java:498) ~[na:1.8.0_161]
at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:361) ~[na:1.8.0_161]
at sun.rmi.transport.Transport$1.run(Transport.java:200) [na:1.8.0_161]
at sun.rmi.transport.Transport$1.run(Transport.java:197) [na:1.8.0_161]
at java.security.AccessController.doPrivileged(Native Method) [na:1.8.0_161]
at sun.rmi.transport.Transport.serviceCall(Transport.java:196) [na:1.8.0_161]
at sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:568) [na:1.8.0_161]
at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run0(TCPTransport.java:826) [na:1.8.0_161]
at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.lambda$run$0(TCPTransport.java:683) [na:1.8.0_161]
at java.security.AccessController.doPrivileged(Native Method) [na:1.8.0_161]
at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:682) [na:1.8.0_161]
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) ~[na:1.8.0_161]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) ~[na:1.8.0_161]
at java.lang.Thread.run(Thread.java:748) ~[na:1.8.0_161]
POM.xml
http://maven.apache.org/xsd/maven-4.0.0.xsd">
4.0.0
<groupId>com.mySample</groupId>
<artifactId>db-extraction</artifactId>
<version>1.0.0</version>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>1.5.10.RELEASE</version>
</parent>
<properties>
<java.version>1.8</java.version>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-batch</artifactId>
</dependency>
<dependency>
<groupId>com.oracle</groupId>
<artifactId>ojdbc7</artifactId>
<version>12.1.0.1</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.apache.commons/commons-lang3 -->
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
<version>3.0</version>
</dependency>
<!-- https://mvnrepository.com/artifact/commons-dbutils/commons-dbutils -->
<dependency>
<groupId>commons-dbutils</groupId>
<artifactId>commons-dbutils</artifactId>
<version>1.6</version>
</dependency>
<!-- https://mvnrepository.com/artifact/commons-dbutils/commons-dbutils -->
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-collections4</artifactId>
<version>4.1</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
</dependency>
<dependency>
<groupId>com.h2database</groupId>
<artifactId>h2</artifactId>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-eclipse-plugin</artifactId>
<configuration>
<downloadSources>true</downloadSources>
<downloadJavadocs>true</downloadJavadocs>
</configuration>
</plugin>
</plugins>
</build>
I had the same issue with IDEA IntelliJ. The problem was IntelliJ's default server configurations. You just need to remove the 'Enable launch optimization' and 'Enable JMX agent' checkboxes, then it works!
Steps:
Edit Configurations
choose your project
remove the 'Enable launch optimization' and 'Enable JMX agent' checkboxes
Are you launching this from Eclipse?
If so, I found a way to overcome this issue from my Eclipse oxygen:
Go to the launch configuration either from the STS plugin Spring Boot dashboard or from Run Configurations from the Run menu. Then untick Enable JMX checkbox and run it.
Hope it helps
Seems to answer your question "The reason for my post is I would like to understand more about the cause of the exception and how to fix it. I could not find much help when I googled."
The issue is that JMX/Lifecycle starts immediately, but Spring Boot takes much longer as there are a number of things to be resolved such as application-properties, beans, auto-wiring, etc... So during the time that JMX has started, but Spring Boot has not started, JMX is searching for your SpringApplication (that has not started), so these errors/exceptions get thrown. Once Spring Boot is up, JMX is happy and the errors/exceptions cease.
In my case, I used the solution above to solve the the errors/exceptions from appearing during startup, but I then found that my Boot Dashboard no longer shows the port that my localhost applications were running on....they appear as unknown port. In the Eclipse/STS 3.9.5, I see checkboxes for Enable Life Cycle Management that seems to solve the errors/exceptions from happening during startup, but from this post here it appears you NEED Life Cycle Management and JMX enabled to see your Ports in the Boot Dashboard.
That said, it looks like we simply need to make a choice a.) Have the errors/exception happen during startup and see the ports OR b.) Disable JMX/Lifecycle and keep track of the ports on paper...
hope this helps, adym
Unchecking Enable JMX Agent on Edit Configuration window helped me getting rid of the error on IntelliJ. To save settings finding time posting a screenshot:
This is normal and nothing to be worried about.
You can see this exception when the log level is in TRACE Or DEGUG. There is always some time lag between RMI TCP server start and spring boot tomcat start up . RMI TCP will start first and it will try to find SpringApplication Insatance which is started latter. till that time RMI TCP server will poll to find this SpringApplication instance .Once it finds SpringApplication instance this error is gone and Auto Configuration of spring boot starts .
In IntelliJ IDEA 2021.3.3, you need to do this to get rid of this:
Edit Configurations
Click on Modify options
Tick on Disable JMX agent
Apply
OK
As others have said this is not inherently a bad thing. Assuming you are seeing it because you have set the spring root logging level to DEBUG, you can silence these messages by setting the sun.rmi package logger to ERROR.
I.E. your application.properties should look like
// Set root logger to DEBUG
logging.level.root=DEBUG
// Disable messages from the jmx exporter
logging.level.sun.rmi=ERROR

integrating spring and wso2 identity server remote client

I am trying to integrate spring and wso2 identity server remote client
but I am facing some dependency issues
My POM
<dependency>
<groupId>org.wso2.carbon.identity.user.ws</groupId>
<artifactId>org.wso2.carbon.um.ws.api.stub</artifactId>
<version>5.1.3</version>
</dependency>
<dependency>
<groupId>org.wso2.carbon.identity.user.ws</groupId>
<artifactId>org.wso2.carbon.um.ws.api</artifactId>
<version>5.1.3</version>
</dependency>
<dependency>
<groupId>org.apache.axis2.wso2</groupId>
<artifactId>axis2</artifactId>
<version>1.6.1.wso2v12</version>
</dependency>
While running I am getting below exception:
Caused by: java.util.zip.ZipException: invalid stored block lengths
at java.util.zip.InflaterInputStream.read(Unknown Source)
at org.springframework.boot.loader.jar.ZipInflaterInputStream.read(ZipIn
at sun.nio.cs.StreamDecoder.readBytes(Unknown Source)
at sun.nio.cs.StreamDecoder.implRead(Unknown Source)
at sun.nio.cs.StreamDecoder.read(Unknown Source)
at java.io.InputStreamReader.read(Unknown Source)
at java.io.BufferedReader.fill(Unknown Source)
at java.io.BufferedReader.readLine(Unknown Source)
at java.io.BufferedReader.readLine(Unknown Source)
at java.util.ServiceLoader.parseLine(Unknown Source)
... 52 common frames omitted
And while building thorugh maven I am getting below error:
error reading repository \org\wso2\securev
ault\org.wso2.securevault\1.0.0-wso2v2\org.wso2.securevault-1.0.0-wso2v2

Bean Validation with JBoss Errai

I want to make a GWT app with the Errai framework but I run in some problems with the Data Binding and Validation.
My pom.xml
<dependency>
<groupId>org.jboss.errai</groupId>
<artifactId>errai-validation</artifactId>
<version>${errai.version}</version>
</dependency>
<dependency>
<groupId>javax.validation</groupId>
<artifactId>validation-api</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>javax.validation</groupId>
<artifactId>validation-api</artifactId>
<classifier>sources</classifier>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-validator</artifactId>
<version>4.2.0.Final</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-validator</artifactId>
<version>4.2.0.Final</version>
<scope>provided</scope>
<classifier>sources</classifier>
</dependency>
My app.gwt.xml includes the Errai-Validation and HibernateValidator modules:
<inherits name="org.jboss.errai.validation.Validation" />
<inherits name="org.hibernate.validator.HibernateValidator" />
There are no unresolved dependencies I have already double checked this.
When I try to run the application with mvn gwt:run I'm getting the following error:
java.util.concurrent.ExecutionException: org.jboss.errai.ioc.rebind.ioc.exception.UnsatisfiedDependenciesException: #> org.jboss.errai.ui.nav.client.local.Navigation
- field org.jboss.errai.codegen.meta.MetaField:org.jboss.errai.ui.nav.client.local.Navigation.stateChangeEvent could not be satisfied for type: org.jboss.errai.ioc.client.lifecycle.api.StateChange
Message: can't resolve bean: org.jboss.errai.ioc.client.lifecycle.api.StateChange<java.lang.Object> ( #Default )
at java.util.concurrent.FutureTask.report(FutureTask.java:122)
at java.util.concurrent.FutureTask.get(FutureTask.java:188)
at org.jboss.errai.config.rebind.AsyncGenerators$FutureWrapper.get(AsyncGenerators.java:112)
at org.jboss.errai.config.rebind.AsyncGenerators$FutureWrapper.get(AsyncGenerators.java:86)
at org.jboss.errai.config.rebind.AbstractAsyncGenerator.startAsyncGeneratorsAndWaitFor(AbstractAsyncGenerator.java:100)
at org.jboss.errai.ioc.rebind.ioc.bootstrapper.IOCGenerator.generate(IOCGenerator.java:58)
at com.google.gwt.core.ext.IncrementalGenerator.generateNonIncrementally(IncrementalGenerator.java:40)
at com.google.gwt.dev.javac.StandardGeneratorContext.runGeneratorIncrementally(StandardGeneratorContext.java:657)
at com.google.gwt.dev.cfg.RuleGenerateWith.realize(RuleGenerateWith.java:41)
at com.google.gwt.dev.shell.StandardRebindOracle$Rebinder.rebind(StandardRebindOracle.java:79)
at com.google.gwt.dev.shell.StandardRebindOracle.rebind(StandardRebindOracle.java:276)
at com.google.gwt.dev.shell.ShellModuleSpaceHost.rebind(ShellModuleSpaceHost.java:141)
at com.google.gwt.dev.shell.ModuleSpace.rebind(ModuleSpace.java:595)
at com.google.gwt.dev.shell.ModuleSpace.rebindAndCreate(ModuleSpace.java:465)
at com.google.gwt.dev.shell.GWTBridgeImpl.create(GWTBridgeImpl.java:49)
at com.google.gwt.core.shared.GWT.create(GWT.java:57)
at com.google.gwt.core.client.GWT.create(GWT.java:85)
at org.jboss.errai.ioc.client.Container.bootstrapContainer(Container.java:64)
at org.jboss.errai.ioc.client.Container.onModuleLoad(Container.java:41)
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 com.google.gwt.dev.shell.ModuleSpace.onLoad(ModuleSpace.java:406)
at com.google.gwt.dev.shell.OophmSessionHandler.loadModule(OophmSessionHandler.java:200)
at com.google.gwt.dev.shell.BrowserChannelServer.processConnection(BrowserChannelServer.java:526)
at com.google.gwt.dev.shell.BrowserChannelServer.run(BrowserChannelServer.java:364)
at java.lang.Thread.run(Thread.java:744)
Thats why the Bootstrap is failing and the application is throwing a onModuleLoad Exception and is not starting.
If I remove the 2 validation modules I'm able to start the application without any errors.
Im using the Errai Tutorial with version 3.0.1 FINAL.
Thanks for your help :)
EDIT:
I resolved the error by adding
<inherits name="org.jboss.errai.ui.nav.Navigation" />
to my app.gwt.xml but now I'm running into the next problem with this exception:
java.lang.RuntimeException: Deferred binding failed for 'org.jboss.errai.validation.client.ValidatorFactoryImpl$GwtValidator' (did you forget to inherit a required module?)
at com.google.gwt.dev.shell.GWTBridgeImpl.create(GWTBridgeImpl.java:53)
at com.google.gwt.core.shared.GWT.create(GWT.java:57)
at com.google.gwt.core.client.GWT.create(GWT.java:85)
at org.jboss.errai.validation.client.ValidatorFactoryImpl.createValidator(ValidatorFactoryImpl.java:11)
at com.google.gwt.validation.client.AbstractGwtValidatorFactory.getValidator(AbstractGwtValidatorFactory.java:90)
at org.jboss.errai.validation.client.ValidatorProvider.get(ValidatorProvider.java:37)
at org.jboss.errai.ioc.client.BootstrapperImpl$28.getInstance(BootstrapperImpl.java:432)
at org.jboss.errai.ioc.client.BootstrapperImpl$28.getInstance(BootstrapperImpl.java:1)
at org.jboss.errai.ioc.client.container.IOCDependentBean.getInstance(IOCDependentBean.java:96)
at org.jboss.errai.ioc.client.container.IOCDependentBean.getInstance(IOCDependentBean.java:87)
at org.jboss.errai.ioc.client.container.SyncToAsyncBeanManagerAdapter$1.getInstance(SyncToAsyncBeanManagerAdapter.java:148)
at org.jboss.errai.ui.nav.client.local.spi.GeneratedNavigationGraph$2.produceContent(GeneratedNavigationGraph.java:69)
at org.jboss.errai.ui.nav.client.local.Navigation.maybeShowPage(Navigation.java:304)
at org.jboss.errai.ui.nav.client.local.Navigation.navigate(Navigation.java:249)
at org.jboss.errai.ui.nav.client.local.Navigation.navigate(Navigation.java:230)
at org.jboss.errai.ui.nav.client.local.Navigation.navigate(Navigation.java:225)
at org.jboss.errai.ui.nav.client.local.Navigation.goTo(Navigation.java:191)
at org.jboss.errai.ui.nav.client.local.DefaultNavigationErrorHandler.handleError(DefaultNavigationErrorHandler.java:27)
at org.jboss.errai.ui.nav.client.local.Navigation.goTo(Navigation.java:193)
Is there another module that is missing?
I'm correct that Errai is creating the ValidationFactory and injecting the correct instance? So I don't have to create my own ValidationFactory like here:
GWT Validation Tutorial
Yes, that's correct. You don't have to create your own ValidationFactory. Errai will do that for you. You can simply #Inject a Validator.
I have prepared a version of the Errai tutorial using 3.0.1.Final that shows exactly that (following the instructions from the reference guide). I've put the project on GitHub.
The last error you pasted doesn't contain enough information to investigate why this is failing for you. However, you should see more error information in the devmode console.

java.lang.NoSuchMethodException: org.apache.catalina.deploy.WebXml addServlet

I am migrating my web application from Jboss 4.2 to tomcat 7 . After using the tomcat 7 i am facing the following exception.
java.lang.NoSuchMethodException: org.apache.catalina.deploy.WebXml addServlet
at org.apache.tomcat.util.IntrospectionUtils.callMethod1(IntrospectionUtils.java:855)
at org.apache.tomcat.util.digester.SetNextRule.end(SetNextRule.java:201)
at org.apache.tomcat.util.digester.Digester.endElement(Digester.java:1051)
at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.endElement(Unknown Source)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanEndElement(Unknown Source)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDriver.next(Unknown Source)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(Unknown Source)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown Source)
at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(Unknown Source)
at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(Unknown Source)
at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(Unknown Source)
at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(Unknown Source)
at com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl$JAXPSAXParser.parse(Unknown Source)
at org.apache.tomcat.util.digester.Digester.parse(Digester.java:1537)
at org.apache.catalina.startup.ContextConfig.parseWebXml(ContextConfig.java:1883)
at org.apache.catalina.startup.ContextConfig.getDefaultWebXmlFragment(ContextConfig.java:1469)
at org.apache.catalina.startup.ContextConfig.webConfig(ContextConfig.java:1246)
at org.apache.catalina.startup.ContextConfig.configureStart(ContextConfig.java:878)
at org.apache.catalina.startup.ContextConfig.lifecycleEvent(ContextConfig.java:376)
at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:119)
at org.apache.catalina.util.LifecycleBase.fireLifecycleEvent(LifecycleBase.java:90)
at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5269)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1559)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1549)
at java.util.concurrent.FutureTask$Sync.innerRun(Unknown Source)
at java.util.concurrent.FutureTask.run(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
I have tried to remove the catalina.jar (according to the solution given for the same exception)from the lib to solve the issue but it didn't worked.I am not getting any way to solve this issue can anyone please help on this issue.
In your pom.xml
if you have included dependencies like tomcat-catalina,
put the scope as provided
<dependency>
<groupId>org.apache.tomcat</groupId>
<artifactId>tomcat-catalina</artifactId>
<version>7.0.47</version>
<scope>provided</scope>
</dependency>
The container ( here tomcat ) itself provides some dependencies ( like tomcat-catalina jar ) when you deploy your app. So you don't need to include them in your application. But the jars are needed for compilation. This is achieved by setting the scope as 'provided'
I believe, this error is about the deployment assembly. You do not need the catalina.jar in the deployment assembly.
For the ones like me facing this issue with Spring Boot, adding this dependency solved it :
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-tomcat</artifactId>
<scope>provided</scope>
</dependency>
For me, this error was being produced because my derived implementation of ServletContextListener had a CONCTRUCTOR PARAMETER. Apparently Spring/Java/Whatever can't load it up if you have ctor params, even though the params have values in the Application Context.
Hope this helps others.
I had this problem today, and it was because my executable spring boot jar had /BOOT-INF/lib/tomcat-embed-core-9.0.62.jar and my deployed WAR also had ../ROOT/WEB-INF/lib/tomcat-embed-core-9.0.62.jar. The jars were identical, but the tomcat webapp classloader creates a ProtectionDomain for the jars provided from BOOT-INF, and my deployed WAR was attempting to load the class from ROOT/WEB-INF/lib.
The fix is to make sure my deployed WAR uses jars from BOOT-INF ... I just have to figure out how to make that happen.
add <scope>provided</scope> into pom.xml :
<dependency>
<groupId>org.apache.tomcat</groupId>
<artifactId>tomcat-catalina</artifactId>
<version>7.0.27</version>
<scope>provided</scope>
</dependency>
There is another solution when you do need the catalina.jar, add
<Loader delegate="true"/>
to
<Context />
element in %TOMCAT_HOME%/conf/context.xml

Resources