I'm working on implementing Amazon Pay, and instead of converting one of the SDKs to CF, figured I would just use the java sdk - but, I haven't ever worked with anything that is not part of the java core install. Any ideas why this
createObject('java', 'com.amazon.pay.api.WebstoreClient')
is not working ( Object instantiation exception. Error: org/json/JSONException.) when I drop the jar in cfusion\wwwroot\web_inf\lib.
the jar file came from here: https://github.com/amzn/amazon-pay-api-sdk-java/releases
I suspect that the issue is with the import statements for the "core" libraries, but don't know why CF wouldn't be able to find them (seems pretty basic) so I must be doing something wrong.
Windows 10 dev box running CF2016, dev install with a single instance, both restarted and rebooted.
ANSWERED BY #SOS IN THE COMMENTS - reposted here.
Downloaded the sdk to c:/path/to/lib/amazon-pay-api-2.5.1.jar.
Added
this.javaSettings = {
LoadPaths = [ "c:/path/to/lib/amazon-pay-api-2.5.1.jar"],
loadColdFusionClassPath=true };
Restarted Application.cfc
Edited to add code and complete error
This is the complete contents of the file that errors. I have tried both ways and get the same error -
<!--- <cfobject action="create" type="java" class="com.amazon.pay.api.WebstoreClient" name="WebstoreClient"> --->
<cfset wsClient=createObject('java', 'com.amazon.pay.api.WebstoreClient')>
<cfdump var="#wsClient#">
The error
Object instantiation exception.
An exception occurred while instantiating a Java object.
Error: org/json/JSONException.
The error occurred in E:/webroot/striking/d.cfm: line 2
1 : <!--- <cfobject action="create" type="java" class="com.amazon.pay.api.WebstoreClient" name="WebstoreClient"> --->
2 : <cfset wsClient=createObject('java', 'com.amazon.pay.api.WebstoreClient')>
3 :
4 : <cfdump var="#wsClient#">
Resources:
Check the ColdFusion documentation to verify that you are using the correct syntax.
Search the Knowledge Base to find a solution to your problem.
Browser Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/102.0.5005.61 Safari/537.36
Remote Address 127.0.0.1
Referrer
Date/Time 27-May-22 10:20 AM
Stack Trace
at cfd2ecfm486526222.runPage(E:/webroot/striking/d.cfm:2) at cfd2ecfm486526222.runPage(E:/webroot/striking/d.cfm:2)
java.lang.NoClassDefFoundError: org/json/JSONException
at java.lang.Class.getDeclaredFields0(Native Method)
at java.lang.Class.privateGetDeclaredFields(Class.java:2583)
at java.lang.Class.privateGetPublicFields(Class.java:2614)
at java.lang.Class.getFields(Class.java:1557)
at coldfusion.runtime.java.ObjectHandler.Initialize(ObjectHandler.java:35)
at coldfusion.runtime.java.ObjectHandler.<init>(ObjectHandler.java:30)
at coldfusion.runtime.java.ReflectionCache.get(ReflectionCache.java:47)
at coldfusion.runtime.java.JavaProxy.<init>(JavaProxy.java:35)
at coldfusion.runtime.java.JavaProxyFactory.getProxy(JavaProxyFactory.java:121)
at coldfusion.runtime.ProxyFactory.getProxy(ProxyFactory.java:68)
at coldfusion.runtime.CFPage.createObjectProxy(CFPage.java:6608)
at coldfusion.runtime.CFPage.CreateObject(CFPage.java:6571)
at coldfusion.runtime.CFPage.CreateObject(CFPage.java:6505)
at coldfusion.runtime.CFPage.CreateObject(CFPage.java:6431)
at coldfusion.runtime.CFPage.CreateObject(CFPage.java:6372)
at cfd2ecfm486526222.runPage(E:\webroot\striking\d.cfm:2)
at coldfusion.runtime.CfJspPage.invoke(CfJspPage.java:251)
at coldfusion.tagext.lang.IncludeTag.handlePageInvoke(IncludeTag.java:737)
at coldfusion.tagext.lang.IncludeTag.doStartTag(IncludeTag.java:573)
at coldfusion.filter.CfincludeFilter.invoke(CfincludeFilter.java:65)
at coldfusion.filter.IpFilter.invoke(IpFilter.java:45)
at coldfusion.filter.ApplicationFilter.invoke(ApplicationFilter.java:505)
at coldfusion.filter.RequestMonitorFilter.invoke(RequestMonitorFilter.java:43)
at coldfusion.filter.MonitoringFilter.invoke(MonitoringFilter.java:40)
at coldfusion.filter.PathFilter.invoke(PathFilter.java:153)
at coldfusion.filter.LicenseFilter.invoke(LicenseFilter.java:30)
at coldfusion.filter.ExceptionFilter.invoke(ExceptionFilter.java:94)
at coldfusion.filter.BrowserDebugFilter.invoke(BrowserDebugFilter.java:78)
at coldfusion.filter.ClientScopePersistenceFilter.invoke(ClientScopePersistenceFilter.java:28)
at coldfusion.filter.BrowserFilter.invoke(BrowserFilter.java:38)
at coldfusion.filter.NoCacheFilter.invoke(NoCacheFilter.java:60)
at coldfusion.filter.GlobalsFilter.invoke(GlobalsFilter.java:38)
at coldfusion.filter.DatasourceFilter.invoke(DatasourceFilter.java:22)
at coldfusion.filter.CachingFilter.invoke(CachingFilter.java:62)
at coldfusion.CfmServlet.service(CfmServlet.java:219)
at coldfusion.bootstrap.BootstrapServlet.service(BootstrapServlet.java:89)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:292)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:207)
at coldfusion.monitor.event.MonitoringServletFilter.doFilter(MonitoringServletFilter.java:42)
at coldfusion.bootstrap.BootstrapFilter.doFilter(BootstrapFilter.java:46)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:240)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:207)
at coldfusion.inspect.weinre.MobileDeviceDomInspectionFilter.doFilter(MobileDeviceDomInspectionFilter.java:121)
at coldfusion.bootstrap.BootstrapFilter.doFilter(BootstrapFilter.java:46)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:240)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:207)
at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:240)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:207)
at com.seefusion.Filter.doFilter(Filter.java:109)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:240)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:207)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:106)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:502)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:141)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:79)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:88)
at com.seefusion.SeeFusionValve.invoke(SeeFusionValve.java:52)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:536)
at org.apache.coyote.ajp.AbstractAjpProcessor.process(AbstractAjpProcessor.java:898)
at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:672)
at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1500)
at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.run(NioEndpoint.java:1456)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
at java.lang.Thread.run(Thread.java:745)
Caused by: java.lang.ClassNotFoundException: org.json.JSONException
at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1308)
at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1142)
... 68 more
Regards,
M
Related
I have a problem and I don't know how to solve it.
My web application MyApp is a Maven web application project (Java 8 and Java EE 5). To run an updated version as test instance on the same server, I changed the Context Path of the application from MyApp to MyAppTest. As servlet container, I'm using Tomcat 8.
The MyApp instance is working as expected. However the MyAppTest instance is throwing an exception when forwarding the request to one of my servlets. Even if MyApp and MyAppTest are identical except the context path, this exception occurs. The Servlets are mapped via Guice's ServletModule.
Message:
java.lang.StringIndexOutOfBoundsException: String index out of range: -4
StackTrace:
java.lang.String.substring(Unknown Source)
com.google.inject.servlet.ServletDefinition$2.getPathInfo(ServletDefinition.java:212)
org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:376)
org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:318)
myapp.base.MainEntryServlet.service(MainEntryServlet.java:49)
javax.servlet.http.HttpServlet.service(HttpServlet.java:729)
com.google.inject.servlet.ServletDefinition.doServiceImpl(ServletDefinition.java:286)
com.google.inject.servlet.ServletDefinition.doService(ServletDefinition.java:276)
com.google.inject.servlet.ManagedServletPipeline$1.doServiceImpl(ManagedServletPipeline.java:154)
com.google.inject.servlet.ManagedServletPipeline$1.forward(ManagedServletPipeline.java:140)
myapp.auth.LogoutServlet.service(LogoutServlet.java:57)
javax.servlet.http.HttpServlet.service(HttpServlet.java:729)
com.google.inject.servlet.ServletDefinition.doServiceImpl(ServletDefinition.java:286)
com.google.inject.servlet.ServletDefinition.doService(ServletDefinition.java:276)
com.google.inject.servlet.ServletDefinition.service(ServletDefinition.java:181)
com.google.inject.servlet.ManagedServletPipeline.service(ManagedServletPipeline.java:91)
com.google.inject.servlet.FilterChainInvocation.doFilter(FilterChainInvocation.java:85)
com.google.inject.servlet.ManagedFilterPipeline.dispatch(ManagedFilterPipeline.java:120)
com.google.inject.servlet.GuiceFilter.doFilter(GuiceFilter.java:135)
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:240)
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:207)
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:212)
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:106)
org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:502)
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:141)
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:79)
org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:616)
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:88)
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:528)
org.apache.coyote.ajp.AbstractAjpProcessor.process(AbstractAjpProcessor.java:873)
org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:670)
org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1520)
org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.run(NioEndpoint.java:1476)
java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source) java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
java.lang.Thread.run(Unknown Source)
The Servlet forwarding the Request does this:
RequestDispatcher dispatcher = request.getRequestDispatcher("/index.jsp");
if (!response.isCommitted()) {
dispatcher.forward(request, response);
}
The URL index.jsp is mapped to another Servlet. It forwards the request to a JSP:
request.getRequestDispatcher("/theme/index.jsp").forward(request, response);
There the exception occurs. Some other JSPs are included into the index.jsp like this:
<jsp:include flush="true" page="menu.jsp"/>
The menu.jsp is located in the same folder as the index.jsp.
As mentioned before, everything works fine as long as the Context path is MyApp. When changed to MyAppTest the exception occurs. It must have something to do with the Context path itself. When changing the Path to MyAppTest, the exception message is "String index out of range: -4". When I change the Path to MyAppTesting, the exception message changes to "String index out of range: -7".
To solve this I tried the following:
Changing the Context path and the docBase to MyAppTest in the context.xml of the project.
Changing the Artifact ID of the project to MyAppTest.
Changing the Project Name to MyAppTest.
Nothing worked. And I don't know what causes the exeption: Maven, Tomcat or Guice.
I wrote a Hbase Java basic code that works fine with Java.
public class HBaseTest {
public static String newFunc() throws IOException {
// Instantiating configuration class
Configuration config = HBaseConfiguration.create();
Connection connection = ConnectionFactory.createConnection(config);
Table table = connection.getTable(TableName.valueOf("customer"));
Get g = new Get(Bytes.toBytes("jsmith"));
Result result = table.get(g);
// Reading values from Result class object
byte[] value = result.getValue(Bytes.toBytes("addr"), Bytes.toBytes("city"));
return Bytes.toString(value);
}
}
So I decided to use this code and Hbase as a part of my web application development and so I opened a new Dynamic Web Project in Eclipse Java EE IDE and added this file, changed the name of function and called it from one of the servlets. I also added the required jar files.
But I am stuck with the following error:
java.lang.ClassNotFoundException: org.apache.hadoop.hbase.HBaseConfiguration
at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1332)
at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1166)
at HBaseTest.newFunc(HBaseTest.java:18)
at BakwasServlet.doGet(BakwasServlet.java:16)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:622)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:729)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:292)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:207)
at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:240)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:207)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:212)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:106)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:502)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:141)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:79)
at org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:616)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:88)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:528)
at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1099)
at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:670)
at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1520)
at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.run(NioEndpoint.java:1476)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
at java.lang.Thread.run(Thread.java:745)
This error is frustrating me now. Has anyone encountered such a case before or can anyone help me on this? I don't have hbase_home variable set up. I didn't need it for the java code as well.
Thanks in advance!
Where have you added the HBase JAR file? It should be in the WEB-INF/lib folder of your web application (or in the server's lib folder, but it's better to keep it within the app).
i am having a problem with struts i've been working with struts with more than 4 month now
the problem is when i add a new action i get this:
the previous actions work fine but when i modify the name of the action in struts.xml i get the error i mention above.
so for example i have the following code in struts.xml
<action name="test1" class="com.onda.beans.AfficheVolList">
<result name="success">table_vols_test_css.jsp</result>
<result name="fail">admin.jsp</result>
</action>
when i enter http://localhost:8080/Myproject/test1 it works fine
but after i change the name of the action
<action name="test2" class="com.onda.beans.AfficheVolList">
<result name="success">table_vols_test_css.jsp</result>
<result name="fail">admin.jsp</result>
</action>
and i try to enter localhost:8080/Myproject/test2
i got the error in the previous image it doesn't even take me to admin.jsp
i tried to clean the server and clean work directory but nothing work i even changed the server it works for the first time but after i change the name of the action it doesn't work
here is the log
`Jun 01, 2016 12:24:58 PM org.apache.struts2.dispatcher.Dispatcher error
SEVERE: Could not find action or result
/Onda_vol/vols2
There is no Action mapped for namespace [/] and action name [vols2] associated with context path [/Onda_vol]. - [unknown location]
at com.opensymphony.xwork2.DefaultActionProxy.prepare(DefaultActionProxy.java:185)
at org.apache.struts2.impl.StrutsActionProxy.prepare(StrutsActionProxy.java:63)
at org.apache.struts2.impl.StrutsActionProxyFactory.createActionProxy(StrutsActionProxyFactory.java:37)
at com.opensymphony.xwork2.DefaultActionProxyFactory.createActionProxy(DefaultActionProxyFactory.java:58)
at org.apache.struts2.dispatcher.Dispatcher.serviceAction(Dispatcher.java:554)
at org.apache.struts2.dispatcher.ng.ExecuteOperations.executeAction(ExecuteOperations.java:81)
at org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter.doFilter(StrutsPrepareAndExecuteFilter.java:99)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:240)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:207)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:212)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:106)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:502)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:141)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:79)
at org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:616)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:88)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:522)
at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1095)
at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:672)
at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1500)
at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.run(NioEndpoint.java:1456)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
at java.lang.Thread.run(Thread.java:745)`
thank you for taking time to answer my question i really appreciate it
This is probably a problem in your Apache Tomcat server configuration.
Your struts.xml looks perfectly fine and there is no reason changing the name would break the action.
Here's a few things you could consider doing and that might solve your problem:
Restart Tomcat
Depending on your linux distro and Tomcat version, this might differ.
sudo service tomcat7 restart
Restart your computer
Delete and reinstall Tomcat
I hope this helps.
I am making a dynamic web project, which requires to use an external jar file. That jar uses several JNI so files. Now I have the jar and all the required so files. I have added the jar to the java build path, but I am not sure how to introduce the so files to the tomcat server.
I tried adding path to the so file as "LD_LIBRARY_PATH":
(Properties->Run/Debug Settings->edit->Environment->Select) and also
adding the path to "java.library.path"(Run
As->RunConfigurations->Tomcat v8 Server->Arguments->VM arguments)
flag.
Still it is not working, I am getting below error, whenever the my code is trying to access functions/classes from the above mentioned jar:
SEVERE: Servlet.service() for servlet [org.iotivity.simulator.agent.LaunchSimulator] in context with path
[/SimulatorAgent] threw exception [Servlet execution threw an
exception] with root cause java.lang.ClassNotFoundException:
org.oic.simulator.server.SimulatorResource$Type at
org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1305)
at
org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1139)
at
org.iotivity.simulator.agent.LaunchSimulator.doPost(LaunchSimulator.java:86)
at
org.iotivity.simulator.agent.LaunchSimulator.doGet(LaunchSimulator.java:45)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:622) at
javax.servlet.http.HttpServlet.service(HttpServlet.java:729) at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:292)
at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:207)
at
org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:240)
at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:207)
at
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:212)
at
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:106)
at
org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:502)
at
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:141)
at
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:79)
at
org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:616)
at
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:88)
at
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:522)
at
org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1095)
at
org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:672)
at
org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1502)
at
org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.run(NioEndpoint.java:1458)
at
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at
org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
at java.lang.Thread.run(Thread.java:745)
I have tried the same code with a simple Java Application, and it works fine by setting the LD_LIBRARY_PATH variable.
Any suggestion will be highly appreciated.
Your error is a ClassNotFoundException, which would suggest that the JAR isn't properly included. If there was a problem with the native library, you'd get a UnsatisfiedLinkError instead. To make the JAR available to Tomcat, you'd need to add it to the classpath (-classpath=/path/to/your.jar) or include it in your WAR. The latter depends on your build system, but if you use Maven it's rather easy using the maven-shade-plugin (this only works for the JAR though, the native code you'll have to keep on distributing separately). Hope that helps!
I am creating a pdf by using the following jar files:
avalon-framework-4.2.0.jar
batik-all-1.7.jar
commons-io-2.4.jar
commons-logging-1.2.jar
fop-0.9.5.jar
xml-apis-ext-1.3.04.jar
xmlgraphics-commons-1.3.1.jar
These are loaded via:
THIS.javaSettings = { LoadPaths = [ "jar/lib/" ]
, loadColdFusionClassPath=false
, reloadOnChange=true
, watchInterval=300
}
.. inside my Application cfc. When I run the code from Chrome or IE it creates the pdf just fine, but when the page is refreshed I get the below error. What's funny is it works completely fine when run from Firefox. Can anyone help with this error or explain why it is happening?
Error occurred while copying the file from source
C:/Inetpub/wwwroot/TestSite/MenuMaker/jar/lib/batik-all-1.7.jar to
C:/ColdFusion11/cfusion/tmpCache/appClasses/1512258339
Resources: Check the ColdFusion documentation to verify that you are
using the correct syntax. Search the Knowledge Base to find a solution
to your problem.
Browser: Mozilla/5.0 (Windows NT 6.0; WOW64)
AppleWebKit/537.36 (KHTML, like Gecko) Chrome/42.0.2311.135
Safari/537.36
...
java.nio.file.FileSystemException: C:\ColdFusion11\cfusion\tmpCache\appClasses\1512258339\batik-all-1.7.jar:
The process cannot access the file because it is being used by another
process.
at sun.nio.fs.WindowsException.translateToIOException(WindowsException.java:86)
at sun.nio.fs.WindowsException.rethrowAsIOException(WindowsException.java:97)
at sun.nio.fs.WindowsException.rethrowAsIOException(WindowsException.java:102)
at sun.nio.fs.WindowsFileCopy.copy(WindowsFileCopy.java:165)
at sun.nio.fs.WindowsFileSystemProvider.copy(WindowsFileSystemProvider.java:278)
at java.nio.file.Files.copy(Files.java:1274)
at coldfusion.tagext.io.FileUtils.nioCopy(FileUtils.java:1368)
at coldfusion.tagext.io.FileUtils.copyFile(FileUtils.java:1361)
at coldfusion.tagext.io.FileUtils.copyFile(FileUtils.java:1326)
at coldfusion.tagext.io.FileUtils.copy(FileUtils.java:492)
at coldfusion.runtime.AppClassLoaderHelper.handleDynamicLoading(AppClassLoaderHelper.java:380)
at coldfusion.runtime.AppClassLoaderHelper.init(AppClassLoaderHelper.java:189)
at coldfusion.filter.ApplicationFilter.invoke(ApplicationFilter.java:325)
at coldfusion.filter.RequestMonitorFilter.invoke(RequestMonitorFilter.java:42)
at coldfusion.filter.MonitoringFilter.invoke(MonitoringFilter.java:40)
at coldfusion.filter.PathFilter.invoke(PathFilter.java:142)
at coldfusion.filter.ExceptionFilter.invoke(ExceptionFilter.java:94)
at coldfusion.filter.BrowserDebugFilter.invoke(BrowserDebugFilter.java:78)
at coldfusion.filter.ClientScopePersistenceFilter.invoke(ClientScopePersistenceFilter.java:28)
at coldfusion.filter.BrowserFilter.invoke(BrowserFilter.java:38)
at coldfusion.filter.NoCacheFilter.invoke(NoCacheFilter.java:58)
at coldfusion.filter.GlobalsFilter.invoke(GlobalsFilter.java:38)
at coldfusion.filter.DatasourceFilter.invoke(DatasourceFilter.java:22)
at coldfusion.filter.CachingFilter.invoke(CachingFilter.java:62)
at coldfusion.CfmServlet.service(CfmServlet.java:219)
at coldfusion.bootstrap.BootstrapServlet.service(BootstrapServlet.java:89)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:303)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
at coldfusion.monitor.event.MonitoringServletFilter.doFilter(MonitoringServletFilter.java:42)
at coldfusion.bootstrap.BootstrapFilter.doFilter(BootstrapFilter.java:46)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
at coldfusion.inspect.weinre.MobileDeviceDomInspectionFilter.doFilter(MobileDeviceDomInspectionFilter.java:121)
at coldfusion.bootstrap.BootstrapFilter.doFilter(BootstrapFilter.java:46)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:220)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:122)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:501)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:171)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:116)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:422)
at org.apache.coyote.ajp.AjpProcessor.process(AjpProcessor.java:199)
at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:607)
at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:314)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
at java.lang.Thread.run(Thread.java:745)
It seems that Coldfusion is thinking that some or all of the jar files are being updated, why I am not sure. Changing the LoadPaths:reloadOnchange=true attribute to false fixed the issue.