java - org.apache.jasper.JasperException: Unable to compile class for JSP pls helpz -
i'm making web application project using maven. i've jsp file index.jsp
.
here index.jsp
:
<%@ page language="java" contenttype="text/html; charset=iso-8859-1"%> <%@ page import="rajendra.arora.bitcoin.coinbaseexample" %> <!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> </head> <body> <p>my name fooo.</p> <% coinbaseexample ce=new coinbaseexample(); out.println(ce.gethttp("https://api.coinbase.com/v1/account/balance", null)); %> </body> </html>
now, i've coinbaseexample.java
file looks like:
package rajendra.arora.bitcoin; import java.io.ioexception; import java.security.invalidkeyexception; import java.security.nosuchalgorithmexception; import javax.crypto.mac; import javax.crypto.spec.secretkeyspec; import org.apache.commons.codec.binary.hex; import org.apache.http.httpentity; import org.apache.http.httpresponse; import org.apache.http.client.clientprotocolexception; import org.apache.http.client.httpclient; import org.apache.http.client.methods.httpget; import org.apache.http.client.methods.httppost; import org.apache.http.client.methods.httprequestbase; import org.apache.http.entity.stringentity; import org.apache.http.impl.client.httpclientbuilder; import org.apache.http.util.entityutils; import com.coinbase.api.coinbase; import com.coinbase.api.coinbasebuilder; public class coinbaseexample { static string api_key = "api_key"; static string api_secret = "api_secret"; public static string gethttp(string url, string body) throws invalidkeyexception, nosuchalgorithmexception, clientprotocolexception, ioexception { string nonce = string.valueof(system.currenttimemillis()); string message = nonce + url + (body != null ? body : ""); mac mac = mac.getinstance("hmacsha256"); mac.init(new secretkeyspec(api_secret.getbytes(), "hmacsha256")); string signature = new string(hex.encodehex(mac.dofinal(message.getbytes()))); httprequestbase request; if (body == null || body.length() == 0) request = new httpget(url); else { httppost post = new httppost(url); post.setentity(new stringentity(body)); request = post; } request.setheader("access_key", api_key); request.setheader("access_signature", signature); request.setheader("access_nonce", nonce); coinbase cb = new coinbasebuilder() .withapikey(system.getenv(api_key), system.getenv(api_secret)) .build(); httpclient httpclient = httpclientbuilder.create().build(); httpresponse response = httpclient.execute(request); httpentity entity = response.getentity(); if (entity != null) return entityutils.tostring(entity); return null; } }
i've inserted dependency
pom.xml
like:
<dependency> <groupid>javax.servlet</groupid> <artifactid>jsp-api</artifactid> <version>2.0</version> <scope>provided</scope> </dependency>
after running program says:
dec 02, 2014 2:56:45 org.apache.catalina.core.aprlifecyclelistener init info: apr based apache tomcat native library allows optimal performance in production environments not found on java.library.path: c:\program files\java\jre8\bin;c:\windows\sun\java\bin;c:\windows\system32;c:\windows;c:/program files/java/jre8/bin/client;c:/program files/java/jre8/bin;c:/program files/java/jre8/lib/i386;c:\windows\system32;c:\windows;c:\windows\system32\wbem;c:\windows\system32\windowspowershell\v1.0\;c:\program files\windows kits\8.1\windows performance toolkit\;c:\program files\microsoft sql server\110\tools\binn\;d:\eclipse;;. dec 02, 2014 2:56:45 org.apache.tomcat.util.digester.setpropertiesrule begin warning: [setpropertiesrule]{server/service/engine/host/context} setting property 'source' 'org.eclipse.jst.j2ee.server:coinbase-java' did not find matching property. dec 02, 2014 2:56:46 org.apache.coyote.abstractprotocol init info: initializing protocolhandler ["http-nio-8080"] dec 02, 2014 2:56:46 org.apache.tomcat.util.net.nioselectorpool getsharedselector info: using shared selector servlet write/read dec 02, 2014 2:56:46 org.apache.coyote.abstractprotocol init info: initializing protocolhandler ["ajp-nio-8009"] dec 02, 2014 2:56:46 org.apache.tomcat.util.net.nioselectorpool getsharedselector info: using shared selector servlet write/read dec 02, 2014 2:56:47 org.apache.catalina.startup.catalina load info: initialization processed in 2440 ms dec 02, 2014 2:56:47 org.apache.catalina.core.standardservice startinternal info: starting service catalina dec 02, 2014 2:56:47 org.apache.catalina.core.standardengine startinternal info: starting servlet engine: apache tomcat/8.0.0-rc5 dec 02, 2014 2:56:48 org.apache.catalina.loader.webappclassloader validatejarfile info: validatejarfile(c:\users\raj\documents\jsp projects\.metadata\.plugins\org.eclipse.wst.server.core\tmp0\wtpwebapps\coinbase-java\web-inf\lib\servlet-api-2.4.jar) - jar not loaded. see servlet spec 2.3, section 9.7.2. offending class: javax/servlet/servlet.class dec 02, 2014 2:56:51 org.apache.jasper.servlet.tldscanner scanjars info: @ least 1 jar scanned tlds yet contained no tlds. enable debug logging logger complete list of jars scanned no tlds found in them. skipping unneeded jars during scanning can improve startup time , jsp compilation time. dec 02, 2014 2:56:51 org.apache.coyote.abstractprotocol start info: starting protocolhandler ["http-nio-8080"] dec 02, 2014 2:56:51 org.apache.coyote.abstractprotocol start info: starting protocolhandler ["ajp-nio-8009"] dec 02, 2014 2:56:51 org.apache.catalina.startup.catalina start info: server startup in 4557 ms dec 02, 2014 2:56:54 org.apache.catalina.core.standardwrappervalve invoke severe: servlet.service() servlet [jsp] in context path [/coinbase-java] threw exception [unable compile class jsp: error occurred @ line: [32] in generated java file: [c:\users\raj\documents\jsp projects\.metadata\.plugins\org.eclipse.wst.server.core\tmp0\work\catalina\localhost\coinbase-java\org\apache\jsp\index_jsp.java] method getjspapplicationcontext(servletcontext) undefined type jspfactory stacktrace:] root cause org.apache.jasper.jasperexception: unable compile class jsp: error occurred @ line: [32] in generated java file: [c:\users\raj\documents\jsp projects\.metadata\.plugins\org.eclipse.wst.server.core\tmp0\work\catalina\localhost\coinbase-java\org\apache\jsp\index_jsp.java] method getjspapplicationcontext(servletcontext) undefined type jspfactory stacktrace: @ org.apache.jasper.compiler.defaulterrorhandler.javacerror(defaulterrorhandler.java:103) @ org.apache.jasper.compiler.errordispatcher.javacerror(errordispatcher.java:199) @ org.apache.jasper.compiler.jdtcompiler.generateclass(jdtcompiler.java:467) @ 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:606) @ org.apache.jasper.servlet.jspservletwrapper.service(jspservletwrapper.java:357) @ org.apache.jasper.servlet.jspservlet.servicejspfile(jspservlet.java:403) @ org.apache.jasper.servlet.jspservlet.service(jspservlet.java:347) @ javax.servlet.http.httpservlet.service(httpservlet.java:728) @ org.apache.catalina.core.applicationfilterchain.internaldofilter(applicationfilterchain.java:303) @ org.apache.catalina.core.applicationfilterchain.dofilter(applicationfilterchain.java:208) @ org.apache.tomcat.websocket.server.wsfilter.dofilter(wsfilter.java:51) @ org.apache.catalina.core.applicationfilterchain.internaldofilter(applicationfilterchain.java:241) @ org.apache.catalina.core.applicationfilterchain.dofilter(applicationfilterchain.java:208) @ org.apache.catalina.core.standardwrappervalve.invoke(standardwrappervalve.java:221) @ org.apache.catalina.core.standardcontextvalve.invoke(standardcontextvalve.java:107) @ org.apache.catalina.authenticator.authenticatorbase.invoke(authenticatorbase.java:504) @ org.apache.catalina.core.standardhostvalve.invoke(standardhostvalve.java:155) @ org.apache.catalina.valves.errorreportvalve.invoke(errorreportvalve.java:76) @ org.apache.catalina.valves.accesslogvalve.invoke(accesslogvalve.java:934) @ org.apache.catalina.core.standardenginevalve.invoke(standardenginevalve.java:90) @ org.apache.catalina.connector.coyoteadapter.service(coyoteadapter.java:515) @ org.apache.coyote.http11.abstracthttp11processor.process(abstracthttp11processor.java:1012) @ org.apache.coyote.abstractprotocol$abstractconnectionhandler.process(abstractprotocol.java:642) @ org.apache.coyote.http11.http11nioprotocol$http11connectionhandler.process(http11nioprotocol.java:223) @ org.apache.tomcat.util.net.nioendpoint$socketprocessor.dorun(nioendpoint.java:1597) @ org.apache.tomcat.util.net.nioendpoint$socketprocessor.run(nioendpoint.java:1555) @ java.util.concurrent.threadpoolexecutor.runworker(unknown source) @ java.util.concurrent.threadpoolexecutor$worker.run(unknown source) @ java.lang.thread.run(unknown source)
and index.jsp
says:
http status 500 - unable compile class jsp.
please, me :(
surely, appreciated!!
i copied source on tomcat 6/7 working fine. got
my name fooo. {"error":"access_key not matched user"}
i guess error because commented
// coinbase cb = new coinbasebuilder() // .withapikey(system.getenv(api_key), system.getenv(api_secret)) // .build();
try project>clean... , , tomcat>clean...
Comments
Post a Comment