Documentation java.io classes
Hi,
does somebody know where i can find a documentation of the java.io classes, because i want to use them.
Btw: I'm new at using java in the database by stored procedures. Further where can i find sample code for file handling with the java.io classes?
Many thanks in advance.
Martin
Hi,
For java source creating:
CREATE OR REPLACE AND RESOLVE
JAVA SOURCE NAMED "JavaPrgm"
AS ....java source code....
For pl/sql call java :
CREATE OR REPLACE
FUNCTION plsqlfunc
( Arg1 IN varchar2,
Arg2IN varchar2)
RETURN number IS
LANGUAGE JAVA
NAME 'JavaPrgm.Javafunc(java.lang.String,java.lang.String) return int';
Best regards,
Zhxiang.
Similar Messages
-
Template for documenting Java classes
Could anyone suggest a website that provides a template for the correct format for documenting Java classes, and programs?
I have been told there is one on the Java website, but after hours of searching it I could not find the specific page for the template.
Thanks for the help!!!!!I assume u want to use the javadoc tool:
http://java.sun.com/j2se/javadoc/
http://java.sun.com/j2se/javadoc/writingdoccomments/index.html -
RFC lookup with java proxy class, how do I use "fromXml()"?
Hi,
I'm trying to do an RFC lookup in XI using java proxy classes (SAP Enterprise Connector).
The XMLPayload comes from a java proxy class which has been converted to xml using a method called
.fromXml() for this. I just don't know how to use and I can't find any documentation for it.
Would very much appreciate if someone could provide me with an example of how to use this class
Best Regards
Olof Trönnberghttp://xstream.codehaus.org/javadoc/com/thoughtworks/xstream/XStreamer.html#fromXML(com.thoughtworks.xstream.io.HierarchicalStreamDriver,%20java.io.Reader)
-
Java SE classes in a JAR fail preverification... and so they should?
Hi Folks,
I'm trying to add a util JAR to my MIDlet suite, so chucked the JAR file in with it but during preverification, the following comes up...
Error preverifying class com.foo.Bar
java/lang/NoClassDefFoundError: java/lang/Comparable
Build failedI'm assuming this is becuase the Java ME won't have the Java SE class java.lang.Comparable available to it and so fails. Is this the case?
Prob a silly question, but does this mean I can't use ANY J2SE classes (that arn't in the ME API) on the device? For example, java.util.Map? It might not be so bad as I can possibly re-work the JAR project in question to lightwieght version but I guess I just want to know.
Anyway, thanks for any help,
Toby... does this mean I can't use
ANY J2SE classes (that arn't in the ME API) on the
device?That is very true. The html-documentation is pretty useful - it can give you a full list of all the APIs available under J2ME. Look under the docs/api subdirectory of your ToolKit installation directory for index.html.
In particular, you'll have to work around file access and networking in J2ME if you have said functionality in your J2SE app. Look at the Connector class under javax.microedition.io for networking and RecordStore class under javax.microedition.rms for 'file' io.
BTW - one way to get around missing classes (although it is not sanctioned by Sun license agreement) is to simply pull the class out of the J2SE API and include it in your jar.
Ricardo -
Where are the Java API classes?
Hello All,
I understand that Oracle9i uses a Java API different than those older classes found in sdoapi.zip here on the OTN.
Problem is, I don't know where to find them in my newly-installed 9iR2.
Can anyone help me with this simple question or point me to appropriate documentation?
Thanks!
-- johnI believe the new Java API classes are slated for 10i.
-
I need the Java IDoc Class Library
Hi,
I'm desperately looking for the Java IDoc Class Library. What for? I'm doing a project for university and I have a test version running on my own computer (Mini WAS 6.20 with the FlightBooking example installed). The SAP Service Marketplace is for registered customers only. Since I only have a test environment (mentioned above) I can't register there and download it.
Could anyone please send me this library by mail, to [email protected] Since I don't know how big this package is: my mail provider has a 15MB/per single mail limit. If biiger, please split.
Yes, I'm asking for much. But I'm pretty desperate and I have to get going, since I'm running out of time.
If there are other ways to get this library, please tell.
Thanks
JonnyHi Johannes
The SAP Java IDoc Class Library consists of two parts, the SAP Java Base IDoc Class Library and the SAP Java Connector IDoc Class Library. The SAP Java Base IDoc Class Library provides an API which helps navigating, reading, filling, and modifying IDocs. This base package is middleware independent. Creating, sending, and receiving IDocs is middleware dependent. To make use of the SAP Java Base IDoc Class Library you will need an additional middleware dependent add-on package implementing the defined interfaces like the SAP Java Connector IDoc Class Library.
The SAP JCo can be downloaded from the
https://websmp101.sap-ag.de/~form/sapnet?_SHORTKEY=01100035870000463649
of SAP JCo. The SAP JCo package includes the software as well as documentation, tutorial, and examples. The SAP Java IDoc Class Library can be downloaded from the same URL, and then follow the link to SAP Java IDoc Class Library. The SAP Java IDoc Class Library packages include the software as well as documentation. -
XSLT mapping with Java helper classes
Hi,
I'm trying to implement a XSLT mapping to convert my request to a specific soap request message format for this I'm calling some methods from a java helper class. I have imported the jar file into the archives. When I tried to test the interface it keeps complaing there is some exception but doesn't give me the exact error. Has any one called any java helper classes with in XSLT mapping, if so I would appreciate if you could help me with this. Here is the code from xsl.
<wsse:Security soapenv:actor="http://schemas.xmlsoap.org/soap/actor/next" soapenv:mustUnderstand="0" xmlns:wsse="http://schemas.xmlsoap.org/ws/2002/07/secext" xmlns:UserToken="java:com.company.test.mapping.UserTokenMap">
<wsse:UsernameToken>
<wsse:Username xsi:type="soapenc:string" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/">
<xsl:value-of select="UserToken:getUsername()"/>
</wsse:Username>
<wsse:Password wsse:Type="wsse:PasswordDigest" xsi:type="soapenc:string" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/">
<xsl:value-of select="UserToken:getPasswordDigest()"/>
</wsse:Password>
<wsse:Nonce xsi:type="soapenc:string" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/">
<xsl:value-of select="UserToken:getNonce()"/>
</wsse:Nonce>
<wsu:Created xsi:type="soapenc:string" xmlns:wsu="http://schemas.xmlsoap.org/ws/2002/07/utility" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/">
<xsl:value-of select="UserToken:getCreateDate()"/>
</wsu:Created>
</wsse:UsernameToken>
</wsse:Security>
Thanks,
JoeHi,
I'm getting following exception when I refer to the java class with in my XSLT mapping. Any one encountered the same problem.
com.sap.engine.services.ejb.exceptions.BaseRemoteException:
Exception in method transform.
at com.sap.aii.ibrep.sbeans.mapping.MapServiceRemoteObjectImpl0.transform(MapServiceRemoteObjectImpl0.java:218)
at com.sap.aii.ibrep.sbeans.mapping.MapServiceRemoteObjectImpl0p4_Skel.dispatch(MapServiceRemoteObjectImpl0p4_Skel.java:104)
at com.sap.engine.services.rmi_p4.DispatchImpl._runInternal(DispatchImpl.java:320)
at com.sap.engine.services.rmi_p4.DispatchImpl._run(DispatchImpl.java:198)
at com.sap.engine.services.rmi_p4.server.P4SessionProcessor.request(P4SessionProcessor.java:129)
at com.sap.engine.core.service630.context.cluster.session.ApplicationSessionMessageListener.process(ApplicationSessionMessageListener.java:33)
at com.sap.engine.core.cluster.impl6.session.MessageRunner.run(MessageRunner.java:41)
at com.sap.engine.core.thread.impl3.ActionObject.run(ActionObject.java:37)
at java.security.AccessController.doPrivileged(Native
Method)
at com.sap.engine.core.thread.impl3.SingleThread.execute(SingleThread.java:100)
at com.sap.engine.core.thread.impl3.SingleThread.run(SingleThread.java:170)
Caused by: java.lang.UnsupportedClassVersionError:
com/earthlink/xi/mapping/UserTokenMap (Unsupported
major.minor version 49.0)
at java.lang.ClassLoader.defineClass0(Native
Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:539)
at java.lang.ClassLoader.defineClass(ClassLoader.java:448)
at com.sap.aii.ibrep.server.mapping.ibrun.RepMappingLoader.findClass(RepMappingLoader.java:175)
at java.lang.ClassLoader.loadClass(ClassLoader.java:289)
at java.lang.ClassLoader.loadClass(ClassLoader.java:235)
at com.sap.engine.lib.xsl.xpath.JLBLibrary.<init>(JLBLibrary.java:33)
at com.sap.engine.lib.xsl.xpath.LibraryManager.getFunction(LibraryManager.java:69)
at com.sap.engine.lib.xsl.xpath.ETFunction.evaluate(ETFunction.java:98)
at com.sap.engine.lib.xsl.xpath.XPathProcessor.innerProcess(XPathProcessor.java:56)
at com.sap.engine.lib.xsl.xpath.XPathProcessor.process(XPathProcessor.java:43)
at com.sap.engine.lib.xsl.xpath.XPathProcessor.process(XPathProcessor.java:51)
at com.sap.engine.lib.xsl.xslt.XSLValueOf.process(XSLValueOf.java:76)
at com.sap.engine.lib.xsl.xslt.XSLNode.processFromFirst(XSLNode.java:296)
at com.sap.engine.lib.xsl.xslt.XSLElement.process(XSLElement.java:248)
at com.sap.engine.lib.xsl.xslt.XSLNode.processFromFirst(XSLNode.java:296)
at com.sap.engine.lib.xsl.xslt.XSLElement.process(XSLElement.java:248)
at com.sap.engine.lib.xsl.xslt.XSLNode.processFromFirst(XSLNode.java:296)
at com.sap.engine.lib.xsl.xslt.XSLElement.process(XSLElement.java:248)
at com.sap.engine.lib.xsl.xslt.XSLNode.processFromFirst(XSLNode.java:296)
at com.sap.engine.lib.xsl.xslt.XSLElement.process(XSLElement.java:248)
at com.sap.engine.lib.xsl.xslt.XSLNode.processFromFirst(XSLNode.java:296)
at com.sap.engine.lib.xsl.xslt.XSLElement.process(XSLElement.java:248)
at com.sap.engine.lib.xsl.xslt.XSLNode.processFromFirst(XSLNode.java:296)
at com.sap.engine.lib.xsl.xslt.XSLTemplate.process(XSLTemplate.java:272)
at com.sap.engine.lib.xsl.xslt.XSLStylesheet.process(XSLStylesheet.java:463)
at com.sap.engine.lib.xsl.xslt.XSLStylesheet.process(XSLStylesheet.java:431)
at com.sap.engine.lib.xsl.xslt.XSLStylesheet.process(XSLStylesheet.java:394)
at com.sap.engine.lib.jaxp.TransformerImpl.transformWithStylesheet(TransformerImpl.java:398)
at com.sap.engine.lib.jaxp.TransformerImpl.transform(TransformerImpl.java:240)
at com.sap.aii.ibrep.server.mapping.ibrun.RepMappingTransformer.transform(RepMappingTransformer.java:150)
at com.sap.aii.ibrep.server.mapping.ibrun.RepXSLTMapping.execute(RepXSLTMapping.java:81)
at com.sap.aii.ibrep.server.mapping.ibrun.RepSequenceMapping.execute(RepSequenceMapping.java:54)
at com.sap.aii.ibrep.server.mapping.ibrun.RepMappingHandler.run(RepMappingHandler.java:80)
at com.sap.aii.ibrep.server.mapping.rt.MappingHandlerAdapter.run(MappingHandlerAdapter.java:107)
at com.sap.aii.ibrep.server.mapping.ServerMapService.transformInterfaceMapping(ServerMapService.java:127)
at com.sap.aii.ibrep.server.mapping.ServerMapService.transform(ServerMapService.java:104)
at com.sap.aii.ibrep.sbeans.mapping.MapServiceBean.transform(MapServiceBean.java:40)
at com.sap.aii.ibrep.sbeans.mapping.MapServiceRemoteObjectImpl0.transform(MapServiceRemoteObjectImpl0.java:167)
... 10 more
; nested exception is:
java.lang.UnsupportedClassVersionError:
com/earthlink/xi/mapping/UserTokenMap (Unsupported
major.minor version 49.0) -
Is there a Java utility class to help with data management in a desktop UI?
Is there a Java utility class to help with data management in a desktop UI?
I am writing a UI to configure a network device that will be connected to the serial port of the computer while it is being configured. There is no web server or database for my application. The UI has a large number of fields (50+) spread across 16 tabs. I will write the UI in Java FX. It should run inside the browser when launched, and issue commands to the network device through the serial port. A UI has several input fields spread across tabs and one single Submit button. If a field is edited, and the submit button clicked, it issues a command and sends the new datum to the device, retrieves current value and any errors. so if input field has bad data, it is indicated for example, the field has a red border.
Is there a standard design pattern or Java utility class to accomplish the frequently encountered, 'generic' parts of this scenario? lazy loading, submitting only what fields changed, displaying what fields have errors etc. (I dont want to reinvent the wheel if it is already there). Otherwise I can write such a class and share it back here if it is useful.
someone recommended JGoodies Bindings for Swing - will this work well and in FX?Many thanks for the reply.
In the servlet create an Arraylist and in th efor
loop put the insances of the csqabean in this
ArrayList. Exit the for loop and then add the
ArrayList as an attribute to the session.I am making the use of Vector and did the same thing as u mentioned.I am using scriplets...
>
In the jsp retrieve the array list from the session
and in a for loop step through the ArrayList
retrieving each CourseSectionQABean and displaying.
You can do this in a scriptlet but should also check
out the jstl tags.I am able to remove this problem.Thanks again for the suggestion.
AS -
How can i execute Spaces API in java main class?
Hi
I am able to execute Spaces API through portal application. However if i try to execute it in java main class, its throwing an exception
"SEVERE: java.io.FileNotFoundException: .\config\jps-config.xml (The system cannot find the path specified)"
oracle.wsm.common.sdk.WSMException: WSM-00145 : Keystore location or path can not be null or empty; it must be configured through JPS configuration or policy configuration override.
How can i set this path, so that i can execute Spaces API from java main class.
Need this main class to configure in cron job, to schedule a task.
Regards
RajHi Daniel
Currently i have implemented create functionality in my portal application using Spaces API, which is working fine. Now the requirement is, i need to implement a "Cron Job" to schedule a task, which will execute to create space(for example once in a week). Cron job will execute only the main method. So I have created java main class, in which I have used Spaces API to perform create space operation. Then it was giving exception.
Later I understood the reason, as I am executing the Space API with a simple JSE client, its failing since a simple java program has no idea of default-keystore.jks, jps-config.xml, Security Policy. Hence i have included those details in main class. Now I am getting new error,
SEVERE: WSM-06303 The method "registerListener" was not called with required permission "oracle.wsm.policyaccess"
For your reference i have attached the code below, please help. How can i use Spaces API in java main method(i mean public static void main(String[] args) by giving all required information.
public static void main(String[] args) throws InstantiationException,
GroupSpaceWSException,
SpacesException {
Class2 class2 = new Class2();
GroupSpaceWSContext context = new GroupSpaceWSContext();
FactoryFinder.init(null);
context.setEndPoint("http://10.161.226.30/webcenter/SpacesWebService");
context.setSamlIssuerName("www.oracle.com");
context.setRecipientKeyAlias("orakey");
Properties systemProps = System.getProperties();
systemProps.put("java.security.policy","oracle/wss11_saml_or_username_token_with_message_protection_client_policy");
systemProps.put("javax.net.ssl.trustStore","C:\\Oracle\\Middleware11.1.7\\wlserver_10.3\\server\\lib\\cacerts.jks");
systemProps.put("oracle.security.jps.config","C:\\Oracle\\Middleware11.1.7\\user_projects\\domains\\workspace\\system11.1.1.7.40.64.93\\DefaultDomain\\config\\fmwconfig\\jps-config.xml");
systemProps.put("javax.net.ssl.keyStore",C:\\Oracle\\Middleware11.1.7\\user_projects\\domains\\workspace\\system11.1.1.7.40.64.93\\DefaultDomain\\config\\fmwconfig\\consumer.jks");
systemProps.put("javax.net.ssl.keyStorePassword", "Test12");
System.setProperties(systemProps);
GroupSpaceWSClient groupSpaceWSClient;
try {
groupSpaceWSClient = new GroupSpaceWSClient(context);
System.out.println("URL: " +
groupSpaceWSClient.getWebCenterSpacesURL());
//delete the Space
List<String> groupSpaces = groupSpaceWSClient.getGroupSpaces(null);
System.out.println("GroupSpaces:: " + groupSpaces.size());
} catch (Exception e) {
Regards
Raj -
Error: could not be converted to [class java.lang.Class].
I am newbie to JDeveloper (10.1.2) on winxp and i was trying to setup the example from the following url http://radio.weblogs.com/0129487/2003/09/19.html
It is a how to on "Executing Toplink Queries using JavaBean DataControl "
Any help would be greatly appreciated.
Near the bottom on step "In StrutsPageFlow diagram, select allEmpsDA Data Action, right mouse and chooe Run" i get a the following runtime errors:
Validation Error
You must correct the following error(s) before proceeding:
JBO-29000: Unexpected exception caught: oracle.jbo.JboException, msg=JBO-29000: Unexpected exception caught: oracle.toplink.exceptions.ConversionException, msg= Exception Description: The object [mypackage.Employees], of class [class java.lang.String], could not be converted to [class java.lang.Class]. Please ensure that the class [class java.lang.Class] is on the CLASSPATH. You may need to use alternate API passing in the appropriate class loader as required, or setting it on the default ConversionManager Internal Exception: java.lang.ClassNotFoundException: mypackage.Employees
JBO-29000: Unexpected exception caught: oracle.toplink.exceptions.ConversionException, msg= Exception Description: The object [mypackage.Employees], of class [class java.lang.String], could not be converted to [class java.lang.Class]. Please ensure that the class [class java.lang.Class] is on the CLASSPATH. You may need to use alternate API passing in the appropriate class loader as required, or setting it on the default ConversionManager Internal Exception: java.lang.ClassNotFoundException: mypackage.Employees
Exception Description: The object [mypackage.Employees], of class [class java.lang.String], could not be converted to [class java.lang.Class]. Please ensure that the class [class java.lang.Class] is on the CLASSPATH. You may need to use alternate API passing in the appropriate class loader as required, or setting it on the default ConversionManager Internal Exception: java.lang.ClassNotFoundException: mypackage.EmployeesThis error is happening on a read.
Here is the mapping descriptor:
<database-mapping>
<attribute-name>SuppItemCollection</attribute-name>
<read-only>false</read-only>
<reference-class>package.SuppItem</reference-class>
<is-private-owned>false</is-private-owned>
<uses-batch-reading>false</uses-batch-reading>
<indirection-policy>
<mapping-indirection-policy>
<type>oracle.toplink.internal.indirection.NoIndirectionPolicy</type>
</mapping-indirection-policy>
</indirection-policy>
<container-policy>
<mapping-container-policy>
<container-class>java.util.Vector</container-class>
<type>oracle.toplink.internal.queryframework.ListContainerPolicy</type>
</mapping-container-policy>
</container-policy>
<source-key-fields>
<field>SUPP.REQ_NUM</field>
</source-key-fields>
<target-foreign-key-fields>
<field>SUPP_ITEM.REQ_NUM</field>
</target-foreign-key-fields>
<type>oracle.toplink.mappings.OneToManyMapping</type>
</database-mapping>
Object model has a Supp class that has a collection of SuppItem(s). I was allowing the Mapping Workbench to create the Java Source. I'm not to fond of that, but I thought it would be easiest to get things going.
The datamodel is similiar to the class model.
Thanks for the help,
Mike -
XSLT Mapping : RFC Lookup using java helper class
Hi All,
I am doing RFC Lookup in xslt mapping using java helper class. I have found blog for the same (http://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/05a3d62e-0a01-0010-14bc-adc8efd4ee14) However this blog is very advanced.
Can anybody help me with step by step approach for the same?
My basic questions are not answered in the blog as:
1) where to add the jar file of the java class used in xslt mapping.
I have added zip file of XSLT mapping in imported archived and using that in mapping.
Thanks in advace.
Regards,
RohanHi,
Can u please have look at this in detail , u can easily point out yourself the problem...
http://help.sap.com/saphelp_nw04/helpdata/en/55/7ef3003fc411d6b1f700508b5d5211/content.htm
Please observe the line,
xmlns:javamap="java:com.company.group.MappingClass
in XSLT mapping..
The packagename of class and class name and XSLT namespace should be matching...
Babu
Edited by: hlbabu123 on Sep 29, 2010 6:04 PM -
Java Error in RFC Lookup in XSLT Mapping usinf Java helper class
Hi All,
I am doing RFC Lookup in XSLT Mapping using Java Helper class.
The Lookup works fine when called one RFC at a time However my requirement is I want to do 2 Lookups.
Both Lookups works when done individually however when I call both lookups in one mapping I get following error "javax.xml.transform.TransformerException: DOMSource whose Node is null."
Following is the code I have written in XSLT for the lookup:
<xsl:template name="Lookup_1">
<xsl:param name="STDPN"/>
<rfc:RFC_READ_TABLE>
<QUERY_TABLE>KNA1</QUERY_TABLE>
<OPTIONS><item><TEXT>
<xsl:value-of select="$STDPN"/>
</TEXT></item>
</OPTIONS>
<FIELDS>
<item>
<FIELDNAME>KUNNR</FIELDNAME>
</item>
</FIELDS>
</rfc:RFC_READ_TABLE>
</xsl:variable>
<xsl:variable name="response" xmlns:lookup="java:urn.mt.pi" select="lookup:execute($request, 'BS_D, 'cc_RfcLookup', $inputparam)"/>
<xsl:element name="STDPN">
<xsl:value-of select="$response//DATA/item/WA"/>
</xsl:element>
</xsl:template>
<xsl:template name="Lookup_2">
<xsl:param name="BELNR"/>
<xsl:variable name="Query">AGMNT = '<xsl:value-of select="$BELNR"/>'</xsl:variable>
<xsl:variable name="request1">
<rfc:RFC_READ_TABLE>
<QUERY_TABLE>ZTABLE</QUERY_TABLE>
<OPTIONS><item><TEXT>
<xsl:value-of select="$Query"/>
</TEXT></item>
</OPTIONS>
<FIELDS>
<item>
<FIELDNAME>KUNAG</FIELDNAME>
</item>
</FIELDS>
</rfc:RFC_READ_TABLE>
</xsl:variable>
<xsl:variable name="response1" xmlns:lookup="java:urn.mt.pi" select="lookup:execute($request1, 'BS_D','cc_RfcLookup', $inputparam)"/>
<xsl:element name="BELNR">
<xsl:value-of select="$response1//DATA/item/WA"/>
</xsl:element>
</xsl:template>
My Question: Am I doing anything wrong? Or Is it possible to call multiple lookups in one XSLT?
Thanks and Regards,
AtulHi Atul,
I had the same problem like you had.
The main Problem is that with the example code the request variable is created as NodeList object. In XSLT a variable is somekind of a constant and can't be changed. As the request object is empty after the first request the programm fails at the following line:
Source source = new DOMSource(request.item(0));
So I've created a workaround for this problem.
In the call of the template I've put the request as a parameter object at the template call:
<xsl:with-param name="req">
<rfc:PLM_EXPLORE_BILL_OF_MATERIAL xmlns:rfc="urn:sap-com:document:sap:rfc:functions">
<APPLICATION>Z001</APPLICATION>
<FLAG_NEW_EXPLOSION>X</FLAG_NEW_EXPLOSION>
<MATERIALNUMBER><xsl:value-of select="value"/></MATERIALNUMBER>
<PLANT>FSD0</PLANT>
<VALIDFROM><xsl:value-of select="//Recordset/Row[name='DTM-031']/value"/></VALIDFROM>
<BOMITEM_DATA/>
</rfc:PLM_EXPLORE_BILL_OF_MATERIAL>
</xsl:with-param>
With this change the request will be provided as a String object and not as a NodeList object.
Afterwards the RfcLookup.java has to be changed to the following:
package com.franke.mappings;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.io.StringWriter;
import java.util.Map;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.transform.Source;
import javax.xml.transform.Transformer;
import javax.xml.transform.TransformerFactory;
import javax.xml.transform.dom.DOMSource;
import javax.xml.transform.stream.StreamResult;
import org.w3c.dom.Document;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
import com.sap.aii.mapping.lookup.Channel;
import com.sap.aii.mapping.api.StreamTransformationConstants;
import com.sap.aii.mapping.api.AbstractTrace;
import com.sap.aii.mapping.lookup.RfcAccessor;
import com.sap.aii.mapping.lookup.LookupService;
import com.sap.aii.mapping.lookup.XmlPayload;
* @author Thorsten Nordholm Søbirk, AppliCon A/S
* Helper class for using the XI Lookup API with XSLT mappings for calling RFCs.
* The class is generic in that it can be used to call any remote-enabled
* function module in R/3. Generation of the XML request document and parsing of
* the XML response is left to the stylesheet, where this can be done in a very
* natural manner.
* TD:
* Changed the class that request is sent as String, because of IndexOutOfBound-exception
* When sending multiple requests in one XSLT mapping.
public class RfcLookup {
* Execute RFC lookup.
* @param request RFC request - TD: changed to String
* @param service name of service
* @param channelName name of communication channel
* @param inputParam mapping parameters
* @return Node containing RFC response
public static Node execute( String request,
String service,
String channelName,
Map inputParam)
AbstractTrace trace = (AbstractTrace) inputParam.get(StreamTransformationConstants.MAPPING_TRACE);
Node responseNode = null;
try {
// Get channel and accessor
Channel channel = LookupService.getChannel(service, channelName);
RfcAccessor accessor = LookupService.getRfcAccessor(channel);
// Serialise request NodeList - TD: Not needed anymore as request is String
/*TransformerFactory factory = TransformerFactory.newInstance();
Transformer transformer = factory.newTransformer();
Source source = new DOMSource(request.item(0));
ByteArrayOutputStream baos = new ByteArrayOutputStream();
StreamResult streamResult = new StreamResult(baos);
transformer.transform(source, streamResult);*/
// TD: Add xml header and remove linefeeds for the request string
request = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>"+request.replaceAll("[\r\n]+", "");
// TD: Get byte Array from request String to send afterwards
byte[] requestBytes = request.getBytes();
// TD: Not used anymore as request is String
//byte[] requestBytes = baos.toByteArray();
trace.addDebugMessage("RFC Request: " + new String(requestBytes));
// Create input stream representing the function module request message
InputStream inputStream = new ByteArrayInputStream(requestBytes);
// Create XmlPayload
XmlPayload requestPayload =LookupService.getXmlPayload(inputStream);
// Execute lookup
XmlPayload responsePayload = accessor.call(requestPayload);
InputStream responseStream = responsePayload.getContent();
TeeInputStream tee = new TeeInputStream(responseStream);
// Create DOM tree for response
DocumentBuilder docBuilder =DocumentBuilderFactory.newInstance().newDocumentBuilder();
Document document = docBuilder.parse(tee);
trace.addDebugMessage("RFC Response: " + tee.getStringContent());
responseNode = document.getFirstChild();
} catch (Throwable t) {
StringWriter sw = new StringWriter();
t.printStackTrace(new PrintWriter(sw));
trace.addWarning(sw.toString());
return responseNode;
* Helper class which collects stream input while reading.
static class TeeInputStream extends InputStream {
private ByteArrayOutputStream baos;
private InputStream wrappedInputStream;
TeeInputStream(InputStream inputStream) {
baos = new ByteArrayOutputStream();
wrappedInputStream = inputStream;
* @return stream content as String
String getStringContent() {
return baos.toString();
/* (non-Javadoc)
* @see java.io.InputStream#read()
public int read() throws IOException {
int r = wrappedInputStream.read();
baos.write(r);
return r;
Then you need to compile and upload this class and it should work.
I hope that this helps you.
Best regards
Till -
Developer 10g error Java.Lang class not found
Hi
My application is live on static IP but when i try to access it from some systems i get the error after downloading Jinitiator
Java.lang class not found exception:Oracle forms engine main
is this problem of browser or something else? how can i solve
RegardsHi
My application is live on static IP but when i try
to access it from some systems i get the error after
downloading Jinitiator
ava.lang class not found exception:Oracle forms
engine main
is this problem of browser or something else? how can
i solve
RegardsSee the JInitiator "Proxies" configuration tab from the control panel, try checking the "Use Browser Settings" checkbox, that does the trick sometimes.
Tony -
Java.lang.class not found
Hi,
I configured scenario FILE TO JDBC, the sender channel is successful but in the receiving I am getting the error that java.lang.class not found.
In the receiver communication channel, I gave "com.microsoft.jdbc.sqlserverdriver".
what database connection parameters need to be given??
Thanks,
Satish.Whats your database ?
As Suresh said, did you deploy your JDBC driver ?
How to ?
https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/library/xi/xi-how-to-guides/how to install and configure external drivers for jdbc and jms adapters.pdf
After configuring your communication channel, did you check the Adapter Monitor
XI SP > 09
http://<host>:5<sysnum>00/rwb -> Component Monitoring -> All Display -> Adapter Engine -> Adapter Monitor
XI SP <= 09
http://<host>:5<sysnum>00/AdapterFramework
Oracle Driver & Connection:
JDBC Driver: oracle.jdbc.driver.OracleDriver
Connection: jdbc:oracle:thin:@<hostname>:<port_umber>:<database_name>
SQL Server Driver & Connection:
JDBC Driver = com.microsoft.jdbc.sqlserver.SQLServerDriver
Connection = jdbc:microsoft:sqlserver://hostname:1433;DatabaseName=<DBName>
regards
Shravan -
Java.lang.Class- getFields() results in JVM crash when called through JNI
From a C++ application, I use Invocation APIs to create a JVM and call some Java methods using JNI
I get a crash in jvm.dll with EXCEPTION_ACCESS_VIOLATION
when I try to call "getFields" method of java.lang.Class in order to get the Fields of the java class
This method call, should return a java/lang/reflect/Fields[] on success
I am able to get the method ID of this method by using pEnv->GetMethodID(..)
However, when I call this method using CallObjectMethod(..), HotSpt JVM crashes with access violation with the dump given below.
Any clues on how to debug and find the problem?
Or has anyone tried getting the fields of a Java class from C++ by calling reflection APIs uing JNI?
Thanks in advance!
Sample code
jclass testerClass = pEnv->FindClass("com/test/Tester");
jmethodID cid = pEnv->GetMethodID(testerClass,"<init>","()V");
if(NULL == cid)
pEnv->ExceptionDescribe();
jobject testerObject = pEnv->NewObjectV(testerClass, mid);
jmethodID mid = pEnv->GetMethodID(testerClass, "getClass",
"()Ljava/lang/Class;");
jobject clsObj = (jobject)pEnv->CallObjectMethod(testerObject, mid);
pEnv->ExceptionDescribe();
jclass jCls = pEnv->GetObjectClass(clsObj);
jmethodID midGetFields = pEnv->GetMethodID(jCls, "getFields",
"()[Ljava/lang/reflect/Field;");
jobjectArray jobjArray = (jobjectArray)pEnv->CallObjectMethod(testerObject, midGetFields);
pEnv->ExceptionDescribe();
Crash dump
Unexpected Signal : EXCEPTION_ACCESS_VIOLATION (0xc0000005) occurred at PC=0x809E69F
Function=JVM_FindSignal+0x11505
Library=D:\Java\j2re1.4.2_03\bin\client\jvm.dll
Current Java thread:
at java.lang.Class.privateGetDeclaredFields(Unknown Source)
at java.lang.Class.privateGetPublicFields(Unknown Source)
at java.lang.Class.getFields(Unknown Source)
Dynamic libraries:
0x00400000 - 0x00419000 E:\SC\SC12.1\SCApplications\SNMP\Bin\JNITester.exe
0x77F50000 - 0x77FF7000 C:\WINDOWS\System32\ntdll.dll
0x77E60000 - 0x77F46000 C:\WINDOWS\system32\kernel32.dll
0x10000000 - 0x10023000 E:\SC\SC12.1\SCApplications\SNMP\Bin\JniUtils.dll
0x00320000 - 0x00332000 E:\SnmpIpmNativeTestDriver\MTFStubHelper.dll
0x00340000 - 0x0035B000 E:\SnmpIpmNativeTestDriver\MTFXMLFileAPI.dll
0x12000000 - 0x122B1000 e:\sc\sc12.1\bin\xerces-c_2_2_0D.dll
0x77DD0000 - 0x77E5D000 C:\WINDOWS\system32\ADVAPI32.dll
0x78000000 - 0x78086000 C:\WINDOWS\system32\RPCRT4.dll
0x10200000 - 0x1026C000 e:\sc\sc12.1\bin\MSVCRTD.dll
0x102A0000 - 0x102B7000 e:\sc\sc12.1\bin\MSVCIRTD.dll
0x5F800000 - 0x5F8E9000 e:\sc\sc12.1\bin\MFC42uD.DLL
0x77C70000 - 0x77CB0000 C:\WINDOWS\system32\GDI32.dll
0x77D40000 - 0x77DCC000 C:\WINDOWS\system32\USER32.dll
0x5F700000 - 0x5F746000 e:\sc\sc12.1\bin\MFCD42uD.DLL
0x5F500000 - 0x5F5C6000 e:\sc\sc12.1\bin\MFCO42uD.DLL
0x10480000 - 0x104FE000 e:\sc\sc12.1\bin\MSVCP60D.dll
0x15020000 - 0x15042000 e:\sc\sc12.1\bin\SCTraceLib.dll
0x6D510000 - 0x6D58D000 C:\WINDOWS\System32\dbghelp.dll
0x77C10000 - 0x77C63000 C:\WINDOWS\system32\msvcrt.dll
0x77C00000 - 0x77C07000 C:\WINDOWS\system32\VERSION.dll
0x00360000 - 0x0037D000 e:\sc\sc12.1\bin\SCFileManager.dll
0x76BF0000 - 0x76BFB000 C:\WINDOWS\System32\PSAPI.DLL
0x00420000 - 0x00580000 e:\sc\sc12.1\bin\BctCoreCL.dll
0x5D920000 - 0x5D929000 C:\WINDOWS\System32\RPCNS4.dll
0x71B20000 - 0x71B31000 C:\WINDOWS\system32\MPR.dll
0x71C20000 - 0x71C6E000 C:\WINDOWS\System32\NETAPI32.dll
0x71AB0000 - 0x71AC5000 C:\WINDOWS\System32\WS2_32.dll
0x71AA0000 - 0x71AA8000 C:\WINDOWS\System32\WS2HELP.dll
0x15000000 - 0x15012000 e:\sc\sc12.1\bin\CTEventLog.dll
0x773D0000 - 0x77BC2000 C:\WINDOWS\system32\SHELL32.dll
0x70A70000 - 0x70AD4000 C:\WINDOWS\system32\SHLWAPI.dll
0x771B0000 - 0x772D1000 C:\WINDOWS\system32\ole32.dll
0x77120000 - 0x771AB000 C:\WINDOWS\system32\OLEAUT32.dll
0x1F7A0000 - 0x1F7D6000 C:\WINDOWS\System32\ODBC32.dll
0x77340000 - 0x773CB000 C:\WINDOWS\system32\COMCTL32.dll
0x763B0000 - 0x763F5000 C:\WINDOWS\system32\comdlg32.dll
0x08000000 - 0x08138000 D:\Java\j2re1.4.2_03\bin\client\jvm.dll
0x76B40000 - 0x76B6C000 C:\WINDOWS\System32\WINMM.dll
0x5FD00000 - 0x5FD0D000 C:\WINDOWS\System32\MFC42LOC.DLL
0x71950000 - 0x71A34000 C:\WINDOWS\WinSxS\x86_Microsoft.Windows.Common-Controls_6595b64144ccf1df_6.0.10.0_x-ww_f7fb5805\comctl32.dll
0x1F840000 - 0x1F857000 C:\WINDOWS\System32\odbcint.dll
0x5DAC0000 - 0x5DAC7000 C:\WINDOWS\System32\rdpsnd.dll
0x00FE0000 - 0x00FE7000 D:\Java\j2re1.4.2_03\bin\hpi.dll
0x01000000 - 0x0100E000 D:\Java\j2re1.4.2_03\bin\verify.dll
0x01010000 - 0x01029000 D:\Java\j2re1.4.2_03\bin\java.dll
0x01030000 - 0x0103D000 D:\Java\j2re1.4.2_03\bin\zip.dll
0x76C90000 - 0x76CB2000 C:\WINDOWS\system32\imagehlp.dll
Heap at VM Abort:
Heap
def new generation total 576K, used 132K [0x15050000, 0x150f0000, 0x15530000)
eden space 512K, 25% used [0x15050000, 0x15071250, 0x150d0000)
from space 64K, 0% used [0x150d0000, 0x150d0000, 0x150e0000)
to space 64K, 0% used [0x150e0000, 0x150e0000, 0x150f0000)
tenured generation total 1408K, used 0K [0x15530000, 0x15690000, 0x19050000)
the space 1408K, 0% used [0x15530000, 0x15530000, 0x15530200, 0x15690000)
compacting perm gen total 4096K, used 964K [0x19050000, 0x19450000, 0x1d050000)
the space 4096K, 23% used [0x19050000, 0x191410e0, 0x19141200, 0x19450000)
Local Time = Wed Aug 25 21:06:44 2004
Elapsed Time = 0
# HotSpot Virtual Machine Error : EXCEPTION_ACCESS_VIOLATION
# Error ID : 4F530E43505002EF
# Please report this error at
# http://java.sun.com/cgi-bin/bugreport.cgi
# Java VM: Java HotSpot(TM) Client VM (1.4.2_03-b02 mixed mode)You are right, I tried getting the java.lang.Class reference for the com.test.Tester by calling getClass() on com.test.Tester
And using this jclass reference for java.lang.Class, I tried getting the method ID of getFields and eventually the Field[]
Thanks for the help
I have some more questions.
Assumption - Using JNI, I got the fields array of com.test.Tester and I am iterating through the fields
1.Assuming that the Tester class had an Integer field say m_nIntVal, then once I get the jobject equivalent of this Field in C++.
Now I need to get the type of the field (I call the method java.lang.reflect.getType() from JNI)
This gives me a jclass reference to it's type i.e java.lang.Integer
2.I need to get the name of this type i.e I want to get the name of the type in a string as "java.lang.Integer"
For this, on the jclass reference of java.lang.Integer got in Step 1, I call getClass() from JNI (to get the java.lang.Class) and then getName()
Now, for calling getClass(), I need a temporary object reference corresponding to the jclass of java.lang.Integer, The problem is that Integer does not have a default constructor, so my call to create the jobject fails.
But, since I do not know that I am constructing an Integer (remember that is what I am trying to find out - getType), I cant pass any values to constructor
Now, how do I go about creating a jobject of Integer, without knowing that I am constructing that, as this does not have a default constructor without parameters
Also, I tried using AllocObject to get the jobject and then tried to get the method ID of getClass(). Even this failed
3. If the com.test.Tester class had a primitive "int" field, say m_nPrimitiveInt
for which java provides a Class representation, I am able to get the jclass reference to the type of m_nPrimitiveInt
Now, how do I get the name of the type as "int" in a string?
Forllowing a similar procedure like in Step 2 fails when I try to pass the jclass reference to the type of m_nPrimitiveInt to the GetMethodID
with the error FATAL ERROR in native method: JNI received a class argument that is not a class
Can you tell me what is the way out?
Thanks in advance,
Also, can I mail you with some doubts that I have? If its ok, please contact me at [email protected]
Maybe you are looking for
-
Low battery quicker iphone 5S ios8
Hi, I have an iphone 5S updated to ios. I have a recurrent problem : the battery can get empty in 10 hours using very few my iphone (no call, few mails, few apps). i passed 5 days in chicago, cutting of 4G and data, using only wifi last week. my batt
-
How to attach a PDF file TO the form so that recipients can access the file as a resource?
How to attach a PDF file TO the form so that recipients can access the file as a resource?
-
Can i use Lightroom 30 day trial version for commercial project until the end of the trial period ? I will be doing a 7 day photoshoot and i would like to use the tethering option build in Lightroom 3. Thank you
-
How can I repair and open damaged PDF files?
I need to download every online issue of ASOS magazine, which are all PDF files, and I have already downloaded at least five to my USB stick, and they have all worked perfectly. However, there are five more issues that I have not downloaded, and I ne
-
IPhone 4 screen sensitivity to facial contact
I'm unable to use the phone normally to the face/ear as the skin contact causes one of the following to happen: phone switches to speakerphone, keyboard buttons are heard being pressed, and or the call ENDS. I have met two more owners with the same i