Keycloak Java Admin api works nice, however, including RestEasy dependencies in our pom.xml causing issues like this:
RESTEASY002307: Failed to execute
javax.ws.rs.NotFoundException: RESTEASY003210: Could not find resource for full path: http://localhost:8080/
I wonder is there any configuration for RestEasy to work with "minimal" settings which are required by Keycloak Java Admin api? Nothing more than that.
What we have tried so far without success:
Disabling rest easy scanning in web.xml
Map RestEasy to dummy url like /restdummy
Our pom.xml:
<dependency>
<groupId>org.keycloak</groupId>
<artifactId>keycloak-admin-client</artifactId>
<version>4.6.0.Final</version>
</dependency>
<dependency>
<groupId>org.jboss.resteasy</groupId>
<artifactId>resteasy-client</artifactId>
<version>3.6.2.Final</version>
</dependency>
<dependency>
<groupId>org.jboss.resteasy</groupId>
<artifactId>resteasy-jackson2-provider</artifactId>
<version>3.6.2.Final</version>
</dependency>
Any advice is welcome.
You can find the dependencies from mvnrepository for keycloak-admin-client
It seems that downgrading to earlier versions like 3.1.0. solved mentioned issue. However, it would be nice not to depend on whole framework just to use client functionalities.
My webapp includes REST web services and is running on GlassFish 3.1.2.
I would like to run this app on Tomcat 7 instead of GlassFish. What dependencies should I add and remove to enable REST services on Tomcat?
(At the moment I just changed "GlassFish" to "Tomcat" in the "Run" menu of Netbeans, but my http requests give a 404.)
Note: this is a Maven project on Netbeans.
Ok here is the list of dependencies you may need. Please note I just put latest version but you may want to use a different version. Please also check for compatibility of these versions with each other.
<dependency>
<groupId>org.glassfish.jersey.containers</groupId>
<artifactId>jersey-container-servlet-core</artifactId>
<version>2.8</version>
</dependency>
<dependency>
<groupId>javax.ws.rs</groupId>
<artifactId>javax.ws.rs-api</artifactId>
<version>2.0</version>
</dependency>
Needed if you are using jackson to parse json
<dependency>
<groupId>com.fasterxml.jackson.jaxrs</groupId>
<artifactId>jackson-jaxrs-json-provider</artifactId>
<version>2.3.3</version>
</dependency>
This is what I am using on my tomcat but little bit older versions
Now about your 404
First check if the dependencies fix your problem. 404 may be an issue from some thing not configured right in your web.xml as well.
I hope it helps you solve your problem :)
I try to get familiar with the new jsf 2.2 features like page flows. So I did my Project within Tomcat 7 and the help of Spring.
Everything works fine until I added the first flow configuration and try to access the flow.
I am pretty sure I have a missing dependency but what kind of.
I got the following Stacktrace within the call:
Sep 05, 2013 6:03:34 PM com.sun.faces.context.ExceptionHandlerImpl
log 1100: javax/enterprise/context/spi/Context
java.lang.NoClassDefFoundError: javax/enterprise/context/spi/Context
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:792)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
at org.apache.catalina.loader.WebappClassLoader.findClassInternal(WebappClassLoader.java:2627)
at org.apache.catalina.loader.WebappClassLoader.findClass(WebappClassLoader.java:989)
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1432)
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1310)
at com.sun.faces.flow.FlowHandlerImpl.pushFlow(FlowHandlerImpl.java:374)
at com.sun.faces.flow.FlowHandlerImpl.transition(FlowHandlerImpl.java:278)
at com.sun.faces.flow.FlowHandlerImpl.clientWindowTransition(FlowHandlerImpl.java:321)
at com.sun.faces.lifecycle.RestoreViewPhase.execute(RestoreViewPhase.java:270)
at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:101)
at com.sun.faces.lifecycle.RestoreViewPhase.doPhase(RestoreViewPhase.java:121)
at com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:198)
at javax.faces.webapp.FacesServlet.service(FacesServlet.java:646)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:303)
I have the following dependencies described in my pom file
<properties>
<org.springframework.version>3.2.3.RELEASE</org.springframework.version>
</properties>
<dependencies>
<!-- Spring framework -->
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-core</artifactId>
<version>${org.springframework.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-web</artifactId>
<version>${org.springframework.version}</version>
</dependency>
<!-- Spring MVC framework -->
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-webmvc</artifactId>
<version>${org.springframework.version}</version>
</dependency>
<!-- JSR-330 -->
<dependency>
<groupId>javax.inject</groupId>
<artifactId>javax.inject</artifactId>
<version>1</version>
</dependency>
<!-- JSF -->
<dependency>
<groupId>com.sun.faces</groupId>
<artifactId>jsf-api</artifactId>
<version>2.2.2</version>
</dependency>
<dependency>
<groupId>com.sun.faces</groupId>
<artifactId>jsf-impl</artifactId>
<version>2.2.2</version>
</dependency>
<!-- servlet -->
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>jstl</artifactId>
<version>1.2</version>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>javax.servlet-api</artifactId>
<version>3.0.1</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>javax.servlet.jsp</groupId>
<artifactId>jsp-api</artifactId>
<version>2.1</version>
<scope>provided</scope>
</dependency>
</dependencies>
maybe someone knows how to deal with tomcat spring and jsf 2.2.
A maybe this could be helpful as well:
I did not add anything to tomcat lib folder,I just add all jsf jars to the web archive, but that should make no difference, because the class is missing at all.
JSF is slowly moving to CDI as to bean management. The new JSF 2.2 #FlowScoped annotation is CDI based. CDI is part of Java EE Web Profile. This is out the box provided by true Java EE containers such as TomEE, GlassFish, JBoss AS/EAP, WebSphere, WebLogic, Resin, etc, but not by barebones JSP/Servlet containers such as Tomcat and Jetty.
Spring is essentially a full competitor of Java EE (CDI/EJB/JPA/JSF). You seem to have chosen for Tomcat+Spring instead of a real Java EE container. If you want to stick to Spring for some unclear reason, then you should be using Spring Web Flow instead of JSF Flow scope.
But if you're open to replacing Tomcat+Spring, then you can also just replace it altogether by one of the aforementioned Java EE containers. They will provide CDI/EJB/JPA (and JSF) out the box. You can if necessary easily upgrade their bundled JSF implementation to the desired Mojarra 2.2.2 version. The exact instructions depends on the container used.
An alternative would be to install CDI in Tomcat. Weld (the CDI reference implementation) has a guide on exactly that subject: Application servers and environments supported by Weld.
Newer versions of JSF expect a, more or less, full Web Profile to be available and tomcat isn't providing that. To be exact it is missing the CDI api, next to that you probably need a CDI implementation active (like Weld or the likes).
Some information in this forum post on the JBoss website.
I'm currently working through the tutorial found on the Apache Struts website.
Currently, whenever I press submit on the form, or when I click the Bruce Philips hyperlink, I get a NoSuchMethodError.
javax.servlet.ServletException: Filter execution threw an exception
root cause
java.lang.NoSuchMethodError: ognl.SimpleNode.isEvalChain(Lognl/OgnlContext;)Z
com.opensymphony.xwork2.ognl.OgnlUtil.isEvalExpression(OgnlUtil.java:224)
com.opensymphony.xwork2.ognl.OgnlUtil.setValue(OgnlUtil.java:215)
com.opensymphony.xwork2.ognl.OgnlValueStack.trySetValue(OgnlValueStack.java:187)
com.opensymphony.xwork2.ognl.OgnlValueStack.setValue(OgnlValueStack.java:174)
com.opensymphony.xwork2.ognl.OgnlValueStack.setParameter(OgnlValueStack.java:152)
....
I'm not too sure what the issue is either and I believe I've included everything the tutorial states. I've tried including the dependency in my pom.xml, but that makes no difference either.
<?xml version="1.0" encoding="UTF-8"?>
<project>
<modelVersion>4.0.0</modelVersion>
<groupId>Struts2PracticeSite</groupId>
<artifactId>Struts2PracticeSite</artifactId>
<packaging>war</packaging>
<version>0.0.1</version>
<build>
<finalName>Struts2PracticeSite</finalName>
</build>
<dependencies>
<dependency>
<groupId>org.apache.struts</groupId>
<artifactId>struts2-core</artifactId>
<version>2.3.8</version>
</dependency>
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<version>1.2.14</version>
</dependency>
</dependencies>
</project>
Any ideas on how I would fix this problem?
struts2.3.1.1 allows ognl3.0.2.jar + ognl3.0.2-source.jar + ognl3.0.1
at the same time
. struts2.3.1.2 can only have ognl3.0.4, but remove other versions
ognl3.0.4 is a must and can be the only ognl jar!
Remove ognl as a dependency as this is already a transient dependency of struts 2.3.8 itself and make sure if Eclipse properly deployed your applications, there are many problems with that.
Problem found... Turns out my server version is too old to handle struts 2. I was previously using Geronimo version 2.0.2, and it now runs fine on GlassFish 3.1.2.
Use these Jar Combinations for Struts 2 application
I believe the dependencies you need
<dependency>
<groupId>org.apache.struts</groupId>
<artifactId>struts2-core</artifactId>
<version>${struts2.version}</version>
</dependency>
<dependency>
<groupId>org.apache.struts</groupId>
<artifactId>struts2-tiles-plugin</artifactId>
<version>${struts2.version}</version>
</dependency>
there are also other dependencies but these are necessary for Struts2 Tiles application.
I wrote a web application with Eclipse Tomcat and it works on my local Tomcat 7, when I tried to publish it online on a Tomcat 7, I had the following error:
SEVERE: Servlet.service() for servlet [obliquid.servlet.Index] in context with path [/cp] threw exception [The absolute uri: http://java.sun.com/jsp/jstl/core cannot be resolved in either web.xml or the jar files deployed with this application]
Tomcat 7 has "Spec versions: Servlet 3.0, JSP 2.2, EL 2.2", so JSTL is not included?
When I tried to upload standard.jar and jstl.jar I had the following error:
org.apache.jasper.JasperException: /jsp/index.jsp (line: 3, column: 62) Unable to read TLD "META-INF/c.tld" from JAR file "jndi:/localhost/cp/WEB-INF/lib/standard.jar": org.apache.jasper.JasperException: Failed to load or instantiate TagLibraryValidator class: org.apache.taglibs.standard.tlv.JstlCoreTLV
I did some googling, but I couldn't sort it out, some said it could be caused by conflicting versions of the jars. Maybe I should not include those jars and use a different JSTL url? Mine is for JSTL 1.1 I think, is there a new URL for JSTL 1.2?
What should I do to solve the problem and make this application run?
I have been fighting with this for several hours.
Here is a complete solution.
I am using Tomcat 7, which is a Servlet 3.0-compliant server.
If you desire to use the Servlet 3.0 spec, you must have your web.xml as follows:
<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">
If you're using Maven, your pom.xml should have these lines.
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>javax.servlet-api</artifactId>
<version>3.0.1</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>jstl</artifactId>
<version>1.2</version>
</dependency>
<dependency>
<groupId>org.glassfish.web</groupId>
<artifactId>jstl-impl</artifactId>
<version>1.2</version>
<exclusions>
<exclusion>
<artifactId>servlet-api</artifactId>
<groupId>javax.servlet</groupId>
</exclusion>
<exclusion>
<artifactId>jsp-api</artifactId>
<groupId>javax.servlet.jsp</groupId>
</exclusion>
<exclusion>
<artifactId>jstl-api</artifactId>
<groupId>javax.servlet.jsp.jstl</groupId>
</exclusion>
</exclusions>
</dependency>
These dependencies are very important. JSTL 2.1 + Tomcat 7 + Servlet 3.0 is very broken unless you fix it by using these lines, especially the exclusion part. What is happening is the JSTL 2.1 Jars are actually pulling in the wrong versions of the Servlet spec--2.5. Unless you stop that from happening, you will be in a whole world of pain. A special thanks to Mr. Murray Todd Williams for these insights .
Finally, in case Maven can't find those JARS, you can make Eclipse happy by including three JARS with your project and doing the usual Project--> Properties--> Java Build Path and include them that way--though Maven should take care of it.
javax.servlet-api-3.0.1.jar
javax.servlet.jsp.jstl-1.2.1.jar
javax.servlet.jsp.jstl-api-1.2.1.jar
Please note! This exact configuration only applies if you are using the magic combination of:
A Servlet 3.0-compliant application server such as Tomcat 7
Your web.xml has the right namespace for the Servlet 3.0 spec
You have those three JARS and no other JSTL or Servlet JARS on your classpath.
Make sure you do not place copies of these JARs in your WEB-INF/lib directory because they would in that case be sent to the server thereby causing LinkageErrors.
In your JSP, you need to have this PRECISE line, formatted exactly as I have it or else Eclipse will whine that it doesn't recognize the c:blah tags:
<%#taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
What a danged PITA! This is MUCH harder to implement than any other version of JSTL. This is the only example of something getting much more complicated rather than simpler in later iterations.
Tomcat has never included JSTL.
You should put the jstl and standard jars in WEB-INF/lib (you've done that), and make sure you have the permissions to read them (chmod)
Your URI is correct and it should work (works here)
Your uri is correct for JSTL 1.2. You need to do two things :
Change your web.xml to use the latest web-app version.
It should look something like this or a later version;
<?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">
Secondly put the correct version of jstl jars in your code. For 1.2 You can download them here.
This should give you two jars:
jstl-api.jar
jstl-impl.jar
Use these, instead of standard.jar and jstl.jar which were for previous version.
Let us know how this works for you.
For running on apache tomcat 7 adding these into your POM is probably appropriate. These jars don't reference javax.servlet jars like the glassfish ones do, so there is no need for exclusions.
<dependency>
<groupId>org.apache.taglibs</groupId>
<artifactId>taglibs-standard-spec</artifactId>
<version>1.2.1</version>
</dependency>
<dependency>
<groupId>org.apache.taglibs</groupId>
<artifactId>taglibs-standard-impl</artifactId>
<version>1.2.1</version>
</dependency>
For Tomcat, there is a simpler dependency solution for JSTL 1.1.2:
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>jstl</artifactId>
<!-- Apache Taglibs does not implement version 1.2 -->
<version>1.1.2</version>
</dependency>
<dependency>
<groupId>taglibs</groupId>
<artifactId>standard</artifactId>
<version>1.1.2</version>
</dependency>
<dependency>
<groupId>taglibs</groupId>
<artifactId>c</artifactId>
<version>1.1.2</version>
<type>tld</type>
</dependency>
<dependency>
<groupId>taglibs</groupId>
<artifactId>fmt</artifactId>
<version>1.1.2</version>
<type>tld</type>
</dependency>
<dependency>
See here for more details (personal blog).
REM: More details as requested, one has to include JSTL dependencies to make them available on Tomcat. Yet, version 1.2 is not really necessary, since version 1.1.2 (delivered by Apache, like Tomcat) does the job too. Its only requirement is Servlet 2.4 and JSP 2.2, and the OP mention Servlet 3.0 and JSP 2.0, which is good enough.
There are two answers here that are mostly correct with regard to how to solve this problem when using Maven when dealing with this issue. However, both are not 100% complete.
Using Exclusions per #Tom Hunter's answer
This answer works. However, there will still be log messages from Tomcat regarding duplicate TLD definitions. This is because both the jstl and jstl-impl artifacts include the TLD definitions. To remove those messages, I think a better Maven setup is this:
<dependency>
<version>1.2</version>
<scope>runtime</scope>
<groupId>javax.servlet.jsp.jstl</groupId>
<artifactId>jstl-api</artifactId>
<exclusions>
<exclusion>
<artifactId>servlet-api</artifactId>
<groupId>javax.servlet</groupId>
</exclusion>
<exclusion>
<artifactId>jsp-api</artifactId>
<groupId>javax.servlet.jsp</groupId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.glassfish.web</groupId>
<artifactId>jstl-impl</artifactId>
<version>1.2</version>
<scope>runtime</scope>
<exclusions>
<exclusion>
<artifactId>servlet-api</artifactId>
<groupId>javax.servlet</groupId>
</exclusion>
<exclusion>
<artifactId>jsp-api</artifactId>
<groupId>javax.servlet.jsp</groupId>
</exclusion>
<exclusion>
<artifactId>jstl-api</artifactId>
<groupId>javax.servlet.jsp.jstl</groupId>
</exclusion>
</exclusions>
</dependency>
This includes only the jstl api classes with the necessary exclusions to avoid the problems explained in the rest of that answer.
Using newer POM versions per #George's answer
It took me a while to realize it, but there are newer versions of the JSTL pom's available. It's really confusing because these newer packages use similar, but slightly different naming conventions. These newer versions mark the javax.servlet, javax.jsp, etc dependencies as provided scope so that they do not need to be excluded. The 1.2.1 version depends on a 1.2.1 version of the jstl-api. And so this would work as well as above answer:
<dependency>
<groupId>org.glassfish.web</groupId>
<artifactId>javax.servlet.jsp.jstl</artifactId>
<version>1.2.1</version>
<scope>runtime</scope>
</dependency>
This differs slightly from George's answer because I changed scope to runtime. George specified scope as provided. With a provided scope, the jars would have to be copied manually in to the Tomcat lib directory, or some other dependency would have to included the necessary implementation.
However, I could not find the 1.2.1 version of the impl in maven central, jboss repo, or any other repos. I ended up going around in circles and finally just used a local file based repo to store the jar. The dependency and jar are described here:
http://mvnrepository.com/artifact/org.glassfish.web/javax.servlet.jsp.jstl/1.2.1
None of these worked for me, I simply created the project without using Maven and adding the JAR files directly.
I suffered from the error: SEVERE: Servlet.service() for servlet [obliquid.servlet.Index] in context with path [/cp] threw exception [The absolute uri: http://java.sun.com/jsp/jstl/core cannot be resolved in either web.xml or the jar files deployed with this application] on Tomcat 7
The Solution:
copy jars jstl-1.2.jar and javax.servlet.jsp.jstl-api-1.2.1.jar straight to Tomcat Library Directory. Redeploy Tomcat Library in Eclipse again.
The following dependencies in the pom.xml seem to resolve the issue:
<dependency>
<groupId>org.glassfish.web</groupId>
<artifactId>javax.servlet.jsp.jstl</artifactId>
<version>1.2.1</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>javax.servlet.jsp.jstl</groupId>
<artifactId>javax.servlet.jsp.jstl-api</artifactId>
<version>1.2.1</version>
<scope>provided</scope>
</dependency>
That was a strange combination - two different groupIds - but it does work :). My expectation was to see the same group ID for both jars. I managed to redeploy without a problem to Tomcat 7.
Also, if you see "Unkown tag