JSF exception deploying to FireFly, tag named inputFile null handler-class - eclipse

I am trying to learn JSF and am having a problem deploying any project. I have installed the following:
Eclipse Kepler release 2
JBoss tools for eclipse
WildFly 8
Maven 3.2.1
Java JDK 8
mojarra 2.2.6
I am having this problem with JSF projects I create and downloaded sample project. When I deploy the project to WildFly in eclipse it throws the exception:
JBAS014777: Services which failed to start: service jboss.undertow.deployment.default-server.default-host./Test: org.jboss.msc.service.StartException in service jboss.undertow.deployment.default-server.default-host./Test: Failed to start service
The Test.war.failed file in the deployment folder of WildFly has the following:
"{\"JBAS014671: Failed services\" => {\"jboss.undertow.deployment.default-server.default-host./Test\" => \"org.jboss.msc.service.StartException in service jboss.undertow.deployment.default-server.default-host./Test: Failed to start service
Caused by: java.lang.RuntimeException: java.lang.RuntimeException: com.sun.faces.config.ConfigurationException: The tag named inputFile from namespace http://xmlns.jcp.org/jsf/html has a null handler-class defined
Caused by: java.lang.RuntimeException: com.sun.faces.config.ConfigurationException: The tag named inputFile from namespace http://xmlns.jcp.org/jsf/html has a null handler-class defined
Caused by: com.sun.faces.config.ConfigurationException: The tag named inputFile from namespace http://xmlns.jcp.org/jsf/html has a null handler-class defined\"}}"
Also, I don't know if this is related, but when I open the faces-config.xml file in eclipse it doesn't show the page with all the tabs that the many web examples show. It only has tabs for Diagram, Tree, and Source. Is this because the examples are JSF 2.0 and I am using JSF 2.2.6?

Please remove Mojarra from the dependencies. WildFly already ships with an JSF implementation and if you deploy one with your app, you run into such problems.

