First of all I am a ColdFusion developer and do not really know how Java works.
I have a situation whereby we need to integrate a Java client file into a project that is hosted by a ColdFusion 9 server, with JRun application server, and it need AXIS 2 request for Encrypt / Descrypt a SOAP content.
When we compile the Java client file into a .JAR file, we encounter a jar file compatible issue with the ColdFusion / JRun server library.
We are attempting to use a .WAR file generated via MAVEN instead of .JAR file. We have proved that the .JAR files resolved the compatibility issue and is working in the JAVA environment (jsp page).
My question :
How can I include the .WAR into my ColdFusion page? I can't find any samples or references anywhere.
Should I just place the .WAR file into the [coldfusion_server]/lib
folder and call it by using cfobject
= Java?
Like:
<cfset myObj = createObject("java", "class_path")>
Any samples or references I can review will be helpful for me.
2017-04-19 - Update -
Below is our test case and result when using JAR file created by our Java professional resource:
I deployed IBAN Client application in ColdFusion server directory (C:\JRun4\lib\IbanWs-Client.jar)
Note : This Client Application is using SOAP (AXIS2 web services) + CXF 2.7.3 + WSS4J 1.6.18.
This Client application is working as expected as in ColdFusion 2016 server and standalone application.
The same application is not working in ColdFusion 9 server and we are facing a few issues. Error logs are specified in end of the document.
ColdFusion 9 server is using older version jar while server start-up. This behavior is causing libraries mismatch issue.
Steps followed to reproduce the issue.
Deploy client application in JRun server lib directory
C:\JRun4\lib\IbanWs-Client.jar
Upgrade webservices.jar in in JRun server lib directory
C:\JRun4\lib\webservices.jar (Axis 2 soap)
a. Extract jrun\lib\webservices.jar file to a folder one.
b. Extract axis2 jar file to a folder two.
c. Copy the com folder from folder two and paste in folder one
d. Copy the javax folder from folder two and paste in folder one
e. Create the jar using folder one contents :
jar cvf webservices.jar
Developed IbanValidate.cfm file to access IBAN Services using IbanWs-Client.jar.
Copy project dependent jar files to the *C:\JRun4\lib* directory.
Calling the banWs-Client.jar by using below cfm script :
<html>
<head>
<title>Welcome to IBAN Web Application</title>
</head>
<body>
<cfobject action=create type=java class=com.tfp.ipr.soap.IBANClient name=obj>
<cfset StringVal2=obj.IbanValidate(javaCast("string","FR14200410100xxxxxxxx"))>
<cfoutput>
<br> IBAN : #StringVal2.getInstitutionDetail().getIban()#<br>
<br> Title : #StringVal2.getInstitutionDetail().getInstTitle()#<br>
<br> SWIFT/BIC : #StringVal2.getInstitutionDetail().getSwiftBic()#<br>
<br> BranchCode : #StringVal2.getInstitutionDetail().getBranchCode()#<br>
<br> Street : #StringVal2.getInstitutionDetail().getStreet()#<br>
<br> CountryCode :#StringVal2.getInstitutionDetail().getCountryCode()# <br>
</cfoutput><br>
</body>
</html>
- The CFM page return response as below :
unknown parameter type.
The error occurred in C:/project_dev/IbanValidate.cfm: line 7
5 : <body>
6 : <cfobject action=create type=java class=com.tfp.ipr.soap.IBANClient name=obj>
7 : <cfset StringVal2=obj.IbanValidate(javaCast("string","FR142004101XXXXXXXX"))>
8 :
9 : <!--- Display the results--->
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.1; Win64; x64; rv:45.0) Gecko/20100101 Firefox/45.0
Remote Address 127.0.0.1
Referrer http..xxx.com/project_dev/
Date/Time 19-Apr-17 07:53 AM
Stack Trace
at cfIbanValidate2ecfm1956923455.runPage(C:/project_dev/IbanValidate.cfm:7)
javax.xml.ws.soap.SOAPFaultException: unknown parameter type.
at org.apache.cxf.jaxws.JaxWsClientProxy.invoke(JaxWsClientProxy.java:155)
at $Proxy32.validate(Unknown Source)
at com.tfp.ipr.soap.IBANClient.IbanValidate(IBANClient.java:37)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at coldfusion.runtime.java.JavaProxy.invoke(JavaProxy.java:97)
at coldfusion.runtime.CfJspPage._invoke(CfJspPage.java:2360)
at cfIbanValidate2ecfm1956923455.runPage(C:/project_dev/IbanValidate.cfm:7)
at coldfusion.runtime.CfJspPage.invoke(CfJspPage.java:231)
at coldfusion.tagext.lang.IncludeTag.doStartTag(IncludeTag.java:416)
at coldfusion.filter.CfincludeFilter.invoke(CfincludeFilter.java:65)
at coldfusion.filter.ApplicationFilter.invoke(ApplicationFilter.java:381)
at coldfusion.filter.RequestMonitorFilter.invoke(RequestMonitorFilter.java:48)
at coldfusion.filter.MonitoringFilter.invoke(MonitoringFilter.java:40)
at coldfusion.filter.PathFilter.invoke(PathFilter.java:94)
at coldfusion.filter.LicenseFilter.invoke(LicenseFilter.java:27)
at coldfusion.filter.ExceptionFilter.invoke(ExceptionFilter.java:70)
at coldfusion.filter.BrowserDebugFilter.invoke(BrowserDebugFilter.java:79)
at coldfusion.filter.ClientScopePersistenceFilter.invoke(ClientScopePersistenceFilter.java:28)
at coldfusion.filter.BrowserFilter.invoke(BrowserFilter.java:38)
at coldfusion.filter.NoCacheFilter.invoke(NoCacheFilter.java:46)
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:200)
at coldfusion.bootstrap.BootstrapServlet.service(BootstrapServlet.java:89)
at jrun.servlet.FilterChain.doFilter(FilterChain.java:86)
at coldfusion.monitor.event.MonitoringServletFilter.doFilter(MonitoringServletFilter.java:42)
at coldfusion.bootstrap.BootstrapFilter.doFilter(BootstrapFilter.java:46)
at jrun.servlet.FilterChain.doFilter(FilterChain.java:94)
at jrun.servlet.FilterChain.service(FilterChain.java:101)
at jrun.servlet.ServletInvoker.invoke(ServletInvoker.java:106)
at jrun.servlet.JRunInvokerChain.invokeNext(JRunInvokerChain.java:42)
at jrun.servlet.JRunRequestDispatcher.invoke(JRunRequestDispatcher.java:286)
at jrun.servlet.ServletEngineService.dispatch(ServletEngineService.java:543)
at jrun.servlet.jrpp.JRunProxyService.invokeRunnable(JRunProxyService.java:203)
at jrunx.scheduler.ThreadPool$ThreadThrottle.invokeRunnable(ThreadPool.java:428)
at jrunx.scheduler.WorkerThread.run(WorkerThread.java:66)
Caused by: java.lang.IllegalArgumentException: unknown parameter type.
at org.bouncycastle.jce.provider.JCERSACipher.engineInit(Unknown Source)
at javax.crypto.Cipher.a(DashoA13*..)
at javax.crypto.Cipher.a(DashoA13*..)
at javax.crypto.Cipher.init(DashoA13*..)
at javax.crypto.Cipher.init(DashoA13*..)
at org.apache.ws.security.message.WSSecEncryptedKey.prepareInternal(WSSecEncryptedKey.java:257)
at org.apache.ws.security.message.WSSecEncrypt.prepare(WSSecEncrypt.java:182)
at org.apache.cxf.ws.security.wss4j.policyhandlers.AsymmetricBindingHandler.doEncryption(AsymmetricBindingHandler.java:420)
at org.apache.cxf.ws.security.wss4j.policyhandlers.AsymmetricBindingHandler.doSignBeforeEncrypt(AsymmetricBindingHandler.java:190)
at org.apache.cxf.ws.security.wss4j.policyhandlers.AsymmetricBindingHandler.handleBinding(AsymmetricBindingHandler.java:98)
at org.apache.cxf.ws.security.wss4j.PolicyBasedWSS4JOutInterceptor$PolicyBasedWSS4JOutInterceptorInternal.handleMessage(PolicyBasedWSS4JOutInterceptor.java:165)
at org.apache.cxf.ws.security.wss4j.PolicyBasedWSS4JOutInterceptor$PolicyBasedWSS4JOutInterceptorInternal.handleMessage(PolicyBasedWSS4JOutInterceptor.java:89)
at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:271)
at org.apache.cxf.endpoint.ClientImpl.doInvoke(ClientImpl.java:530)
at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:463)
at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:366)
at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:319)
at org.apache.cxf.frontend.ClientProxy.invokeSync(ClientProxy.java:96)
at org.apache.cxf.jaxws.JaxWsClientProxy.invoke(JaxWsClientProxy.java:133)
... 39 more
Appreciate anyone can help me to resolve this issue.
Thank and have a nice day.