How to include war file instead of jar file

First of all, I'm a ColdFusion developer and don’t know how Java works.

I have a situation where we need to integrate a Java client file into a project hosted by ColdFusion 9 server with a JRun application server, and it needs an AXIS 2 request to encrypt / decrypt SOAP content.

When we compile the Java client file into a .JAR file , we encounter a jar file compatibility problem with the ColdFusion / JRun server library.

We are trying to use a .WAR file created using MAVEN instead of a .JAR file. We have proven that .JAR files fix the compatibility issue and work in the JAVA environment (jsp page).

My question is:
How do I include .WAR in my ColdFusion page? I can not find any samples or links anywhere.

Should I just put the .WAR file in a folder [coldfusion_server]/liband call it using cfobject= Java?

how

<cfset myObj = createObject("java", "class_path")>

Any examples or links that I can view will be helpful to me.


2017-04-19 - Update -

Below is our test case and the result when using the JAR file created by our professional Java resource:

I deployed the IBAN Client application in the ColdFusion server directory (C: \ JRun4 \ lib \ IbanWs-Client.jar)

Note. This client application uses SOAP (AXIS2 Web Services) + CXF 2.7.3 + WSS4J 1.6.18.

, , ColdFusion 2016 .

ColdFusion 9, . .

ColdFusion 9 . .

, .

  • Linux JRun

    C:\JRun4\Lib\IbanWs-Client.jar

  • webservices.jar JRun

    C:\JRun4\lib\webservices.jar( Axis 2)

    . jrun\lib\webservices.jar .

    . jar 2 .

    . com 2 1

    . javax

    . , :

 jar cvf webservices.jar
Hide result
  1. IbanValidate.cfm IBAN, IbanWs-Client.jar.

  2. jar, , * C:\JRun4\lib *.

  3. banWs-Client.jar, 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>
Hide result
  1. CFM-, :

 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
Hide result

, - .

, .

+4

Source: https://habr.com/ru/post/1675043/


All Articles