Re4per
Posts: 8
Joined: Sun Sep 14, 2014 6:32 pm
Location: Germany, NRW, A

using Pi4J inside JSP fails

Sun Sep 14, 2014 7:02 pm

Hello together,

i'm trying to build a JSP webfrontend using the pi4j library. So far, it consists of two pages. The first one is displaying gpio states and other "live" values. The second one is intended to be the "settings" page, were it should be possible to send modified values and gpio pin states to the first JSP to adjust program behavior.
I tryed to invoke the pi4j library directly into the first JSP page to keep things simple and of course, i don't know a smarter way.
Finally i created a war package containing all necessary files (also the pi4j library in right place).
Both pages are doing the intended jobs, as far as i keep the pi4j libraries within comments. As soon as i invoke them i get a couple of "compilation" errors from the JSP container directly after calling the pi4j using page.

Any help or comments are appreciated.

Here comes the problematic JSP

Code: Select all

<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
    pageEncoding="ISO-8859-1"
 %>
 
<%@ page import="com.pi4j.io.gpio.*" %>

<%-- <%@ page import="com.pi4j.io.gpio.GpioController"%> --%>
<%-- <%@ page import="com.pi4j.io.gpio.GpioFactory"%> --%>
<%-- <%@ page import="com.pi4j.io.gpio.GpioPinDigitalOutput"%> --%>
<%-- <%@ page import="com.pi4j.io.gpio.PinState"%> --%>
<%-- <%@ page import="com.pi4j.io.gpio.RaspiPin"%> --%>
<%-- <%@ page import="com.pi4j.system.SystemInfo"%> --%>
	
<%! int i = 5;%>

<%! GpioController gpio = GpioFactory.getInstance();%>
<%! GpioPinDigitalOutput pin01 = gpio.provisionDigitalOutputPin(RaspiPin.GPIO_00, "Output01", PinState.LOW);%>


<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Insert title here</title>
<ul id="tabmenue">
  <li><a id="Monitor" href="#">Monitor</a></li>
  <li><a href="./Einstellungen.jsp">Einstellungen</a></li>
</ul>
</head>
<body>

<%
String solltemp = request.getParameter("solltemperatur");
String deltatemp = request.getParameter("deltatemperatur");
String sealing = request.getParameter("heizungein");

if (solltemp != null){
	solltemp = request.getParameter("solltemperatur");	
} else {
	solltemp = "null";
}

if (deltatemp != null){
	deltatemp = request.getParameter("deltatemperatur");	
} else {
	deltatemp = "null";
}

if (sealing != null) {
	sealing = request.getParameter("heizungein");
} else {
	sealing = "false";
}

%><p><%=solltemp%></p><%
%><p><%=deltatemp%></p><%
%><p><%=i%></p><%

if(sealing.toString().equals("true")){
	%><img src="led_green.gif" alt="Ein"><%
// 	pin01.high();
} else {
	%><img src="led_gray.gif" alt="Aus"><%
// 	pin01.low();
}

%>


</body>
</html>
and here is the ErrorMessage from Tomcat 7.0.28

Code: Select all

exception

org.apache.jasper.JasperException: Unable to compile class for JSP: 

An error occurred at line: 16 in the jsp file: /JavaServerPages/Monitor.jsp
GpioController cannot be resolved to a type
13: 	
14: <%! int i = 5;%>
15: 
16: <%! GpioController gpio = GpioFactory.getInstance();%>
17: <%! GpioPinDigitalOutput pin01 = gpio.provisionDigitalOutputPin(RaspiPin.GPIO_00, "Output01", PinState.LOW);%>
18: 
19: 


An error occurred at line: 16 in the jsp file: /JavaServerPages/Monitor.jsp
GpioFactory cannot be resolved
13: 	
14: <%! int i = 5;%>
15: 
16: <%! GpioController gpio = GpioFactory.getInstance();%>
17: <%! GpioPinDigitalOutput pin01 = gpio.provisionDigitalOutputPin(RaspiPin.GPIO_00, "Output01", PinState.LOW);%>
18: 
19: 


