XML Editor
Sign up for a WebBoard account Sign Up Keyword Search Search More Options... Options
Chat Rooms Chat Help Help News News Log in to WebBoard Log in Not Logged in
Show tree view Topic
Topic Page 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 Go to previous topicPrev TopicGo to next topicNext Topic
Postnext
Oddbjørn OverskottSubject: Erratic behaviour in EDIFACT adapter
Author: Oddbjørn Overskott
Date: 17 Jan 2007 05:24 PM
Originally Posted: 17 Jan 2007 07:28 AM
I'm trying out a java-based conversion of EDIFACT messages to XML. The conversion libraries give three different exceptions;
On the first one or two calls, I sometimes, but not always, can't unlock the api, because I'm on a one week trial license, and on a computer that is not directly connected to the internet:

<log>
2007-01-17 11:19:42,297 [EDIFACT_OUT] DEBUG no.nmd.was.messagecentral.map.AbstractMap - The call to StylusFileFactory.unlockAPI() failed:

2007-01-17 11:19:42,297 [EDIFACT_OUT] DEBUG no.nmd.was.messagecentral.map.AbstractMap - You must be connected to the internet to use an evaluation copy of Stylus Studio.
2007-01-17 11:19:42,312 [EDIFACT_OUT] DEBUG no.nmd.was.messagecentral.map.AbstractMap - The call to StylusFileFactory.unlockAPI() failed:

2007-01-17 11:19:42,312 [EDIFACT_OUT] DEBUG no.nmd.was.messagecentral.map.AbstractMap - You must be connected to the internet to use an evaluation copy of Stylus Studio.
</log>

Then when I call the Converter for the second or third time after startup, I get one of the two following exceptions; either a NullPointerException or an InvalidFormatException. These two take turns, without any apparent pattern:

<NullPointer>
2007-01-17 11:21:20,359 [EDIFACT_OUT] ERROR no.nmd.was.messagecentral.map.AbstractMap - Converter error:
com.stylusstudio.converter.ConverterException: Error during conversion:
at com.stylusstudio.converter.ConverterImpl.wrapAsConverterException(ConverterImpl.java:1363)
at com.stylusstudio.converter.ConverterImpl.access$1900(ConverterImpl.java:52)
at com.stylusstudio.converter.ConverterImpl$Job$PullPush.go(ConverterImpl.java:561)
at com.stylusstudio.converter.ConverterImpl$Job.<init>(ConverterImpl.java:537)
at com.stylusstudio.converter.ConverterImpl$Job.<init>(ConverterImpl.java:464)
at com.stylusstudio.converter.ConverterImpl.convert(ConverterImpl.java:124)
at no.nmd.was.messagecentral.map.AbstractMap.Map(AbstractMap.java:69)
at no.nmd.was.messagecentral.map.in.OrdersD93AInMap.map(OrdersD93AInMap.java:15)
at no.nmd.was.messagecentral.MessageProcessor.run(MessageProcessor.java:69)
at java.lang.Thread.run(Thread.java:568)
Caused by: java.io.IOException: Error in Converter adapter:
at com.stylusstudio.converter.ConverterImpl$Job.startAdapter(ConverterImpl.java:918)
at com.stylusstudio.converter.ConverterImpl$Job.access$1800(ConverterImpl.java:464)
at com.stylusstudio.converter.ConverterImpl$Job$PullPush.go(ConverterImpl.java:558)
... 7 more
Caused by: java.lang.NullPointerException
at java.io.Reader.<init>(Reader.java(Inlined Compiled Code))
at java.io.InputStreamReader.<init>(InputStreamReader.java(Inlined Compiled Code))
at java.util.Properties.load(Properties.java(Compiled Code))
at com.stylusstudio.adapter.edi.Dialect.getResource(Dialect.java:181)
at com.stylusstudio.adapter.edi.Dialect.getResource(Dialect.java:113)
at com.stylusstudio.adapter.edi.EDIFACT.getResource(EDIFACT.java:142)
at com.stylusstudio.adapter.edi.EDIFACT.sniffVersion(EDIFACT.java:576)
at com.stylusstudio.adapter.edi.Parser.readSegment(Parser.java:306)
at com.stylusstudio.adapter.edi.EDI.toXML(EDI.java:385)
at com.stylusstudio.adapter.AdapterBase.toXML(AdapterBase.java:182)
at com.stylusstudio.converter.ConverterImpl$Job.startAdapter(ConverterImpl.java:911)
... 9 more
</NullPointer>

