cancel
Showing results for 
Search instead for 
Did you mean: 

Imported Archive Class Conflicts

Former Member
0 Kudos

I am using a JAVA user defined function within a message mapping.

The JAVA function class requires classes in two reference libraries org.apache.commons.collections and org.apache.commons.beanutils.

When I try to import these two jar files as archives, there are some classes which exist in both libraries and the import fails.

I'm new to JAVA, is there anything that can be done to resolve this conflict and let me load both libraries as archives ?

Thanks

Accepted Solutions (1)

Accepted Solutions (1)

Ryan-Crosby
Active Contributor
0 Kudos

Hi Paul,

It sounds like you might have the wrong version of the beanutils package. See below for information I pulled from the apache website:

Since the 1.7.0 release BeanUtils has distributed three jars:

u2022commons-beanutils.jar - contains everything <------- You probably have this one

u2022commons-beanutils-core.jar - excludes Bean Collections classes <------- You want this one

u2022commons-beanutils-bean-collections.jar - only Bean Collections classes

The main commons-beanutils.jar has an optional dependency on Commons Collections

Regards,

Ryan Crosby

Former Member
0 Kudos

Hi Ryan

Thanks, but I've already tried this core class.

It still contains some collections classes which are in the commons-collection class also.

org.apache.commons.collections.ArrayStack.class

org.apache.commons.collections.Buffer.class

org.apache.commons.collections.BufferUnderflowException.class

org.apache.commons.collections.FastHashMap.class

Ryan-Crosby
Active Contributor
0 Kudos

Hi Paul,

So have you tried the commons-beanutils.jar without using the collections package at all? Based on the documentation it would seem that you could use this .jar file and it should contain all the appropriate classes without having to import two separate archives.

Regards,

Ryan Crosby

Former Member
0 Kudos

Hi Ryan

I need the ListOrderedMap class from the commons-collections and the DynaBean class from the commons-beanutils.

So I need elements of both classes.

Despite what commons-beanutils-core is described as, both classes contain

org.apache.commons.collections.ArrayStack.class

org.apache.commons.collections.Buffer.class

org.apache.commons.collections.BufferUnderflowException.class

org.apache.commons.collections.FastHashMap.class

which is causing the issue.

There are a number of internet comments about the clash in commons-collections and commons-beanutils, but I've not found a suggestion as to how we can get around this.

Ryan-Crosby
Active Contributor
0 Kudos

If you need that one class file from the beanutils package then I think you can extract it from the .jar using something like WinZip and then use the WinZip utility to repackage it and then you would only need to import the one archive but still have all the classes you need.

Regards,

Ryan Crosby

Former Member
0 Kudos

Thank you Ryan.

I didn't know the JAR file was zip format. I changed the suffix to ZIP, unzipped, removed the commons-collection elements, zipped it back up and it loads into PI. And the mapping works.

Thanks for the help.

Paul

Answers (2)

Answers (2)

anupam_ghosh2
Active Contributor
0 Kudos

Hi,

Could you try importing the jar files in two diffrent archives within same SWCV.

When you call this from UDF in same SWCV, i think this will work.

Regards

Anupam

Former Member
0 Kudos

hello,

Hope below link will help you.

http://techplay.plozzle.com/?p=21

Regards,

Phani