An error occurred at line: 17 in the jsp file: /JavaServerPages/Monitor.jsp
GpioPinDigitalOutput cannot be resolved to a type
14: <%! int i = 5;%>
15: 
16: <%! GpioController gpio = GpioFactory.getInstance();%>
17: <%! GpioPinDigitalOutput pin01 = gpio.provisionDigitalOutputPin(RaspiPin.GPIO_00, "Output01", PinState.LOW);%>
18: 
19: 
20: <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">


An error occurred at line: 17 in the jsp file: /JavaServerPages/Monitor.jsp
gpio cannot be resolved
14: <%! int i = 5;%>
15: 
16: <%! GpioController gpio = GpioFactory.getInstance();%>
17: <%! GpioPinDigitalOutput pin01 = gpio.provisionDigitalOutputPin(RaspiPin.GPIO_00, "Output01", PinState.LOW);%>
18: 
19: 
20: <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">


An error occurred at line: 17 in the jsp file: /JavaServerPages/Monitor.jsp
RaspiPin.GPIO_00 cannot be resolved to a type
14: <%! int i = 5;%>
15: 
16: <%! GpioController gpio = GpioFactory.getInstance();%>
17: <%! GpioPinDigitalOutput pin01 = gpio.provisionDigitalOutputPin(RaspiPin.GPIO_00, "Output01", PinState.LOW);%>
18: 
19: 
20: <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">


An error occurred at line: 17 in the jsp file: /JavaServerPages/Monitor.jsp
PinState.LOW cannot be resolved to a type
14: <%! int i = 5;%>
15: 
16: <%! GpioController gpio = GpioFactory.getInstance();%>
17: <%! GpioPinDigitalOutput pin01 = gpio.provisionDigitalOutputPin(RaspiPin.GPIO_00, "Output01", PinState.LOW);%>
18: 
19: 
20: <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">


Stacktrace:
	org.apache.jasper.compiler.DefaultErrorHandler.javacError(DefaultErrorHandler.java:102)
	org.apache.jasper.compiler.ErrorDispatcher.javacError(ErrorDispatcher.java:331)
	org.apache.jasper.compiler.JDTCompiler.generateClass(JDTCompiler.java:469)
	org.apache.jasper.compiler.Compiler.compile(Compiler.java:378)
	org.apache.jasper.compiler.Compiler.compile(Compiler.java:353)
	org.apache.jasper.compiler.Compiler.compile(Compiler.java:340)
	org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:646)
	org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:357)
	org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:390)
	org.apache.jasper.servlet.JspServlet.service(JspServlet.java:334)
	javax.servlet.http.HttpServlet.service(HttpServlet.java:722)

note The full stack trace of the root cause is available in the Apache Tomcat/7.0.28 logs.

Thank you very much
Last edited by Re4per on Wed Sep 17, 2014 4:17 pm, edited 1 time in total.

User avatar
Douglas6
Posts: 4826
Joined: Sat Mar 16, 2013 5:34 am
Location: Chicago, IL

Re: using pi4j inside JSP fails

Sun Sep 14, 2014 9:03 pm

Re4per wrote:Finally i created a war package containing all necessary files (also the pi4j library in right place).
The JSP compiler is not finding the pi4j packages. What is the 'right place'? I believe it should be /WEB-INF/lib/.

Re4per
Posts: 8
Joined: Sun Sep 14, 2014 6:32 pm
Location: Germany, NRW, A

Re: using pi4j inside JSP fails

Sun Sep 14, 2014 9:36 pm

I believe it should be /WEB-INF/lib/.
Right, as far as i found out, this is it. I checked it on the RPi filesystem also, therefore no changes to the issue.

any other ideas ?

Thanks
Thomas

User avatar
clicky
Posts: 425
Joined: Thu Oct 25, 2012 7:34 am

Re: using pi4j inside JSP fails

Mon Sep 15, 2014 9:22 am

Could you post what is in tomcat log as it said:

Code: Select all

note The full stack trace of the root cause is available in the Apache Tomcat/7.0.28 logs.
and what files you have in WEB-INF/lib.

Key to fix it is in those two places!