... or ...

<InvalidFormat>
2007-01-17 11:21:41,375 [EDIFACT_OUT] ERROR no.nmd.was.messagecentral.map.AbstractMap - Converter error:
com.stylusstudio.converter.ConverterException: Error during conversion:
at com.stylusstudio.converter.ConverterImpl.wrapAsConverterException(ConverterImpl.java:1363)
at com.stylusstudio.converter.ConverterImpl.access$1900(ConverterImpl.java:52)
at com.stylusstudio.converter.ConverterImpl$Job$PullPush.go(ConverterImpl.java:561)
at com.stylusstudio.converter.ConverterImpl$Job.<init>(ConverterImpl.java:537)
at com.stylusstudio.converter.ConverterImpl$Job.<init>(ConverterImpl.java:464)
at com.stylusstudio.converter.ConverterImpl.convert(ConverterImpl.java:124)
at no.nmd.was.messagecentral.map.AbstractMap.Map(AbstractMap.java:69)
at no.nmd.was.messagecentral.map.in.OrdersD93AInMap.map(OrdersD93AInMap.java:15)
at no.nmd.was.messagecentral.MessageProcessor.run(MessageProcessor.java:69)
at java.lang.Thread.run(Thread.java:568)
Caused by: java.io.IOException: Error in Converter adapter:
at com.stylusstudio.converter.ConverterImpl$Job.startAdapter(ConverterImpl.java:918)
at com.stylusstudio.converter.ConverterImpl$Job.access$1800(ConverterImpl.java:464)
at com.stylusstudio.converter.ConverterImpl$Job$PullPush.go(ConverterImpl.java:558)
... 7 more
Caused by: com.stylusstudio.adapter.InvalidFormatException: EDIFACT resources not reachable. Check classpath for EDIFACT.jar
at com.stylusstudio.adapter.edi.Dialect.getResource(Dialect.java:140)
at com.stylusstudio.adapter.edi.EDIFACT.getResource(EDIFACT.java:142)
at com.stylusstudio.adapter.edi.EDIFACT.sniffVersion(EDIFACT.java:576)
at com.stylusstudio.adapter.edi.Parser.readSegment(Parser.java:306)
at com.stylusstudio.adapter.edi.EDI.toXML(EDI.java:385)
at com.stylusstudio.adapter.AdapterBase.toXML(AdapterBase.java:182)
at com.stylusstudio.converter.ConverterImpl$Job.startAdapter(ConverterImpl.java:911)
... 9 more
</InvalidFormat>

The EDIFACT.jar file is explicitly added to the classpath.

I run StylusStudio 2007 Enterprise suite, build 735f. I downloaded it for evaluation / proof-of-concept on Friday, so I'm on a one week evaluation license.

The code I'm developing runs on an IBM WebSphere app server, version 6.0.2.15, and the app server uses IBM java version 1.4.2. It runs on a Windows 2000 Workstation.

com.stylusstudio.bindir is C:\Programfiler\Stylus Studio 2007 XML Enterprise Suite\bin

I am trying to invoke the EDI adapter, in order to map an edifact string to XML (and then transform it to our generic message format). The Java code is a work in progress, and as of now it looks like this:

<javacode>
private static ConverterFactory factory = null;

public AbstractMap() {
super();
if (factory == null) {
if (StylusFileFactory.unlockAPI("XXX") != true) {

String eMsg = StylusFileFactory.getUnlockAPIError();
if (eMsg != null && eMsg.startsWith("Insert your")) {
logger.debug("Edit this demo program and insert your Installation ID in the call to unlockAPI");
logger.debug("Make sure CustomFileSystem.jar is in your classpath,");
logger.debug("then compile and run it again.");
}
else {
logger.debug("The call to StylusFileFactory.unlockAPI() failed:\n");
if (eMsg==null)
logger.debug("No reason for failure was returned.");
else logger.debug(eMsg);
}
}
else {
logger.debug("StylusFileFactory was unlocked ok.");
factory = ConverterFactory.newInstance();
System.setProperty("com.stylusstudio.bindir",
"C:\\Programfiler\\Stylus Studio 2007 XML Enterprise Suite\\bin");
}
}
}

