Incompatible argument to function

Hello -

I am attempting to instantiate some of the Aspose Email classes. It is running under ColdFusion. We are using the aspose-email-1.2.0-jdk15 jar.

If I attempt to create the object directly, i.e. using ColdFusion with the aspose lib in the classpath:

<cfset MailMessageFile = createObject(“java”,“com.aspose.email.MailMessage”).init()>

it errors and the java log shows the following:

“Error”,“jrpp-28”,“05/11/12”,“05:31:30”,"(class: com/aspose/email/MailMessage, method: loadFromTnef signature: (Ljava/lang/String;)Lcom/aspose/email/MailMessage;) Incompatible argument to function The specific sequence of files included or processed is: D:\test\testEmail.cfm’’"

This is true of MapiMessage and MapiMessageFlags as well.

If I use a JavaLoader pointing to /aspose/lib to specifically create the objects, it works fine; however that won’t be an option in our production environment.

My understanding is that this specific error "can be the result when you have compiled against a different library than you are using at runtime."

But I am not sure how that can be the case. Do you have any pointers?

Thank you.

Hi Chris Polka


Thank you very much for using Aspose.Email for Java library in your project.

I would like to request you to please verify the same issue using latest Aspose.Email for Java 1.7.0 namespace and if still problem persists then we will further investigate the issue and try to resolve it as soon as possible.

I regret the inconvenience caused to you.

Best Regards

Thanks for helping look into the issue.

If I run the 1.7.0 version, both the aspose-email-1.7.0-jdk14 and aspose-email-1.7.0-jdk16, I get a similar message in the error log.

“Error”,“jrpp-1”,“05/11/12”,“09:14:34”,"(class: com/aspose/email/MailMessage, method: validateMessage signature: (Ljava/lang/String;)Lcom/aspose/email/EmlValidationErrorCollection;) Incompatible argument to function The specific sequence of files included or processed is: d:\test\testEmail.cfm’’

Perhaps here is a clue. Using the aspose-email-1.7.0-jdk14 version, I am able to use the dynamic class loader to instantiate these classes. Using the JDK1.6 version I am not (I get a can not instantiate abstract class’ error).

So basically:
<!–[if gte mso 9]>
<w:WordDocument>
<w:View>Normal</w:View>
<w:Zoom>0</w:Zoom>
<w:TrackMoves/>
<w:TrackFormatting/>
<w:PunctuationKerning/>
<w:ValidateAgainstSchemas/>
<w:SaveIfXMLInvalid>false</w:SaveIfXMLInvalid>
<w:IgnoreMixedContent>false</w:IgnoreMixedContent>
<w:AlwaysShowPlaceholderText>false</w:AlwaysShowPlaceholderText>
<w:DoNotPromoteQF/>
<w:LidThemeOther>EN-US</w:LidThemeOther>
<w:LidThemeAsian>X-NONE</w:LidThemeAsian>
<w:LidThemeComplexScript>X-NONE</w:LidThemeComplexScript>
<w:Compatibility>
<w:BreakWrappedTables/>
<w:SnapToGridInCell/>
<w:WrapTextWithPunct/>
<w:UseAsianBreakRules/>
<w:DontGrowAutofit/>
<w:SplitPgBreakAndParaMark/>
<w:DontVertAlignCellWithSp/>
<w:DontBreakConstrainedForcedTables/>
<w:DontVertAlignInTxbx/>
<w:Word11KerningPairs/>
<w:CachedColBalance/>
</w:Compatibility>
<w:DoNotOptimizeForBrowser/>
<m:mathPr>
<m:mathFont m:val=“Cambria Math”/>
<m:brkBin m:val=“before”/>
<m:brkBinSub m:val="–"/>
<m:smallFrac m:val=“off”/>
<m:dispDef/>
<m:lMargin m:val=“0”/>
<m:rMargin m:val=“0”/>
<m:defJc m:val=“centerGroup”/>
<m:wrapIndent m:val=“1440”/>
<m:intLim m:val=“subSup”/>
<m:naryLim m:val=“undOvr”/>
</m:mathPr></w:WordDocument>
<![endif]–><!–[if gte mso 10]> /* Style Definitions */ table.MsoNormalTable {mso-style-name:"Table Normal"; mso-tstyle-rowband-size:0; mso-tstyle-colband-size:0; mso-style-noshow:yes; mso-style-priority:99; mso-style-qformat:yes; mso-style-parent:""; mso-padding-alt:0in 5.4pt 0in 5.4pt; mso-para-margin:0in; mso-para-margin-bottom:.0001pt; mso-pagination:widow-orphan; font-size:11.0pt; font-family:"Calibri","sans-serif"; mso-ascii-font-family:Calibri; mso-ascii-theme-font:minor-latin; mso-fareast-font-family:"Times New Roman"; mso-fareast-theme-font:minor-fareast; mso-hansi-font-family:Calibri; mso-hansi-theme-font:minor-latin; mso-bidi-font-family:"Times New Roman"; mso-bidi-theme-font:minor-bidi;} table.MsoTableGrid {mso-style-name:"Table Grid"; mso-tstyle-rowband-size:0; mso-tstyle-colband-size:0; mso-style-priority:59; mso-style-unhide:no; border:solid windowtext 1.0pt; mso-border-alt:solid windowtext .5pt; mso-padding-alt:0in 5.4pt 0in 5.4pt; mso-border-insideh:.5pt solid windowtext; mso-border-insidev:.5pt solid windowtext; mso-para-margin:0in; mso-para-margin-bottom:.0001pt; mso-pagination:widow-orphan; font-size:11.0pt; font-family:"Calibri","sans-serif"; mso-ascii-font-family:Calibri; mso-ascii-theme-font:minor-latin; mso-hansi-font-family:Calibri; mso-hansi-theme-font:minor-latin; mso-bidi-font-family:"Times New Roman"; mso-bidi-theme-font:minor-bidi;}