Re4per
Posts: 8
Joined: Sun Sep 14, 2014 6:32 pm
Location: Germany, NRW, A

Re: using pi4j inside JSP fails

Mon Sep 15, 2014 11:53 am

Thanks for the comment,

these are the files located under /usr/share/tomcat7-examples/examples/JavaServerPages/WEB-INF/lib
  • pi4j-core.jar
    pi4j-device.jar
    pi4j-gpio-extension.jar
    pi4j-service.jar
and here comes the hole logfile:

Code: Select all

Sep 15, 2014 12:13:22 PM org.apache.catalina.core.ApplicationContext log
Information: ContextListener: contextInitialized()
Sep 15, 2014 12:13:22 PM org.apache.catalina.core.ApplicationContext log
Information: SessionListener: contextInitialized()
Sep 15, 2014 12:13:22 PM org.apache.catalina.core.ApplicationContext log
Information: ContextListener: attributeAdded('org.apache.jasper.compiler.TldLocationsCache', 'org.apache.jasper.compiler.TldLocationsCache@16c143')
Sep 15, 2014 12:19:48 PM org.apache.catalina.core.ApplicationContext log
Information: ContextListener: attributeAdded('org.apache.jasper.runtime.JspApplicationContextImpl', 'org.apache.jasper.runtime.JspApplicationContextImpl@14914ab')
Sep 15, 2014 12:19:48 PM org.apache.catalina.core.ApplicationContext log
Information: SessionListener: sessionCreated('20744E2145618C4B67D7EFA7E1606DA1')
Sep 15, 2014 12:20:02 PM org.apache.catalina.core.StandardWrapperValve invoke
Schwerwiegend: Servlet.service() for servlet [jsp] in context with path [/examples] threw exception [Unable to compile class for JSP: 

An error occurred at line: 16 in the jsp file: /JavaServerPages/Monitor.jsp
GpioController cannot be resolved to a type
13: 	
14: <%! int i = 5;%>
15: 
16: <%! GpioController gpio = GpioFactory.getInstance();%>
17: <%! GpioPinDigitalOutput pin01 = gpio.provisionDigitalOutputPin(RaspiPin.GPIO_00, "Output01", PinState.LOW);%>
18: 
19: 


An error occurred at line: 16 in the jsp file: /JavaServerPages/Monitor.jsp
GpioFactory cannot be resolved
13: 	
14: <%! int i = 5;%>
15: 
16: <%! GpioController gpio = GpioFactory.getInstance();%>
17: <%! GpioPinDigitalOutput pin01 = gpio.provisionDigitalOutputPin(RaspiPin.GPIO_00, "Output01", PinState.LOW);%>
18: 
19: 


An error occurred at line: 17 in the jsp file: /JavaServerPages/Monitor.jsp
GpioPinDigitalOutput cannot be resolved to a type
14: <%! int i = 5;%>
15: 
16: <%! GpioController gpio = GpioFactory.getInstance();%>
17: <%! GpioPinDigitalOutput pin01 = gpio.provisionDigitalOutputPin(RaspiPin.GPIO_00, "Output01", PinState.LOW);%>
18: 
19: 
20: <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">


An error occurred at line: 17 in the jsp file: /JavaServerPages/Monitor.jsp
gpio cannot be resolved
14: <%! int i = 5;%>
15: 
16: <%! GpioController gpio = GpioFactory.getInstance();%>
17: <%! GpioPinDigitalOutput pin01 = gpio.provisionDigitalOutputPin(RaspiPin.GPIO_00, "Output01", PinState.LOW);%>
18: 
19: 
20: <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">


An error occurred at line: 17 in the jsp file: /JavaServerPages/Monitor.jsp
RaspiPin.GPIO_00 cannot be resolved to a type
14: <%! int i = 5;%>
15: 
16: <%! GpioController gpio = GpioFactory.getInstance();%>
17: <%! GpioPinDigitalOutput pin01 = gpio.provisionDigitalOutputPin(RaspiPin.GPIO_00, "Output01", PinState.LOW);%>
18: 
19: 
20: <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">


An error occurred at line: 17 in the jsp file: /JavaServerPages/Monitor.jsp
PinState.LOW cannot be resolved to a type
14: <%! int i = 5;%>
15: 
16: <%! GpioController gpio = GpioFactory.getInstance();%>
17: <%! GpioPinDigitalOutput pin01 = gpio.provisionDigitalOutputPin(RaspiPin.GPIO_00, "Output01", PinState.LOW);%>
18: 
19: 
20: <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">


Stacktrace:] with root cause
org.apache.jasper.JasperException: Unable to compile class for JSP: 

