“I am feeling privileged to write a blog on an issue which troubled me on one of my favorite topics “MAP” in BizTalk. If you face the same issue and my resolution does not help, please drop a comment and I will try to help you in troubleshooting depending on my availability and bandwidth.”
Recently I was working on a BizTalk map issue, in which I was getting the below error:
Event Type: Error
Event Source: MyApp
Event Category: None
Event ID: 0
Date: 12/14/2011
Time: 3:13:03 PM
User: N/A
Computer: MyServer
Description:
Exception: In MyApp.odx ---> Message:[Error encountered while executing the transform MyApp. mapInvoic. Error:Unable to create the transform..];
Source:[Microsoft.XLANGs.Engine];
StackTrace:[ at Microsoft.XLANGs.Core.Service.ApplyTransform(Type mapRef, Object[] outParams, Object[] inParams)
at MYApp.Orchestrations.myOrch.segment2(StopConditions stopOn)
at Microsoft.XLANGs.Core.SegmentScheduler.RunASegment(Segment s, StopConditions stopCond, Exception& exp)];
InnerException:[System.ArgumentNullException: Value cannot be null.
Event Source: MyApp
Event Category: None
Event ID: 0
Date: 12/14/2011
Time: 3:13:03 PM
User: N/A
Computer: MyServer
Description:
Exception: In MyApp.odx ---> Message:[Error encountered while executing the transform MyApp. mapInvoic. Error:Unable to create the transform..];
Source:[Microsoft.XLANGs.Engine];
StackTrace:[ at Microsoft.XLANGs.Core.Service.ApplyTransform(Type mapRef, Object[] outParams, Object[] inParams)
at MYApp.Orchestrations.myOrch.segment2(StopConditions stopOn)
at Microsoft.XLANGs.Core.SegmentScheduler.RunASegment(Segment s, StopConditions stopCond, Exception& exp)];
InnerException:[System.ArgumentNullException: Value cannot be null.
Parameter name: extension
at System.Xml.Xsl.XsltArgumentList.AddExtensionObject(String namespaceUri, Object extension)
at Microsoft.XLANGs.BaseTypes.TransformBase.get_TransformArgs()
at Microsoft.XLANGs.RuntimeTypes.TransformMetaData..ctor(Type transformBaseType)
at Microsoft.XLANGs.RuntimeTypes.TransformMetaData._creator(Type t)
at Microsoft.XLANGs.RuntimeTypes.MetadataCache._slowFor(Type t)
at Microsoft.XLANGs.RuntimeTypes.MetadataCache.For(Type t)
at Microsoft.XLANGs.RuntimeTypes.TransformMetaData.For(Type t)
at Microsoft.XLANGs.Core.Service.ApplyTransform(Type mapRef, Object[] outParams, Object[] inParams)];
For more information, see Help and Support Center at http://go.microsoft.com/fwlink/events.asp.
at Microsoft.XLANGs.BaseTypes.TransformBase.get_TransformArgs()
at Microsoft.XLANGs.RuntimeTypes.TransformMetaData..ctor(Type transformBaseType)
at Microsoft.XLANGs.RuntimeTypes.TransformMetaData._creator(Type t)
at Microsoft.XLANGs.RuntimeTypes.MetadataCache._slowFor(Type t)
at Microsoft.XLANGs.RuntimeTypes.MetadataCache.For(Type t)
at Microsoft.XLANGs.RuntimeTypes.TransformMetaData.For(Type t)
at Microsoft.XLANGs.Core.Service.ApplyTransform(Type mapRef, Object[] outParams, Object[] inParams)];
For more information, see Help and Support Center at http://go.microsoft.com/fwlink/events.asp.
The pain was the application was getting the executed successfully in my development environment ? (as happen with most of the developer) but failing in the QA environment.
Application Details:
File based receive Port -> Orchestration(consisting of Map) -> File based Send Port.
Troubleshooting Steps:
No, class is not so big as described at jboss. Class added to PrepareForTest annotation is final and extends another abstract class which extends HttpServlet class, then finally it implements one interface. Hey, I've created a sample project based on your example here and now I'm getting the above mentioned exception every time I try to run my test (HelloWorldSteps.java). I would greatly appreciate it if you could tell me what I'm doing wro.
1)I tested the failed file in my dev environment and as expected it worked without any issue.
2)I created a Receive Send port pair in admin console in QA( to isolate the issue). Used the map at the receive port and dropped the same file. This time I got the different error.
2)I created a Receive Send port pair in admin console in QA( to isolate the issue). Used the map at the receive port and dropped the same file. This time I got the different error.
A message received by adapter 'FILE' on receive location 'Receive Location2' with URI 'MyServerMap ErrorI*.xml' is suspended.
Error details: Object reference not set to an instance of an object.
MessageId: {75731D85-BFC2-4356-8F24-CC1135A107A6}
InstanceID: {8DF62EAD-23FA-4792-9601-6DF92B721C1A}
MessageId: {75731D85-BFC2-4356-8F24-CC1135A107A6}
InstanceID: {8DF62EAD-23FA-4792-9601-6DF92B721C1A}
I was surprised to see this error ? as this is completely different from the main issue.
3)I tested the same file in Visual Studio by doing the test map. I got the same error which I was getting at run time. This was the snippet of the OutPut of test map.
MyServerBizTalkTestingmapInvoic.btm : error btm1010: The 'Scripting' functoid has 1 input parameter(s), but 0 parameter(s) are expected.
MyServerBizTalkTestingmapInvoic.btm: error btm1010: The 'Scripting' functoid has 1 input parameter(s), but 0 parameter(s) are expected.
MyServerBizTalkTestingmapInvoic.btm : error btm1010: The 'Scripting' functoid has 1 input parameter(s), but 0 parameter(s) are expected.
MyServerBizTalkTestingmapInvoic.btm: error btm1010: The 'Scripting' functoid has 1 input parameter(s), but 0 parameter(s) are expected.
TestMap used the following file: <file:/// MyServerBizTalkTesting0000023672_16130380.xml> as input to the map.
MyServerBizTalkTestingmapInvoic.btm: error btm1050: XSL transform error: Unable to write output instance to the following <file:///C:UsersMyServerAppDataLocalTemp_MapDataBizTalkTesting mapInvoic _output.xml>. Value cannot be null.
MyServerBizTalkTestingmapInvoic.btm: error btm1010: The 'Scripting' functoid has 1 input parameter(s), but 0 parameter(s) are expected.
MyServerBizTalkTestingmapInvoic.btm : error btm1010: The 'Scripting' functoid has 1 input parameter(s), but 0 parameter(s) are expected.
MyServerBizTalkTestingmapInvoic.btm: error btm1010: The 'Scripting' functoid has 1 input parameter(s), but 0 parameter(s) are expected.
TestMap used the following file: <file:/// MyServerBizTalkTesting0000023672_16130380.xml> as input to the map.
MyServerBizTalkTestingmapInvoic.btm: error btm1050: XSL transform error: Unable to write output instance to the following <file:///C:UsersMyServerAppDataLocalTemp_MapDataBizTalkTesting mapInvoic _output.xml>. Value cannot be null.
Parameter name: extension
Test Map failure for map file <fileMyServerBizTalkTestingmapInvoic.btm >. The output is stored in the following file: file:///C:UsersMyServerAppDataLocalTemp_MapDataBizTalkTestingmapInvoic_output.xml
Component invocation succeeded.
Component invocation succeeded.
4)I thought to make use of the Debug Map option(though I do not know how to debug xslt ? ), I started Debugging the map and got an error which was more clear
Cannot find a script or an extension object associated with namespace 'http://schemas.microsoft.com/BizTalk/2003/ScriptNS0'.
The line of Map on which it was failing was pointing to the function name(MyFunction) of my class library.
Now I got the hint, that it is something to do with the dll mismatch which developer is famous to do.( As a general fact, everything works on development environment ? )
I went to the QA machine open the dll which I was using in the map as an external assembly to scripting functoid. I compared the date time stamp for the dll in both environments. TO my luck it was different.
Without any further delay, I took the dll from the GAC of the Dev machine and put it on the QA machine GAC. Tested the same file and it worked.
For my curiosity I used the reflector to get the code for both version of dll, and as expected MyFunction was not there in the dll of the QA environment.
Now I got the hint, that it is something to do with the dll mismatch which developer is famous to do.( As a general fact, everything works on development environment ? )
I went to the QA machine open the dll which I was using in the map as an external assembly to scripting functoid. I compared the date time stamp for the dll in both environments. TO my luck it was different.
Without any further delay, I took the dll from the GAC of the Dev machine and put it on the QA machine GAC. Tested the same file and it worked.
For my curiosity I used the reflector to get the code for both version of dll, and as expected MyFunction was not there in the dll of the QA environment.
Lesson Learnt:
1)For any mapping issue, use Visual Studio Test Map And Debug Map to get the exact error.
2)If we use external assembly in the scripting fucntiod MAP create an Extension Object file to keep the Details of the dl being referenced in the scripting functoid.
2)If we use external assembly in the scripting fucntiod MAP create an Extension Object file to keep the Details of the dl being referenced in the scripting functoid.
The snippet of the xml file will be like this and you will get this file if you do validate Map in the Visual Studio.
<ExtensionObjects>
<ExtensionObject Namespace='http://schemas.microsoft.com/BizTalk/2003/ScriptNS0' AssemblyName='Library, Version=1.1.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' ClassName='Library.Data' />
<ExtensionObject Namespace='http://schemas.microsoft.com/BizTalk/2003/ScriptNS1' AssemblyName='Microsoft.BizTalk.BaseFunctoids, Version=3.0.1.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' ClassName='Microsoft.BizTalk.BaseFunctoids.FunctoidScripts' />
</ExtensionObjects>
<ExtensionObject Namespace='http://schemas.microsoft.com/BizTalk/2003/ScriptNS0' AssemblyName='Library, Version=1.1.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' ClassName='Library.Data' />
<ExtensionObject Namespace='http://schemas.microsoft.com/BizTalk/2003/ScriptNS1' AssemblyName='Microsoft.BizTalk.BaseFunctoids, Version=3.0.1.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' ClassName='Microsoft.BizTalk.BaseFunctoids.FunctoidScripts' />
</ExtensionObjects>
Written by:
Deepak Sanghi
Reviewed By:
Shailesh Agre
Deepak Sanghi
Reviewed By:
Shailesh Agre
Microsoft GTSC.
Description:
I am trying to test a static method from a class. I am using powerMock (1.6.2) + mockito (1.10.19) for mocking along with Junit4 (4.12) & java8.
Issue:
Getting the error: 'Failed to transform class with name com.gs.ops.domain.StaticClass Reason: java.io.IOException: invalid constant type: 18'
Solutions Tried:
- Googled threads for issue on with powermock - mockito & java-8
- Excluded java assist from powermock and added java assist 3.19.0-GA
- Tried different versions of powermock (1.5.4, 1.6.2...)
Below is the exception stack trace:
Pom file:
Lucky1989Lucky1989
7 Answers
Powermock 1.6.3 uses javassist 3.15.2-GA which does not support certain types. Using 3.18.2-GA javassist worked for me. You may want to override dependency in your project.
You may face another problem for which the solution lies here Mockito + PowerMock LinkageError while mocking system class
Hope this helps.
JDevJDev
So there seems to be issue with
javassist
(bytecode toolkit) prior to 3.18.2
, as there's a resolved JIRA ticket-223. 1 - To find javassist version in your pom.xml, can use
mvn dependency
taskwhich is used by the
powermock-module-junit4-rule
,2 - So, updating the
javassist
version by explicitly to any versions >= 3.18.2
should work.As, in my case, I am using use
3.20.0-GA
Working eg. with
scalatest
prayagupdprayagupd
This is caused because of the conflict of dependencies. Resolving the dependency conflicts is one way to resolve this issue and the other way is to reorder
<dependency></dependency>
elements in your pom.xml. Move the powermock dependency declarations to the top of the <dependencies></dependencies>
section. This is a complete hack and the right way to resolve it would be to resolve the dependency conflicts.To identify those conflict you may use the command 'mvn dependency:tree'. Here is the dependency tree for my application for which I came across this same problem. Notice that there are two dependencies of 'javassist' in the tree.
I hope this helps.
Swarup DonepudiSwarup Donepudi
In my case, a 'java.io.IOException: invalid constant type: 18' was caused by multiple versions of javassist libraries in my classpath - both 3.12.1.GA and 3.18.2-GA. The problem disappeared when i removed the older one.
k6psk6ps
Not really an answer! I got a similar error when running a Maven build with JDK8 and generating Java6 byte code. My pom looks like this:
When I reverted to JDK6 I no longer got the error.
CodeClimberCodeClimber
In my case JRE System Library --> Execution Environment was set up on JavaSE-1.7, but the only installed JRE was JRE1.8. So it was pointing to java 8 in place of java 7. Once I moved to java 7 it start working fine for me.
Amit GargAmit Garg
This issue is related to a compatibility issue with Java 8. could you execute your tests on java 7 ?
AguidAguid