<![endif]–>

Version

Create object using createObject()?


Create object using dynamic class loader?

aspose-email-1.2.0-jdk15.jar

NO


YES

aspose-email-1.7.0-jdk14.jar

NO


YES

aspose-email-1.7.0-jdk16.jar

NO


NO



So far, only the class files compiled under JDK 1.5 work for us, and only by using a dynamic class loader. Perhaps 1.7.0 can be compiled under 1.5 as well? Or maybe there is a conflict with another class on the server. I just have a hard time telling which class it might be.

Thank you again.

After analyzing the messages and the way the classloader was loading our files, it seemed like something in our combination of Aspose .jar files was conflicting.

Perhaps there were multiple classes with the same name or something across the Aspose lib folder. We have the Aspose.Total license, and generally try to upgrade components as you release them. But sometimes, the new components have changes that our code isn’t compatible with. As a result, we have a mix of Aspose jars in our folder - only one of each component, but not necessarily the newest.

We restored the .jars that we had previously, and now all the classes work both using createObject() as well as the dynamic class loader.

Here is the combination of jar files that works:

aspose.pdf-3.0.1.jdk16.jar
aspose.slides-2.7.0.jar
Aspose.Total.Java.lic
Aspose.Words.jdk16.jar
aspose-barcode-2.7.0.jar
aspose-cells-7.0.3.jar
aspose-email-1.2.0-jdk15.jar
aspose-metafiles-1.7.1.jar
aspose-pdf-kit-4.0.0.jar
bcprov-jdk16-146.jar
dom4j-1.6.1.jar
jsr173_1.0_api.jar
log4j-1.2.16.jar
servlet.jar
stax2-api-3.0.2.jar
woodstox-core-asl-4.1.1.jar

Here is the combination that did not work with aspose.Email.
aspose.pdf-3.1.jdk16.jar
aspose.slides-2.9.1.jar
Aspose.Total.Java.lic
Aspose.Words.jdk16.jar
aspose-barcode-4.4.1-jdk15.jar
aspose-cells-7.1.2.jar
aspose-email-1.2.0-jdk15.jar
aspose-metafiles-1.7.1.jar
aspose-ocr-1.1.0.jar
aspose-pdf-kit-4.2.0.jar
bcprov-jdk16-146.jar
dom4j-1.6.1.jar
jsr173_1.0_api.jar
log4j-1.2.16.jar
servlet.jar
stax2-api-3.0.2.jar
woodstox-core-asl-4.1.1.jar