An error occurred at line: 16 in the jsp file: /JavaServerPages/Monitor.jsp
GpioController cannot be resolved to a type
13: 	
14: <%! int i = 5;%>
15: 
16: <%! GpioController gpio = GpioFactory.getInstance();%>
17: <%! GpioPinDigitalOutput pin01 = gpio.provisionDigitalOutputPin(RaspiPin.GPIO_00, "Output01", PinState.LOW);%>
18: 
19: 


An error occurred at line: 16 in the jsp file: /JavaServerPages/Monitor.jsp
GpioFactory cannot be resolved
13: 	
14: <%! int i = 5;%>
15: 
16: <%! GpioController gpio = GpioFactory.getInstance();%>
17: <%! GpioPinDigitalOutput pin01 = gpio.provisionDigitalOutputPin(RaspiPin.GPIO_00, "Output01", PinState.LOW);%>
18: 
19: 


An error occurred at line: 17 in the jsp file: /JavaServerPages/Monitor.jsp
GpioPinDigitalOutput cannot be resolved to a type
14: <%! int i = 5;%>
15: 
16: <%! GpioController gpio = GpioFactory.getInstance();%>
17: <%! GpioPinDigitalOutput pin01 = gpio.provisionDigitalOutputPin(RaspiPin.GPIO_00, "Output01", PinState.LOW);%>
18: 
19: 
20: <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">


An error occurred at line: 17 in the jsp file: /JavaServerPages/Monitor.jsp
gpio cannot be resolved
14: <%! int i = 5;%>
15: 
16: <%! GpioController gpio = GpioFactory.getInstance();%>
17: <%! GpioPinDigitalOutput pin01 = gpio.provisionDigitalOutputPin(RaspiPin.GPIO_00, "Output01", PinState.LOW);%>
18: 
19: 
20: <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">


An error occurred at line: 17 in the jsp file: /JavaServerPages/Monitor.jsp
RaspiPin.GPIO_00 cannot be resolved to a type
14: <%! int i = 5;%>
15: 
16: <%! GpioController gpio = GpioFactory.getInstance();%>
17: <%! GpioPinDigitalOutput pin01 = gpio.provisionDigitalOutputPin(RaspiPin.GPIO_00, "Output01", PinState.LOW);%>
18: 
19: 
20: <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">


An error occurred at line: 17 in the jsp file: /JavaServerPages/Monitor.jsp
PinState.LOW cannot be resolved to a type
14: <%! int i = 5;%>
15: 
16: <%! GpioController gpio = GpioFactory.getInstance();%>
17: <%! GpioPinDigitalOutput pin01 = gpio.provisionDigitalOutputPin(RaspiPin.GPIO_00, "Output01", PinState.LOW);%>
18: 
19: 
20: <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">


Stacktrace:
	at org.apache.jasper.compiler.DefaultErrorHandler.javacError(DefaultErrorHandler.java:102)
	at org.apache.jasper.compiler.ErrorDispatcher.javacError(ErrorDispatcher.java:331)
	at org.apache.jasper.compiler.JDTCompiler.generateClass(JDTCompiler.java:469)
	at org.apache.jasper.compiler.Compiler.compile(Compiler.java:378)
	at org.apache.jasper.compiler.Compiler.compile(Compiler.java:353)
	at org.apache.jasper.compiler.Compiler.compile(Compiler.java:340)
	at org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:646)
	at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:357)
	at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:390)
	at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:334)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:305)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
	at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:225)
	at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:123)
	at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:472)
	at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:168)
	at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:98)
	at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:927)
	at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
	at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:407)
	at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1002)
	at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:579)
	at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:312)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
	at java.lang.Thread.run(Thread.java:724)