protected GenericMessage Map(String messageString) {
String prop = System.getProperty("com.stylusstudio.bindir");
logger.debug("com.stylusstudio.bindir = " + prop);
try {
StringWriter sw = new StringWriter();
StreamSource input = new StreamSource(new ByteArrayInputStream(messageString.getBytes()));
StreamResult output = new StreamResult(sw);
Converter conv = factory.newConvertToXML("adapter:EDI:decode=no:tbl=no:typ=no:opt=yes");
conv.convert(input, output);
logger.debug(sw.toString());
}
catch (ConverterException ex) {
logger.error("Converter error: ", ex);
}
return null;
}
</javacode>

Postnext
Tony LavinioSubject: Erratic behaviour in EDIFACT adapter
Author: Tony Lavinio
Date: 17 Jan 2007 05:24 PM
(Please remember to remove your evaluation key from samples before
you post.)

Postnext
Tony LavinioSubject: Erratic behaviour in EDIFACT adapter
Author: Tony Lavinio
Date: 17 Jan 2007 06:08 PM
We have noticed problems using the IBM JVM. It's classloader
doesn't seem to always act in the way one would expect.
EDIFACT.jar should be located in the same place that
CustomFileSystem.jar is located, but does not need to be in the
classpath.

You might want to try using FileMon from www.sysinternals.com to
see if the adapters are in fact looking for EDIFACT.jar in the
right place.

Postnext
Oddbjørn OverskottSubject: Erratic behaviour in EDIFACT adapter
Author: Oddbjørn Overskott
Date: 19 Jan 2007 08:43 AM
The problems were due to the security mechanisms in WAS. The security system protects the property files and jars under the stylusstudio\bin catalog from being read.

Your code (in the adapters) doesn't handle the generated AccessControlExceptions in a good way.

Instead, it complains that files could not be found, or produces NullPointerExceptions deep inside the adapters.

Now I have increased the trace level for my WAS so it logs the underlying exceptions to a trace file. This means I can see what actually happens, grant the necessary access rights, and hopefully get it all to run. I'm almost there...

Looks like you might want to have a closer look at those calls that can produce AccessControlExceptions...

Postnext
Tony LavinioSubject: Erratic behaviour in EDIFACT adapter
Author: Tony Lavinio
Date: 22 Jan 2007 11:15 AM
Although we've changed the mechanism for an upcoming release,
we are digging into the cause for this problem so that we can
understand why the failure occurred in the way that it did.
You're right, we should have had a clearer message.
We'll post more shortly.

Postnext
Tony LavinioSubject: Erratic behaviour in EDIFACT adapter
Author: Tony Lavinio
Date: 01 Feb 2007 03:00 PM
Would you at some point be interested in trying a new build
that uses a different mechanism to reach the archives containing
the EDI dictionaries?

Postnext
Oddbjørn OverskottSubject: Erratic behaviour in EDIFACT adapter
Author: Oddbjørn Overskott
Date: 02 Feb 2007 05:03 AM
Yes, I'd be happy to try out a new version. Anytime :-)

Postnext
Tony LavinioSubject: Erratic behaviour in EDIFACT adapter
Author: Tony Lavinio
Date: 02 Feb 2007 10:03 AM
(Link to package sent via private email.)

Postnext
Heber LazcanoSubject: Erratic behaviour in EDIFACT adapter
Author: Heber Lazcano
Date: 09 Feb 2007 11:24 AM
Can you send me too the package? please, I have the same problem.

Postnext
Oddbjørn OverskottSubject: Erratic behaviour in EDIFACT adapter
Author: Oddbjørn Overskott
Date: 13 Feb 2007 11:33 AM
I'm afraid the newer version (735g) does much the same as 735f; the following is the exception thrown in the application when I try to create a newConvertToXML:

java.lang.RuntimeException: Unable to create the Converter object.
at com.stylusstudio.converter.ConverterFactory.getConstructor(ConverterFactory.java:108)
at com.stylusstudio.converter.ConverterFactory.newConvertToXML(ConverterFactory.java:44)
at no.nmd.was.messagecentral.map.AbstractMap.edifactToSpecificXml(AbstractMap.java:97)
at no.nmd.was.messagecentral.map.edifact.DesadvD96AMapper.map(DesadvD96AMapper.java:24)
at no.nmd.was.messagecentral.MessageProcessor.run(MessageProcessor.java:82)
at java.lang.Thread.run(Thread.java:568)
Caused by: java.lang.RuntimeException: java.lang.NullPointerException
at com.exln.stylus.io.StylusFileHelpers.getBinDir(StylusFileHelpers.java:557)
at com.exln.stylus.io.StylusFileFactory.registerBuiltinSchemes(StylusFileFactory.java:148)
at com.exln.stylus.io.StylusFileLoader$ProtocolInfo.getClassLoader(StylusFileLoader.java:43)
at com.exln.stylus.io.StylusFileFactory.getAdapterClassLoader(StylusFileFactory.java:1011)
at com.stylusstudio.converter.ConverterFactory.getConstructor(ConverterFactory.java:102)
... 5 more
Caused by: java.lang.NullPointerException
at com.exln.stylus.io.StylusFileHelpers.getBinDir(StylusFileHelpers.java:533)
... 9 more


While behind the scenes, the appserver log reveals the real problem, which is a lack of access / AccessControlException:


java.security.AccessControlException: access denied (java.io.FilePermission \C:\Program Files\Stylus Studio 2007 XML Enterprise Suite\bin\CustomFileSystem.jar read)
at java.security.AccessControlContext.checkPermission(AccessControlContext.java(Compiled Code))
at java.security.AccessController.checkPermission(AccessController.java(Compiled Code))
at java.lang.SecurityManager.checkPermission(SecurityManager.java(Compiled Code))
at com.ibm.ws.security.core.SecurityManager.checkPermission(SecurityManager.java(Compiled Code))
at com.ibm.ws.classloader.SinglePathClassProvider.check(SinglePathClassProvider.java:416)
at com.ibm.ws.classloader.SinglePathClassProvider.checkURL(SinglePathClassProvider.java:403)
at com.ibm.ws.classloader.SinglePathClassProvider.getResource(SinglePathClassProvider.java:395)
at com.ibm.ws.classloader.CompoundClassLoader.findResource(CompoundClassLoader.java:810)
at com.ibm.ws.classloader.CompoundClassLoader.getResource(CompoundClassLoader.java:774)
at com.exln.stylus.io.StylusFileHelpers.getBinDir(StylusFileHelpers.java:529)
at com.exln.stylus.io.StylusFileFactory.registerBuiltinSchemes(StylusFileFactory.java:148)
at com.exln.stylus.io.StylusFileLoader$ProtocolInfo.getClassLoader(StylusFileLoader.java:43)
at com.exln.stylus.io.StylusFileFactory.getAdapterClassLoader(StylusFileFactory.java:1011)
at com.stylusstudio.converter.ConverterFactory.getConstructor(ConverterFactory.java:102)
at com.stylusstudio.converter.ConverterFactory.newConvertToXML(ConverterFactory.java:44)
at no.nmd.was.messagecentral.map.AbstractMap.edifactToSpecificXml(AbstractMap.java:97)
at no.nmd.was.messagecentral.map.edifact.DesadvD96AMapper.map(DesadvD96AMapper.java:24)
at no.nmd.was.messagecentral.MessageProcessor.run(MessageProcessor.java:82)
at java.lang.Thread.run(Thread.java:568)

Postnext
Oddbjørn OverskottSubject: Erratic behaviour in EDIFACT adapter
Author: Oddbjørn Overskott
Date: 13 Feb 2007 11:49 AM
I also get this, after first giving FilePermission to CustomFileSystem.jar and RuntimePermission to createClassLoader...