Is there a way to determine inter-dependencies or possible class name conflicts between aspose jar files?

Thank you again.

Hi Chris Polka


First of all my sincere apologies for delayed response due to weekend. I would like to appreciate your precious feedback and analysis results.

We are working on it to reproduce the problem at our end with the help of information you have provided to us so far.

Moreover it seems that the issue also involves other Aspose products as well. So the best forum to discuss customer issue is Aspose.Total where other experts of Aspose products can also share their thoughts. For further investigation and analysis I am moving the thread to Aspose.Total forum due to the reason said above.

Best Regards

Hi Chris Polka


I would like to inform you that we are working on this issue and with due respect I request you to provide few more information as given below:

(1) Which development environment is used?
(2) How the ColdFusion is integrated in the environment?
(3) Which OS is used?

A small (but complete) sample project where this exception is raised is required so that we may proceed and sort out the issue as soon as possible.

I regret any inconvenience caused to you.

Best Regards and thanks for your patience.

Hi,

Thanks for your posting and using Aspose.Total.

After looking into your issue, I found, you are facing issue because of similar classes. So in order to avoid the conflict please use full namespacing.

As an example, License class exists in almost all components. If you will use License class without full namespacing, conflicts will occur.

So you should use License class of Aspose.Cells like this

Java


com.aspose.cells.License lic = new com.aspose.cells.License();


and for Aspose.Slides, you will use like this

Java
com.aspose.slides.License lic2 = new com.aspose.cells.License();

If you are still unable to resolve your problem after using full namespacing, then please follow the Sajjad Post to help us proceed further.

Hi - Thank you for looking deeper into the issue.

We do use the individual component license classes (see code sample below).



To answer your questions:

  1. We use ColdFusion 9 as a development environment on JRUN with

     		Java version 1.6.0_14.<br>
    
  2. Cold Fusion is the primary development environment. We invoke Aspose class files using createObject() in ColdFusion.

  3. The OS is Windows Server 2008 R2.





    With the aspose libraries included in the ColdFusion Java classpath,
    here is a full sample set of code (we are using the full path for the
    License class):



    <cfset emailLicense = createObject(“java”,“com.aspose.email.License”).init()>



    <cfset emailLicense.setLicense(licenseFile)>

    <cfset MailMessageFile = createObject(“java”,“com.aspose.email.MailMessage”).init()>
    which will result in the error message.

    Again please note this only occurs with the combination of aspose jar files presented above. We currently have a combination that works and have not yet narrowed the issue down to a specific component (but plan on doing so).

    Thank you.


Hi,

As a side note, could you please modify this line and try again.



into


I changed the license line as above and the result is the same.

When I restored this set of aspose jar files and restarted the server, it worked again:

aspose.pdf-3.0.1.jdk16.jar
aspose.slides-2.7.0.jar
Aspose.Total.Java.lic
Aspose.Words.jdk16.jar
aspose-barcode-2.7.0.jar
aspose-cells-7.0.3.jar
aspose-email-1.2.0-jdk15.jar
aspose-metafiles-1.7.1.jar
aspose-pdf-kit-4.0.0.jar
bcprov-jdk16-146.jar
dom4j-1.6.1.jar
jsr173_1.0_api.jar
log4j-1.2.16.jar
servlet.jar
stax2-api-3.0.2.jar
woodstox-core-asl-4.1.1.jar

So it does still seem to be that specific combination of component versions as shown above.

The more specific dump of the error is as follows:

“Error”,“jrpp-1”,“05/14/12”,“12:50:53”,"(class: com/aspose/email/MailMessage, method: loadFromTnef signature: (Ljava/lang/String;)Lcom/aspose/email/MailMessage;) Incompatible argument to function The specific sequence of files included or processed is: C:\chris\testEmail.cfm’’ "
java.lang.VerifyError: (class: com/aspose/email/MailMessage, method: loadFromTnef signature: (Ljava/lang/String;)Lcom/aspose/email/MailMessage;) Incompatible argument to function
at java.lang.Class.getDeclaredFields0(Native Method)
at java.lang.Class.privateGetDeclaredFields(Class.java:2291)
at java.lang.Class.privateGetPublicFields(Class.java:2324)
at java.lang.Class.getFields(Class.java:1359)
at coldfusion.runtime.java.ObjectHandler.Initialize(ObjectHandler.java:35)
at coldfusion.runtime.java.ObjectHandler.(ObjectHandler.java:30)
at coldfusion.runtime.java.ReflectionCache$1.fetch(ReflectionCache.java:29)
at coldfusion.util.SoftCache.get_statsOff(SoftCache.java:133)
at coldfusion.util.SoftCache.get(SoftCache.java:81)
at coldfusion.runtime.java.ReflectionCache.get(ReflectionCache.java:36)
at coldfusion.runtime.java.JavaProxy.(JavaProxy.java:35)
at coldfusion.runtime.java.JavaProxyFactory.getProxy(JavaProxyFactory.java:89)
at coldfusion.runtime.ProxyFactory.getProxy(ProxyFactory.java:65)
at coldfusion.runtime.CFPage.createObjectProxy(CFPage.java:4949)
at coldfusion.runtime.CFPage.CreateObject(CFPage.java:4920)
at coldfusion.runtime.CFPage.CreateObject(CFPage.java:4861)
at coldfusion.runtime.CFPage.CreateObject(CFPage.java:4839)
at coldfusion.runtime.CFPage.CreateObject(CFPage.java:4796)
at cftestEmail2ecfm2056600885.runPage(C:\chris\testEmail.cfm:44)
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:363)
at coldfusion.filter.RequestMonitorFilter.invoke(RequestMonitorFilter.java:48)
at coldfusion.filter.MonitoringFilter.invoke(MonitoringFilter.java:40)
at coldfusion.filter.PathFilter.invoke(PathFilter.java:87)
at coldfusion.filter.ExceptionFilter.invoke(ExceptionFilter.java:70)
at coldfusion.filter.BrowserDebugFilter.invoke(BrowserDebugFilter.java:74)
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:53)
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)

Hi,

It seems you are right, the issue might be because of conflicts between different libraries as you say specific combinations could work while others fail.

Could you please drill down this issue further and let us know your findings?

Also, we will log this issue under Aspose.Email since your code specifically deals with Aspose.Email and the exception says the same.

Hi Chris Polka


I regret any inconvenience caused to you.

Can you please send me set of all directives where you are including all your libraries along with the root directory structure of your website showing organization of all Aspose.Email for Java jar files. I don’t need any extra directories information of your web site, and just need to know the organization of Aspose jar files.

Thanks in advance.

Best Regards

Thank you - I have sent the information in a PM.

Hi Chris Polka


First of all my sincere apology for inconvenience caused to you.

Your issue is under consideration yet and now to raise the forum I have raised a ticket NETWRKJAVA-33146 to our experts for detailed analysis and providing some solution for it. As soon as I get some feedback from my developers, it will be notified to you immediately.

Thanks again for you patience and understanding.

Best Regards

Hi Chris,


I am representative of Aspose.Words team.

I suppose you’re using two different versions of Aspose.Words’ class library in each of the two combinations (one that works and the one which doesn’t). If this is found to be the case, could you please share here the versions of Aspose.Words JARs you used during testing both of the combinations.

Moreover, you can determine Aspose.Words JAR version by unziping ‘Aspose.Words.jdk16.jar’ file. Please navigate to ‘META-INF’ folder and then open ‘MANIFEST.MF’ with Notepad. There you’ll find something like below:

Manifest-Version: 1.0
Specification-Title: Aspose.Words for Java
Specification-Version: 11.5.0.0
Specification-Vendor: Aspose Pty Ltd
Implementation-Title: Aspose.Words for Java
Implementation-Version: 11.5.0.0
Implementation-Vendor: Aspose Pty Ltd
Release-Date: 2012.06.30