Sep 15, 2014 12:50:33 PM org.apache.catalina.core.ApplicationContext log
Information: SessionListener: sessionDestroyed('20744E2145618C4B67D7EFA7E1606DA1')
what i'm curious about is this line:
Sep 15, 2014 12:20:02 PM org.apache.catalina.core.StandardWrapperValve invoke
Schwerwiegend: Servlet.service() for servlet [jsp] in context with path [/examples] threw exception [Unable to compile class for JSP:
I understand it that way, that it has problems to compile the current JSP at line 16 were it is supposed to get the GPIOController instance.
I assume that maybe the servlet container isn't able to create/get the instance and therefore this leeds to the dead end.
There must be a way to get around this. :?:

Is it possible to have a jar application running in the jvm and just talk to it via JSP's ? :?

Thank you

zacburke
Posts: 8
Joined: Tue Sep 09, 2014 9:13 am
Location: Dublin, Ireland
Contact: Website

Re: using pi4j inside JSP fails

Tue Sep 16, 2014 1:18 pm

Hello,
that's weird. It should at least find the class if the jar files are where you say they are.
Just for information, what version of the jvm are you using (I assume its 1.7 ?) A simple "java -version" at the shell prompt would tell us that.

Does the tomcat process definitely have read access to those jars ?

Is there any way you could post your war for us ? or give us a download link to it .

Thanks
-Zac.

User avatar
Douglas6
Posts: 4826
Joined: Sat Mar 16, 2013 5:34 am
Location: Chicago, IL

Re: using pi4j inside JSP fails

Tue Sep 16, 2014 1:34 pm

It vaguely looks to me like Tomcat is using a webroot of /examples rather than /examples/JavaServerPages. Try putting the WEB-INF directory under /examples, or adjust your webroot location.

Re4per
Posts: 8
Joined: Sun Sep 14, 2014 6:32 pm
Location: Germany, NRW, A

Re: using pi4j inside JSP fails

Tue Sep 16, 2014 10:21 pm

Hi there,

Java version is 1.7.0_40


Meanwhile i've changed the location of the war file and put it under /var/lib/tomcat7/webapps. Unfortunately it did not improve anything. Since now tomcat simply crashes w/o filling the logs.

Here comes the file http://www.freefilehosting.net/javaserverpages


Thank you

Thomas

zacburke
Posts: 8
Joined: Tue Sep 09, 2014 9:13 am
Location: Dublin, Ireland
Contact: Website

Re: using pi4j inside JSP fails

Wed Sep 17, 2014 8:55 am

Hello,
I cannot seem to access any resources at that link which you posted.

The point made by Douglas6 (the one dated Tue Sep 16, 2014 1:34 pm) , I think is actually correct. I think that you may have the lib directory in the wrong place.

Your tomcat structure should look like this:

+webapps (this is the root folder in Tomcat where all webapps live. Different directories = different web apps)
------>+JavaServerPages (top directory of your web-app)
---------->+jsp (this is where all of your JSP files will live
---------->+classes (any .java files which you have compiled as class files will live here)
---------->+WEB-INF (there will be a web.xml file here)
------------------>+lib (Your jars need to live inside this directory.!)

Please note that WEB-INF should be in capital letters.

If your war file has this structure, and all the jars are in WEB-INF/lib , then it should work. As I mentioned, I cannot see your uploaded war, so I cannot make comment on that. If you get a chance to re-upload it I can have a look and we can discuss further.

-Zac.

Re4per
Posts: 8
Joined: Sun Sep 14, 2014 6:32 pm
Location: Germany, NRW, A

Re: using pi4j inside JSP fails

Wed Sep 17, 2014 11:40 am

Hello Zac and thanks for putting time in this.

i've checked the dl-link and i found it working, but it's a little bit tricky and of course missleading, sry for that. You have to choose the second box, were you find this link reflected at the top left handside in a textfield which is called "URL". (for crosschecking purpose) and right hand is the implementation for webpages etc. Underneath you find a button ( download this file ),click on it is followed by a captcha input. The filesize is approx 650 k.

The only difference to the structure you posted, is that the jsp's are not within a dedicated "jsp" folder. They're directly located inside the JavaServerPages folder.

Furthermore two points.

1. I commented the lines out were i'm trying to get the Instanceof the gpio controller and left the imports as they are. This results in no more complains. Is it right to assume that the imports are correct ? or is this missleading?

2. I've found that the MANIFEST.MF doesn't reflect an attribute behind "Class-Path:" I doubt that this is right.

Thanks

Re4per
Posts: 8
Joined: Sun Sep 14, 2014 6:32 pm
Location: Germany, NRW, A

Re: using Pi4J inside JSP fails

Thu Sep 18, 2014 6:03 pm

Hello together,

i kept on tinkering around with things and have some new results, but it's still not working...

In the tomcat logs i've found two things which i could solve. It seems to be related to the problem that the Pi4J libs couldn't be found/invoked/used inside my JSP. I found this inside the catalina.out logfile.

Code: Select all

Sep 17, 2014 9:38:49 AM org.apache.catalina.startup.HostConfig checkResources
Information: Undeploying context [/JavaServerPages]
Sep 17, 2014 9:38:49 AM org.apache.catalina.startup.HostConfig deployWAR
Information: Deploying web application archive /var/lib/tomcat7/webapps/JavaServerPages.war
Sep 17, 2014 9:38:55 AM org.apache.catalina.startup.ContextConfig processResourceJARs
Schwerwiegend: Failed to processes JAR found at URL [jar:file:/var/lib/tomcat7/webapps/JavaServerPages/WEB-INF/lib/pi4j-core.jar!/] for static resources to be included in context with name [jar:file:/var/lib/tomcat7/webapps/JavaServerPages/WEB-INF/lib/pi4j-core.jar!/]
Sep 17, 2014 9:38:55 AM org.apache.catalina.startup.ContextConfig processResourceJARs
Schwerwiegend: Failed to processes JAR found at URL [jar:file:/var/lib/tomcat7/webapps/JavaServerPages/WEB-INF/lib/pi4j-service.jar!/] for static resources to be included in context with name [jar:file:/var/lib/tomcat7/webapps/JavaServerPages/WEB-INF/lib/pi4j-service.jar!/]
Sep 17, 2014 9:38:55 AM org.apache.catalina.startup.ContextConfig processResourceJARs
Schwerwiegend: Failed to processes JAR found at URL [jar:file:/var/lib/tomcat7/webapps/JavaServerPages/WEB-INF/lib/pi4j-gpio-extension.jar!/] for static resources to be included in context with name [jar:file:/var/lib/tomcat7/webapps/JavaServerPages/WEB-INF/lib/pi4j-gpio-extension.jar!/]
Sep 17, 2014 9:38:55 AM org.apache.catalina.startup.ContextConfig processResourceJARs
Schwerwiegend: Failed to processes JAR found at URL [jar:file:/var/lib/tomcat7/webapps/JavaServerPages/WEB-INF/lib/pi4j-device.jar!/] for static resources to be included in context with name [jar:file:/var/lib/tomcat7/webapps/JavaServerPages/WEB-INF/lib/pi4j-device.jar!/]
Sep 17, 2014 9:39:35 AM org.apache.coyote.AbstractProtocol pause
Information: Pausing ProtocolHandler ["http-bio-8080"]
Sep 17, 2014 9:39:35 AM org.apache.catalina.core.StandardService stopInternal
Information: Stopping service Catalina
Sep 17, 2014 9:39:35 AM org.apache.coyote.AbstractProtocol stop
Information: Stopping ProtocolHandler ["http-bio-8080"]
Sep 17, 2014 9:39:36 AM org.apache.coyote.AbstractProtocol destroy
Information: Destroying ProtocolHandler ["http-bio-8080"]
Sep 17, 2014 9:39:51 AM org.apache.coyote.AbstractProtocol init
Information: Initializing ProtocolHandler ["http-bio-8080"]
Sep 17, 2014 9:39:51 AM org.apache.catalina.startup.Catalina load
Information: Initialization processed in 10259 ms
After some Googlework i found that there is the servlet-api.jar missing within the project classpath. I added it and this problem was solved.

Continued with this i discovered a new entry inside the log files, as newest entry after i tried to carry out my JSP call.

Code: Select all

wiringPi:
  Must be root to call wiringPiSetup().
  (Did you forget sudo?)
I remembered that the tomcat user and user groub has to be set to root in order to access the wiringPi correctly, so i changed this accordingly.

Now i'm able to use the JSP without crashing my tomcat, but they doesn't toggle GPIO 00 (header 11 according wiringPi)

Seems that there is again something missing, but i couldn't find something at the Pi4J documentation. These modules are not described to be imported. Were could they be found then ?

Code: Select all

Information: Illegal access: this web application instance has been stopped already.  Could not load com.pi4j.concurrent.DefaultExecutorServiceFactory.  The eventual following stack trace is caused by an error thrown for debugging purposes as well as to attempt to terminate the thread which caused the illegal access, and has no functional impact.
java.lang.IllegalStateException
	at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1597)
	at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1556)
	at com.pi4j.io.gpio.GpioFactory.getExecutorServiceFactory(GpioFactory.java:128)
	at com.pi4j.io.gpio.impl.GpioControllerImpl.shutdown(GpioControllerImpl.java:921)
	at com.pi4j.io.gpio.impl.GpioControllerImpl$ShutdownHook.run(GpioControllerImpl.java:891)