java.lang.RuntimeException: Unable to create the Converter object.
at com.stylusstudio.converter.ConverterFactory.getConstructor(ConverterFactory.java:108)
at com.stylusstudio.converter.ConverterFactory.newConvertToXML(ConverterFactory.java:44)
at no.nmd.was.messagecentral.map.AbstractMap.edifactToSpecificXml(AbstractMap.java:97)
at no.nmd.was.messagecentral.map.edifact.DesadvD96AMapper.map(DesadvD96AMapper.java:24)
at no.nmd.was.messagecentral.MessageProcessor.run(MessageProcessor.java:82)
at java.lang.Thread.run(Thread.java:568)
Caused by: java.lang.NullPointerException
at java.io.Win32CanonicalPathComponentRetriever.nextComponent(Win32CanonicalPath.java(Compiled Code))
at java.io.Win32CanonicalPath.equals(Win32CanonicalPath.java(Compiled Code))
at java.io.FilePermission.impliesIgnoreMask(FilePermission.java:370)
at java.io.FilePermissionCollection.implies(FilePermission.java:758)
at java.security.Permissions.implies(Permissions.java(Compiled Code))
at java.security.Policy.implies(Policy.java(Compiled Code))
at com.ibm.ws.security.policy.WSDynamicPolicy.implies(WSDynamicPolicy.java(Compiled Code))
at java.security.ProtectionDomain.implies(ProtectionDomain.java(Compiled Code))
at java.security.AccessControlContext.checkPermission(AccessControlContext.java(Compiled Code))
at java.security.AccessController.checkPermission(AccessController.java(Compiled Code))
at java.lang.SecurityManager.checkPermission(SecurityManager.java(Compiled Code))
at com.ibm.ws.security.core.SecurityManager.checkPermission(SecurityManager.java(Compiled Code))
at java.lang.SecurityManager.checkRead(SecurityManager.java(Compiled Code))
at java.io.File.isDirectory(File.java(Compiled Code))
at java.io.File.toURL(File.java:595)
at com.exln.stylus.io.StylusFileLoader$SFFClassLoader.addPathElements(StylusFileLoader.java:94)
at com.exln.stylus.io.StylusFileLoader$SFFClassLoader.access$500(StylusFileLoader.java:82)
at com.exln.stylus.io.StylusFileLoader.CreateStylusFileClassLoader(StylusFileLoader.java:76)
at com.exln.stylus.io.StylusFileLoader$ProtocolInfo.getClassLoader(StylusFileLoader.java:46)
at com.exln.stylus.io.StylusFileFactory.getAdapterClassLoader(StylusFileFactory.java:1011)
at com.stylusstudio.converter.ConverterFactory.getConstructor(ConverterFactory.java:102)
... 5 more

This latest exception gives no hint in the server log as to what it was trying to do, so in principle I dont't know how to get around it, except the tricks that did it on my other PC, with 735f, will probable work here too.

Postnext
Ivan PedruzziSubject: Erratic behaviour in EDIFACT adapter
Author: Ivan Pedruzzi
Date: 13 Feb 2007 12:11 PM
Hi Oddbjørn,

Because the XML Converters use reflection API, you may need to add ReflectPermission as well.

Hope this helps
Ivan Pedruzzi
Stylus Studio Team

Postnext
Oddbjørn OverskottSubject: Erratic behaviour in EDIFACT adapter
Author: Oddbjørn Overskott
Date: 13 Feb 2007 12:43 PM
The point has to be that the StylusStudio runtime components have to log the access exceptions quite explicitly, so that the user can see which permissions are needed.

It shouldn't be impossible for you to set up an environment with a security manager where nothing is initially permitted, and then make the adapter runtime tell you / the user what it tried to do that was denied. The AccessControlExceptions tells you exactly which permission it lacked for which resource, e.g. *FilePermission* to *read* the *CustomFileSystem.jar* file:

java.security.AccessControlException: access denied (java.io.FilePermission \C:\Program Files\Stylus Studio 2007 XML Enterprise Suite\bin\CustomFileSystem.jar read)

Posttop
Ivan PedruzziSubject: Erratic behaviour in EDIFACT adapter
Author: Ivan Pedruzzi
Date: 13 Feb 2007 02:24 PM
Hi Oddbjørn,

I didn't mean to give the impression that we are underestimating the problem, on the contrary we are working to replicate your configuration
and make it part of our test suite.

Thank you for your help
Ivan Pedruzzi
Stylus Studio Team

 
Topic Page 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 Go to previous topicPrev TopicGo to next topicNext Topic
Download A Free Trial of Stylus Studio 6 XML Professional Edition Today! Powered by Stylus Studio, the world's leading XML IDE for XML, XSLT, XQuery, XML Schema, DTD, XPath, WSDL, XHTML, SQL/XML, and XML Mapping!  
go

Log In Options

Site Map | Privacy Policy | Terms of Use | Trademarks
Stylus Scoop XML Newsletter:
W3C Member
Stylus Studio® and DataDirect XQuery ™are from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2016 All Rights Reserved.