Recreating the dynamic web project with JSF 2.1 instead 2.2 resolved the issue for me once...
and then once again the same error and updating web.xml as follows worked fine...
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
id="WebApp_ID" version="2.5">
<display-name>JavaServerFaces</display-name>
<!-- Change to "Production" when you are ready to deploy -->
<context-param>
<param-name>javax.faces.PROJECT_STAGE</param-name>
<param-value>Development</param-value>
</context-param>
<!-- Welcome page -->
<welcome-file-list>
<welcome-file>faces/hello.xhtml</welcome-file>
</welcome-file-list>
<!-- JSF mapping -->
<servlet>
<servlet-name>Faces Servlet</servlet-name>
<servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<!-- Map these files with JSF -->
<servlet-mapping>
<servlet-name>Faces Servlet</servlet-name>
<url-pattern>/faces/*</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>Faces Servlet</servlet-name>
<url-pattern>*.jsf</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>Faces Servlet</servlet-name>
<url-pattern>*.faces</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>Faces Servlet</servlet-name>
<url-pattern>*.xhtml</url-pattern>
</servlet-mapping>
</web-app>

Related

Why do I have to redeploy my application every time I restart Glassfish?

I'm a first time user on stack overflow and new to Glassfish.
I'm using NetBeans 8.2 and Glassfish 5.0, my application is using Primefaces and JSF.
I can deploy my application successfully to Glassfish using NetBeans or via a .war file, but every time I restart Glassfish I get a 404 error when I try to access my web application. I then need to redeploy my application for it to work again. I am able to redeploy via NetBeans without issue, but need to undeploy before redeploying if using a .war file.
I have a test application running on the same server that is not impacted by the restart.
I've looked at similar issues on stack overflow and tried modifying my web.xml but this doesn't seem to help. I suspect this is a configuration error on my part, here is my web.xml.
<web-app version="3.1" 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_3_1.xsd">
<context-param>
<param-name>javax.faces.PROJECT_STAGE Production</param-name>
<param-value>Development</param-value>
</context-param>
<servlet>
<servlet-name>Faces Servlet</servlet-name>
<servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>Faces Servlet</servlet-name>
<url-pattern>/faces/*</url-pattern>
</servlet-mapping>
<session-config>
<session-timeout>
30
</session-timeout>
</session-config>
<welcome-file-list>
<welcome-file>faces/index.xhtml</welcome-file>
</welcome-file-list>
<context-param>
<param-name>javax.faces.DATETIMECONVERTER_DEFAULT_TIMEZONE_IS_SYSTEM_TIMEZONE</param-name>
<param-value>true</param-value>
</context-param>
</web-app>
I was expecting the web application to be unaffected by a Glassfish server restart, but it requires redeployment for it to run successfully after a restart.
Any suggestions greatly appreciated. :)

HTTP Status 404 The requested resource is not available jersey tomcat

I am having trouble to launch my testing app on the tomcat8 server. When i enter the http://localhost:8080/loginService/rest/auth, the error message is "HTTP Status 404 -
type Status report. message: description The requested resource is not available."
And the starting page http://localhost:8080/ works fine.
I put all the jar files(jersey-client, jersey-common, jersey-container-servlet,jersey-container-servlet-core, jersey-server, javax.ws.rs-api-2.0 ....) under the WEB-INF/lib. And loginService is deployed by the server.
the web.xml file under WEB-INF
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" id="WebApp_ID"
version="2.5">
<display-name>loginService</display-name>
<servlet>
<servlet-name>Jersey REST Service</servlet-name>
<servlet-class>com.sun.jersey.spi.container.servlet.ServletContainer</servlet-class>
<init-param>
<param-name>com.sun.jersey.config.property.packages</param-name>
<param-value>loginTest</param-value>
</init-param>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>Jersey REST Service</servlet-name>
<url-pattern>/rest/*</url-pattern>
</servlet-mapping>
</web-app>
my testing app:
package loginTest;
import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.Produces;
import javax.ws.rs.core.MediaType;
#Path("/auth")
public class Authenticate {
// This method is called if TEXT_PLAIN is request
#GET
#Produces(MediaType.TEXT_PLAIN)
public String test() {
return "succes";
}
}
Here are the part of the console msg which seems like a problem:
七月 10, 2014 3:06:20 下午 org.apache.catalina.core.StandardContext reload
严重: Exception starting Context with name [/loginService]
org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina].StandardHost[localhost].StandardContext[/loginService]]
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:154)
at org.apache.catalina.core.StandardContext.reload(StandardContext.java:3780)
at org.apache.catalina.loader.WebappLoader.backgroundProcess(WebappLoader.java:293)
at org.apache.catalina.core.StandardContext.backgroundProcess(StandardContext.java:5539)
at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.processChildren(ContainerBase.java:1365)
at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.processChildren(ContainerBase.java:1369)
at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.processChildren(ContainerBase.java:1369)
at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.run(ContainerBase.java:1345)
at java.lang.Thread.run(Unknown Source)
Caused by: java.lang.NoClassDefFoundError: jersey/repackaged/com/google/common/base/Function
at org.glassfish.jersey.internal.ServiceFinder.<clinit>(ServiceFinder.java:165)
at org.glassfish.jersey.servlet.internal.ServletContainerProviderFactory.getAllServletContainerProviders(ServletContainerProviderFactory.java:66)
at org.glassfish.jersey.servlet.init.JerseyServletContainerInitializer.onStartup(JerseyServletContainerInitializer.java:132)
at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5173)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
... 8 more
Caused by: java.lang.ClassNotFoundException: jersey.repackaged.com.google.common.base.Function
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1324)
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1177)
... 13 more
七月 10, 2014 3:06:20 下午 org.apache.catalina.core.StandardContext reload
信息: Reloading Context with name [/loginService] is completed
And I am using tomcat8 and jersey2.10.1.
I just changed my web.xml file to :
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" id="WebApp_ID"
version="2.5">
<display-name>loginService</display-name>
<servlet>
<servlet-name>Jersey REST Service</servlet-name>
<servlet-class>org.glassfish.jersey.spi.container.servlet.ServletContainer</servlet-class>
<init-param>
<param-name>jersey.config.server.provider.packages</param-name>
<param-value>loginTest</param-value>
</init-param>
<init-param>
<param-name>com.sun.jersey.api.json.POJOMappingFeature</param-name>
<param-value>true</param-value>
</init-param>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>Jersey REST Service</servlet-name>
<url-pattern>/rest/*</url-pattern>
</servlet-mapping>
</web-app>
It seems like your application is missing some of the required libraries or (Since you already have the jercy-common.jar) there is an incompatibility in the libraries already in the classpath.
Therefore I would like to point out a perfectly working(Tested with Tomcat 8) sample in the below link.
Jersey-HelloWorld-Example
Hope this helps.
I had this problem. I just solved it by deleting all web.xml files (inside "target" folder and "main" folder). Then right click on the project in Project Explorer and java EE tools -> Generate Deployment Descriptor Stub. After that just right click again on the project -> run as -> Maven build... Then in "Goals" field write: "clean install" (whithout quotes). Click on Apply, click on Run. Then go to your Tomcat manager, undeploy the old .war file and deploy it again. Then just run it! It worked for me.
According to this link https://www3.ntu.edu.sg/home/ehchua/programming/howto/Tomcat_HowTo.html#TomcatDebug , there are many reasons for this kind of problem to occur. In addition, I had been through this problem before. I solved it through the following way. Take a look at the web.xml heading in tomcat/webapps/ROOT/WEB-INF/web.xml. And make sure your your web.xml looks like that. Specially try to compare the versions. For instance:
Mine was:
<?xml version="1.0" encoding="ISO-8859-1"?>
<web-app version="3.0"
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">
........
..........
</web-app>
The tomcat version that you install can be like this:
<?xml version="1.0" encoding="ISO-8859-1"?>
<web-app version="4.0"
metadata-complete="true"
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_4_0.xsd">
........
..........
</web-app>
If you look at both they have version difference and metadata attribute difference. So header of both your web.xml and tomcat/webapps/ROOT/WEB-INF/web.xml must be identical. By changing version number within the header of my web.xml into 4 solved my problem. Whatever version you have, make sure it is identical with the ROOT's web.xml version. Hope it helps

Unable to compile servlet in jetty

I have a google app engine connected project (in eclipse juno) and it contains a simple servlet file but for some reason when I run the project ,the corresponding class file is not getting created inside WEB-INF/classes folder, in fact there is no classes folder inside WEB-INF. and hence I am unable to run the servlet.I will appreciate if someone could suggest some solution.
Below is my web.xml file->
<?xml version="1.0" encoding="utf-8" standalone="no"?><web-app xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="2.5" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">
<servlet>
<servlet-name>SystemServiceServlet</servlet-name>
<servlet-class>com.google.api.server.spi.SystemServiceServlet</servlet-class>
<init-param>
<param-name>services</param-name>
<param-value>com.queryname.DeviceInfoEndpoint,com.queryname.MessageEndpoint</param-value>
</init-param>
<servlet-name>QueryServiceServlet</servlet-name>
<servlet-class>com.queryname.QueryTest</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>SystemServiceServlet</servlet-name>
<url-pattern>/_ah/spi/*</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>QueryServiceServlet</servlet-name>
<url-pattern>/Query/*</url-pattern>
</servlet-mapping>
</web-app>
I get the following exception-->
WARNING: Failed startup of context com.google.appengine.tools.development.DevAppEngineWebAppContext#684528a3{/,C:\Users\User8\workspace\QueryName-AppEngine\war}
java.lang.IllegalStateException: No such servlet: QueryServiceServlet
Regards,
Laura.
Move your <servlet-name> and <servlet-class> into their own <servlet> and see if this solves the problem. currently they are under the <servlet> element of the SystemServiceServlet.

Deployment Error for module in GlassFish Server 3.1.2

I found the same question asked previously here but I didn't found the suitable answer. I am designing my web in JSF2.0 with PrimeFaces 3.5 as a JSF component suite. Below is the error coming while automatic deploy is in process-
Below is the error which is coming while restarting the GlassFish Server 3.1.2 (As automatic deploy is not working so i thought of restarting it)-
Below is the error displayed by GlassFish Server 3.1.2 in Eclipse console-
SEVERE: service exception
java.lang.NullPointerExceptionnull at java.lang.String.replace(String.java:2219)null at com.sun.enterprise.v3.common.PropsFileActionReporter.setMessage(PropsFileActionReporter.java:67)null at com.sun.enterprise.v3.admin.AdminAdapter.service(AdminAdapter.java:219)null at com.sun.grizzly.tcp.http11.GrizzlyAdapter.service(GrizzlyAdapter.java:179)null at com.sun.enterprise.v3.server.HK2Dispatcher.dispath(HK2Dispatcher.java:117)null at com.sun.enterprise.v3.services.impl.ContainerMapper$Hk2DispatcherCallable.call(ContainerMapper.java:354)null at com.sun.enterprise.v3.services.impl.ContainerMapper.service(ContainerMapper.java:195)null at com.sun.grizzly.http.ProcessorTask.invokeAdapter(ProcessorTask.java:860)null at com.sun.grizzly.http.ProcessorTask.doProcess(ProcessorTask.java:757)null at com.sun.grizzly.http.ProcessorTask.process(ProcessorTask.java:1056)null at com.sun.grizzly.http.DefaultProtocolFilter.execute(DefaultProtocolFilter.java:229)null at com.sun.grizzly.DefaultProtocolChain.executeProtocolFilter(DefaultProtocolChain.java:137)null at com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:104)null at com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:90)null at com.sun.grizzly.http.HttpProtocolChain.execute(HttpProtocolChain.java:79)null at com.sun.grizzly.ProtocolChainContextTask.doCall(ProtocolChainContextTask.java:54)null at com.sun.grizzly.SelectionKeyContextTask.call(SelectionKeyContextTask.java:59)null at com.sun.grizzly.ContextTask.run(ContextTask.java:71)null at com.sun.grizzly.util.AbstractThreadPool$Worker.doWork(AbstractThreadPool.java:532)null at com.sun.grizzly.util.AbstractThreadPool$Worker.run(AbstractThreadPool.java:513)null at java.lang.Thread.run(Thread.java:679)null
My web.xml looks like below-
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd"
id="portal" version="3.0">
<display-name>Portal</display-name>
<!-- Change to "Production" when you are ready to deploy -->
<context-param>
<param-name>javax.faces.PROJECT_STAGE</param-name>
<param-value>Development</param-value>
</context-param>
<context-param>
<param-name>primefaces.THEME</param-name>
<param-value>cupertino</param-value>
</context-param>
<context-param>
<param-name>javax.faces.INTERPRET_EMPTY_STRING_SUBMITTED_VALUES_AS_NULL</param-name>
<param-value>true</param-value>
</context-param>
<!-- Primefaces file upload -->
<!-- thresholdSize specifies the maximum file size in bytes to keep uploaded
files in memory. If it exceeds this limit, it’ll be temporarily written to
disk. -->
<!-- uploadDirectory is the folder where to keep temporary files that exceed
thresholdSize. -->
<filter>
<filter-name>PrimeFaces FileUpload Filter</filter-name>
<filter-class>org.primefaces.webapp.filter.FileUploadFilter</filter-class>
<init-param>
<param-name>thresholdSize</param-name>
<param-value>51200</param-value>
</init-param>
</filter>
<filter-mapping>
<filter-name>PrimeFaces FileUpload Filter</filter-name>
<servlet-name>Faces Servlet</servlet-name>
</filter-mapping>
<context-param>
<param-name>uploadDirectory</param-name>
<param-value>/opt/upload/</param-value>
</context-param>
<welcome-file-list>
<welcome-file>index.xhtml</welcome-file>
</welcome-file-list>
<servlet>
<servlet-name>Faces Servlet</servlet-name>
<servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>Faces Servlet</servlet-name>
<url-pattern>*.xhtml</url-pattern>
</servlet-mapping>
<session-config>
<session-timeout>30</session-timeout>
</session-config>
</web-app>
I am using Eclipse Indigo on Ubuntu 10.04.4 LTS.

Deploy Servlet to Tomcat hosting

I create Facebook JSP Application. I use Restful Java Client Web Services. And created .java file. in this file have Servlet. but can not deploy it into the hosting. I deployed follow
WEB-INF
-classes
-facebook
-socialnetworkingservice
-facebookresponse
......and many classes
-META-INF
-org
-my
-facebook
-client
FacebookClient$FacebookCallbackServlet.class
FacebookClient$FacebookLoginServlet.class
FacebookClient.class
-lib
..lib files
-web.xml
web.xml
<?xml version="1.0" encoding="UTF-8"?>
<web-app version="2.5" 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_2_5.xsd">
<servlet>
<servlet-name>FacebookClient$FacebookLoginServlet</servlet-name>
<servlet-class>org.my.facebook.client.FacebookClient$FacebookLoginServlet</servlet-class>
</servlet>
<servlet>
<servlet-name>FacebookClient$FacebookCallbackServlet</servlet-name>
<servlet-class>org.my.facebook.client.FacebookClient$FacebookCallbackServlet</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>FacebookClient$FacebookLoginServlet</servlet-name>
<url-pattern>/FacebookLoginServlet</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>FacebookClient$FacebookCallbackServlet</servlet-name>
<url-pattern>/FacebookCallbackServlet/</url-pattern>
</servlet-mapping>
<session-config>
<session-timeout>
30
</session-timeout>
</session-config>
<welcome-file-list>
<welcome-file>index.jsp</welcome-file>
</welcome-file-list>
</web-app>
META-INf ( I think it is not important)
I compile localhost and have (MyFbFriend.war)
and I get this error
"Not Found
The requested URL /FacebookLoginServlet was not found on this server.
Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request."
Try
http://localhost:8080/MyFbFriend/FacebookLoginServlet/
The name of the War gives the Context of the App