Sep 18, 2014 4:41:31 PM org.apache.coyote.AbstractProtocol pause
Information: Pausing ProtocolHandler ["http-bio-8080"]
Exception in thread "Thread-3" java.lang.NoClassDefFoundError: com/pi4j/concurrent/DefaultExecutorServiceFactory
	at com.pi4j.io.gpio.GpioFactory.getExecutorServiceFactory(GpioFactory.java:128)
	at com.pi4j.io.gpio.impl.GpioControllerImpl.shutdown(GpioControllerImpl.java:921)
	at com.pi4j.io.gpio.impl.GpioControllerImpl$ShutdownHook.run(GpioControllerImpl.java:891)
Caused by: java.lang.ClassNotFoundException: com.pi4j.concurrent.DefaultExecutorServiceFactory
	at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1711)
	at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1556)
	... 3 more
Sep 18, 2014 4:41:31 PM org.apache.catalina.core.StandardService stopInternal
Information: Stopping service Catalina
Sep 18, 2014 4:41:31 PM org.apache.catalina.startup.HostConfig deployWARs
Schwerwiegend: Error waiting for multi-thread deployment of WAR files to complete
java.lang.InterruptedException
	at java.util.concurrent.FutureTask.awaitDone(FutureTask.java:400)
	at java.util.concurrent.FutureTask.get(FutureTask.java:187)
	at org.apache.catalina.startup.HostConfig.deployWARs(HostConfig.java:752)
	at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:472)
	at org.apache.catalina.startup.HostConfig.check(HostConfig.java:1454)
	at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:296)
	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.ContainerBase.backgroundProcess(ContainerBase.java:1393)
	at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.processChildren(ContainerBase.java:1566)
	at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.processChildren(ContainerBase.java:1576)
	at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.run(ContainerBase.java:1555)
	at java.lang.Thread.run(Thread.java:724)

Sep 18, 2014 4:41:37 PM org.apache.coyote.AbstractProtocol stop
Information: Stopping ProtocolHandler ["http-bio-8080"]
Sep 18, 2014 4:41:38 PM org.apache.coyote.AbstractProtocol destroy
Information: Destroying ProtocolHandler ["http-bio-8080"]
Sep 18, 2014 4:41:53 PM org.apache.coyote.AbstractProtocol init
Information: Initializing ProtocolHandler ["http-bio-8080"]
Sep 18, 2014 4:41:54 PM org.apache.catalina.startup.Catalina load
Information: Initialization processed in 10385 ms
Any suggestions or further hinds ?


Thanks

Thomas

Return to “Java”