Best Regards,

Hello. Thank you for your reply.

I indicated in post 382200 (above) the combination that worked and the combination that did not work in this scenario. While several components differed between testing scenarios, please note that Aspose.Words was not one of them. In both scenarios, we used Aspose.Words.jdk16.jar.

In regards to the specification version, I see the following:

Manifest-Version: 1.0
Specification-Title: Aspose.Words for Java
Specification-Version: 10.7.0.0
Specification-Vendor: Aspose Pty Ltd
Implementation-Title: Aspose.Words for Java
Implementation-Version: 10.7.0.0
Implementation-Vendor: Aspose Pty Ltd
Release-Date: 2011.11.30



Thank you

Hi
Chris,


Thanks for the additional information. Unlike other Aspose products, the name of the Aspose.Words’ library (JAR file) doesn’t contain a version number. So, you can’t determine the version number by just looking at the name of the JAR file.
Chris:
Manifest-Version: 1.0
Specification-Title: Aspose.Words for Java
Specification-Version: 10.7.0.0
Specification-Vendor: Aspose Pty Ltd
Implementation-Title: Aspose.Words for Java
Implementation-Version: 10.7.0.0
Implementation-Vendor: Aspose Pty Ltd
Release-Date: 2011.11.30
Here, you can see, the actual version of the Aspose.Words component is 10.7.0.0. Moreover, I am expecting the following version numbers of Aspose.Words class library from your side.
Chris:
Here is the combination of jar files that works:

aspose.pdf-3.0.1.jdk16.jar
aspose.slides-2.7.0.jar
Aspose.Total.Java.lic
Aspose.Words.jdk16.jar <= Please determine & provide the version of this JAR file
aspose-barcode-2.7.0.jar
aspose-cells-7.0.3.jar
aspose-email-1.2.0-jdk15.jar
aspose-metafiles-1.7.1.jar
aspose-pdf-kit-4.0.0.jar
bcprov-jdk16-146.jar
dom4j-1.6.1.jar
jsr173_1.0_api.jar
log4j-1.2.16.jar
servlet.jar
stax2-api-3.0.2.jar
woodstox-core-asl-4.1.1.jar
Chris:
Here is the combination that did not work with aspose.Email.

aspose.pdf-3.1.jdk16.jar
aspose.slides-2.9.1.jar
Aspose.Total.Java.lic
Aspose.Words.jdk16.jar <= Please determine & provide the version of this JAR file as well
aspose-barcode-4.4.1-jdk15.jar
aspose-cells-7.1.2.jar
aspose-email-1.2.0-jdk15.jar
aspose-metafiles-1.7.1.jar
aspose-ocr-1.1.0.jar
aspose-pdf-kit-4.2.0.jar
bcprov-jdk16-146.jar
dom4j-1.6.1.jar
jsr173_1.0_api.jar
log4j-1.2.16.jar
servlet.jar
stax2-api-3.0.2.jar
woodstox-core-asl-4.1.1.jar

Best Regards,

Hello - please note that in the above example, both versions (both the “working” and the “non working”) had the same information in the manifest file, specification version 10.7.0.0.

Hi Chris,


Thank you for your feedback.

We always encourage our customers to use the latest release versions of Aspose.Words as it contains newly introduced features, enhancements and fixes for issues reported earlier. Could you please also download and use the latest version of Aspose.Words for Java (i.e. v11.5.0) and let us know how it goes with both of your scenarios on your side? You can download the latest version of Aspose.Words for Java from the following link:
https://releases.aspose.com/

Best Regards,

Hello. Of course we try to use the latest versions of all software if possible (we subscribe to Aspose.Total and use most of the components). There are times, however, when the next version of a component contains changes that cause our production code not to work. This was particularly noticeable with Aspose.Email; therefore deploying a new version of any component has to wait until we can fully test the new version and fix any problems that it causes. Being a small shop, we can not dedicate time to upgrading every component as it becomes available.

If you believe that the version of Words is the cause of this issue with Aspose.Email, then we will certainly make that the next upgrade we test and deploy.