Javs Connection in UDF
Hi all,
I am trying to read a webpage in UDF using the below code. But i get the connection time out. Can any body please suggest the possible reason?
try {
URL google = new URL("http//www.google.com");
result.addValue(""+google);
URLConnection yc = google.openConnection();
BufferedReader in = new BufferedReader(new InputStreamReader(yc
.getInputStream()));
while ((inputLine = in.readLine()) != null) {
result.addValue(inputLine);
break;
in.close();
} catch (Exception e) {
result.addValue(""+e);
URL google = new URL("http//www.google.com");
change
URL google = new URL("http://www.google.com");
you are missing : in between http://
Similar Messages
-
Hi there,
I'm trying to generate Java Proxies for SAPJCO using the SAP Java Connectivity Builder (JCB). I got it from the NetWeaver 6.20 Release. The tool installs and runs properly but after putting in the connection properties and klicking "next", the application hangs. When activating System output, I get the error shown below.
I already tried to put all jar files contained in the C:\JBuilder5\lib\ext directiry into the classpath (but none of them contains the class mentioned).
Which is the right (standalone) tool for generating Java Proxies for a standalone Java application?
If it is JCB, is there a bug on the version I use (NetWeaver Release 6.20)?
Any help would be apreciated.
C:\JBuilder5>java -Dlog.handler.FileLog=FileHandler,log.txt -Dlog.logger.com=ALL,FileLog -cp lib/ext/aii_basis.jar;lib/e
xt/aii_ifr_core.jar;lib/ext/aii_ifr_jbtool.jar;lib/ext/aii_lcraccess.jar;lib/ext/aii_msg_runtime.jar;lib/ext/aii_proxy_g
en.jar;lib/ext/aii_proxy_rt.jar;lib/ext/aii_util.jar;lib/ext/aii_util_log.jar;lib/ext/lcrclient.jar;lib/ext/logging.jar;
lib/ext/SapIdeHelp.jar;lib/ext/SapIdeJBUtil.jar;lib/ext/SapIdeJspInsight.jar;lib/ext/SapIdeTaglibReflection11.jar;lib/ex
t/SapIdeTracing.jar;lib/ext/SapIdeUtil.jar;lib/ext/SAPJ2EEEngineJBuilderPlugin.jar;lib/ext/sapjco.jar;lib/ext/SAPmdi.jar
;lib/ext/servlet.jar;lib/ext/tc_sec_core.jar com.sap.aii.ifr.tool.jbuilder.JBuilderTool
#0 12:35:37 [main] DEBUG com.sap.aii.util.misc.api.AIIProperties: Initial AIIProperties
com.sap.aii.client = true
#1 12:35:37 [main] FINE com.sap.aii.util.misc.api.AIIProperties: changed Property "com.sap.aii.standalone" from "null" t
o "true"
#2 12:35:37 [main] FINE com.sap.aii.util.misc.api.AIIProperties: changed Property "com.sap.aii.xml.parserFactory" from "
null" to "com.inqmy.lib.jaxp.SAXParserFactoryImpl"
#3 12:35:37 [main] FINE com.sap.aii.util.misc.api.AIIProperties: changed Property "com.sap.aii.xml.transformerFactory" f
rom "null" to "com.inqmy.lib.jaxp.TransformerFactoryImpl"
#4 12:35:46 [AWT-EventQueue-0] DEBUG com.sap.aii.ifr.upload.client.SAPNavigationPane: New file is C:\Documents and Setti
ngs\kalkoo1\Desktop\t.jar
#5 12:36:08 [AWT-EventQueue-0] FINER com.sap.aii.ifr.upload.client.R3LogonScreen: setting for Client : 010
#6 12:36:08 [AWT-EventQueue-0] FINER com.sap.aii.ifr.upload.client.R3LogonScreen: setting for Logon Name : kalkoo1
#7 12:36:08 [AWT-EventQueue-0] FINER com.sap.aii.ifr.upload.client.R3LogonScreen: setting for Password : #########
#8 12:36:08 [AWT-EventQueue-0] FINER com.sap.aii.ifr.upload.client.R3LogonScreen: setting for Language : EN
#9 12:36:08 [AWT-EventQueue-0] FINER com.sap.aii.ifr.upload.client.R3LogonScreen: setting for Host name: bgstsapedai01.s
t.behr.de
#10 12:36:08 [AWT-EventQueue-0] FINER com.sap.aii.ifr.upload.client.R3LogonScreen: setting for System number : 20
#11 12:36:08 [AWT-EventQueue-0] INFO com.sap.aii.ifr.upload.client.R3LogonScreen: trying to establish connection
#12 12:36:08 [AWT-EventQueue-0] FINEST com.sap.aii.ifr.util.IdentityCheck: Looking up identity
#13 12:36:08 [AWT-EventQueue-0] DEBUG com.sap.aii.ifr.util.IdentityCheck: Results of identity check: isIFRServer: false;
isIFRRMIClient: false; isStandaloneIFR: true
#14 12:36:08 [AWT-EventQueue-0] FINEST com.sap.aii.ifr.util.IdentityCheck: Checking IdentityCheck.isIFRServer. Result: f
alse
#15 12:36:08 [AWT-EventQueue-0] INFO com.sap.aii.ifr.upload.sap.SAPConnection: connecting to system 20 on bgstsapedai01.
st.behr.de via JCo
#16 12:36:09 [AWT-EventQueue-0] DEBUG com.sap.aii.ifr.upload.sap.SAPUploadSource: init MDI to System bgstsapedai01.st.be
hr.de (system=20, client=010) (BasisRelease: 620)
#17 12:36:09 [AWT-EventQueue-0] DEBUG com.sap.aii.ifr.upload.UploadBuffer: new UploadBuffer
Exception in thread "AWT-EventQueue-0" java.lang.NoClassDefFoundError: com/sap/aii/ifr/client/editor/Reference
at java.lang.Class.getDeclaredMethods0(Native Method)
at java.lang.Class.privateGetDeclaredMethods(Unknown Source)
at java.lang.Class.getDeclaredMethod(Unknown Source)
at java.awt.Component.isCoalesceEventsOverriden(Unknown Source)
at java.awt.Component.access$100(Unknown Source)
at java.awt.Component$2.run(Unknown Source)
at java.awt.Component$2.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.awt.Component.checkCoalescing(Unknown Source)
at java.awt.Component.<init>(Unknown Source)
at java.awt.Container.<init>(Unknown Source)
at javax.swing.JComponent.<init>(Unknown Source)
at javax.swing.JTree.<init>(Unknown Source)
at javax.swing.JTree.<init>(Unknown Source)
at com.sap.aii.ifr.navigation.IFRJTree.<init>(IFRJTree.java:84)
at com.sap.aii.ifr.navigation.IFRTreePane.buildPane(IFRTreePane.java:123)
at com.sap.aii.ifr.navigation.IFRTreePane.<init>(IFRTreePane.java:33)
at com.sap.aii.ifr.upload.client.SAPNavigationPane.<init>(SAPNavigationPane.java:43)
at com.sap.aii.ifr.upload.client.SAPBrowser.setIsConnected(SAPBrowser.java:252)
at com.sap.aii.ifr.upload.client.SAPBrowser$ConnectAction.actionPerformed(SAPBrowser.java:594)
at com.sap.aii.ifr.upload.client.SAPBrowser$NextAction.actionPerformed(SAPBrowser.java:536)
at javax.swing.AbstractButton.fireActionPerformed(Unknown Source)
at javax.swing.AbstractButton$Handler.actionPerformed(Unknown Source)
at javax.swing.DefaultButtonModel.fireActionPerformed(Unknown Source)
at javax.swing.DefaultButtonModel.setPressed(Unknown Source)
at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(Unknown Source)
at java.awt.AWTEventMulticaster.mouseReleased(Unknown Source)
at java.awt.AWTEventMulticaster.mouseReleased(Unknown Source)
at java.awt.Component.processMouseEvent(Unknown Source)
at javax.swing.JComponent.processMouseEvent(Unknown Source)
at java.awt.Component.processEvent(Unknown Source)
at java.awt.Container.processEvent(Unknown Source)
at java.awt.Component.dispatchEventImpl(Unknown Source)
at java.awt.Container.dispatchEventImpl(Unknown Source)
at java.awt.Component.dispatchEvent(Unknown Source)
at java.awt.LightweightDispatcher.retargetMouseEvent(Unknown Source)
at java.awt.LightweightDispatcher.processMouseEvent(Unknown Source)
at java.awt.LightweightDispatcher.dispatchEvent(Unknown Source)
at java.awt.Container.dispatchEventImpl(Unknown Source)
at java.awt.Window.dispatchEventImpl(Unknown Source)
at java.awt.Component.dispatchEvent(Unknown Source)
at java.awt.EventQueue.dispatchEvent(Unknown Source)
at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.run(Unknown Source)Hi,
>> Error :- java.lang.NoClassDefFoundError: com/sap/aii/security/proxy/KeystoreHelp
1) Can you check the class path you have mentioned is correctly
2) Setting of the Java in your system ( Desk top /Lap top ) check the Proxy settings
3) Re start the J2EE engine in the server
Regards
Agasthuri Doss -
Crystal XI R2, Salesforce 3.0, Windows 7 64-bit, Java connection error
All,
I've got the same problem as this thread -- Re: CR XI R2: Salesforce 3.0 driver on Windows 7 64-bit?
Crystal XI R2, Salesforce 3.0 downloaded from the Crystal page. Using Windows 7 64-bit. Have applied SP 5 per another thread.
Continue to get JAVA error. Java being used is 1.4 as installed by Crystal in the Crystal program directory.
thanks, jhbDon,
Still no go. I get the same error.
I uninstalled SP6, SP5, Salesforce Connector, and Crystal XI R2 SP2 and then re-installed everything.
1) Crystal XI R2 SP2
2) Salesforce connector 3.0
3) SP5
4) SP6
Still get the same Java Connection error. I've also disabled Windows Firewall. I'm not behind a proxy. I've tried with and without the security token.
thanks, jhb -
Hi ABAPers,
I want to have a sample program for SAP Java connectivity. I know SAP has a JCo but how to go about it. We have another system which needs to communicate with SAP 4.6C. Also, I would like to know whether while reading tables from other system, can this program update our tables.
Thanking you.Hi,
To use JCo, download it (including the Javadocs) from http://service.sap.com/connectors. The zip file contains a comprehensive tutorial to program using JCo. You can also take a look at the FAQ on JCo at http://www.sapgenie.com/faq/jco.htm for more information.
If you just want to take a look at the sample code, you can download the tutorial from http://zerone.samcheok.ac.kr/Asp_pr/Language/.%5Cuploadfile%5CJCo%20Tutorial-1.pdf
You can definitely use JCo to update tables in SAP. You will either have to call an existing BAPI, or an RFC FM to do so.
Hope this helps. Let us know if you need further assistance.
Regards
Message was edited by: Shehryar Khan
Message was edited by: Shehryar Khan -
I am trying to connect to an external server from a proxy , but I get a java.connection exception : remote host did not respond within the time
out period ..
how do i solve this issue ? can i explicitly set an increased time out on the connection ?I am trying to use sockets to address the issue of time outs..the code i have is as follows..i am trying to post an xml file , i dont seem to be getting a response nor am i erroring out ?
String host = "http://mysite.activation.com";
Socket sckt = new Socket(host,80);
sckt.setSoTimeout(10000);
String method = "POST";
String messageString = "<?xml version='1.0' encoding='UTF-8' ?>" +
"<Test.Users>" +
"<User userID='"+test+"' />"+
"</Test.Users>" ;
OutputStream out = sckt.getOutputStream();
out.write(method.getBytes());
out.write(messageString.getBytes());
out.flush();
out.close(); -
Java connection - no application name in sp_iqshowpsexe
We have Java connection to IQ 15.4.
sp_iqshowpsexe 13386, under application column, it has
HOST=appdb1p.nam.nsroot.net
Is there a proper way put logic to Java Code, so we can identify the Java application name?
For example, with Windows dbisql; it is reported back.
HOST=VDI;EXE=C:\sybase\iq154\...\dbisql.exe;You can use the APPLICATIONNAME property on the JDBC connection URL to set the value. This property is documented at:
SyBooks Online
For example: jdbc:sybase:Tds:myhostname:portnum/mydb?APPLICATIONNAME=OurJavaAppName
Regards,
Ken -
I have 2 database server to store data and 2 backup database server to backup data. I want to use java connect to 2 database server (or more) When 2 database server die, Java will automacally connect to 2 backup database server. How can I do ?
Oracle has features for standby databases; their configuration has nothing to do with Java, it all happens within Oracle software...
There are books about this, such as "Oracle Database 10g High Availability with RAC, Flashback, and Data Guard"... -
How Java connect to LDAP?
Hi guys
Does anybody know how Java connect to LDAP server. Thanks in advance.
Regards,
Mark.http://www.java-pro.com/code/2000/JP0012.zip is the source code for the December 2000 issue of Java Pro magazine, which had an article about this. Inside you will find JP0012JB.zip which is the source code for working with LDAP. You don't get a copy of the articles in this zip file, only the code.
-
TCP/IP connection in UDF Timeout
Hi Guys,
Can someone please tell me if there's some way to trace this. I'm doing a TCP/IP connection to an external server from our PI Dev system in a UDF. I've designed this code in an external java tool and everything works fine. I can send the message over the protocol and I get a response back but if I test the UDF in my MM it times out and kicks me off the network. I've asked the firewall guys to have a look but all they they there's no scanning on this rule and nothing's being blocked. I need to find out how come I can't get a connection to this IP and Port. Any idea? Also would I be able to run a tracert command in R/3 itself?
Thanks,
Jan
Edited by: Jan de Lange on Oct 19, 2011 9:54 AMHi,
I've tested my code in my 3G which gets a connection and send/receive data. However if I deploy it on PI It times out after a while. At s.connect(serverAddress, 30000); it can't get a connection to the host. There's no error message, just times out. I'll see what I can come up with working with the network people. They just HAVE to do a trace on it.
try
System.out.println("Creating Socket: " + ip + ":" + port);
//Create Socket Address
SocketAddress serverAddress = new InetSocketAddress(ip, Integer.parseInt(port));
s = new Socket();
//Set Keep Alive Parameter
s.setKeepAlive(true);
//Set Read/Write Timout
s.setSoTimeout(20000);
//Open Connection with Address + Process Timout
s.connect(serverAddress, 30000);
System.out.println("Socket Created: " + s);
catch(UnknownHostException uhe)
// Host unreachable
System.out.println("Unknown Host :" + ip);
errorTrace+=(";Unknown Host :" + ip);
s = null; -
Get dynamic filename in a Java Mapping (NOT UDF)
Hi,
we are using a Java Mapping step in XI (not UDF). We need to have access to the filename. In the File Adapter we set the message attributes and can see the filename value in the SXMB_MONI.
We use the following code fragment to have access to the filename:
Container container = new Context(new FunctionWrapper(0));
DynamicConfiguration conf = (DynamicConfiguration) container.getTransformationParameters().get(StreamTransformationConstants.DYNAMIC_CONFIGURATION);
DynamicConfigurationKey key = DynamicConfigurationKey.create("http://sap.com/xi/XI/System/File","FileName");
String sourceFileName = conf.get(key);
This doesn't work. We think the declaration of the container class is wrong. Does anybody have some information about using the dynamic attributes in Java Mappings?
Thanks in advance
Michaelimport com.sap.aii.mapping.api.*;
import java.io.InputStream;
import java.io.OutputStream;
import java.util.HashMap;
import java.util.Map;
public class JavaProgram
implements StreamTransformation
public JavaProgram()
public void setParameter(Map map)
param = map;
if(param == null)
param = new HashMap();
public void execute(InputStream inputstream, OutputStream outputstream)
try
DynamicConfiguration dynamicconfiguration = (DynamicConfiguration)param.get("DynamicConfiguration");
DynamicConfigurationKey dynamicconfigurationkey = DynamicConfigurationKey.create("http://sap.com/xi/XI/System/File", "FileName");
String s = dynamicconfiguration.get(dynamicconfigurationkey);
//Your logic
catch(Throwable throwable)
throwable.printStackTrace();
private Map param; -
I would seek for opinion on the problem that we're currently encountered related to java We are developing an intranet system using Java and Borland Enterprise Server as an application/web server and also connecting to SAP R/3 database to get certain informations. The problem is that the connection to the database is not disconnect eventhough users already logout from the system. I can check the connection via the SAP (transaction SM04) and the connection are still established.
According to the Java developers they already put in the disconnect statement in the java program.
Pls help.Try and adhere to this pattern :
Datasource datasource = //Go configure your own datasource if you need to
Connection con = null ;
PreparedStatement pstat = null;
ResultSet rset = null;
try {
con = datasource.getConnection() ;
pstat = con.prepareStatement(SQLSTRING) ;
rset = pstat.executeQuery() ;
if(rset.next()) {
//blah blah
} catch (SQLException e) {
e.printStackTrace() ;
} finally {
try {
rset.close() ;
pstat.close() ;
con .close() ;
}catch (SQLException e) {
e.printStackTrace() ; -
Java mapping or UDF required for a requirement!!!
I am doing idoc to file scenario and stuck with the mapping in the following case. I think an UDF or JAVA mapping will do the bill. can some one help me in this regard please.
IDoc message type, IDoc basic type, IDoc extension
PAYEXT.PEXR2002.ZEXR2002.
<u><b>conditions:</b></u>
IF E1IDB02 BA-FIIKWAER = CNY
then MID(E1EDKA1 BE-NAME1,12,11)
IF E1IDB02 BA-FIIKWAER <> CNY and LEN(E1EDKA1 BE-NAME1)<=35
then MID(E1EDKA1 BE-STRAS,1,35)
IF E1IDB02 BA-FIIKWAER <> CNY and LEN(E1EDKA1 BE-NAME1)>35
then MID(E1EDKA1 BE-NAME1,36,35)
This will be mapped to "Info Line 1" field in file.
Thanks,
KiranHi Mr.Kiran,
here is the code
pass the following fields to Context UDF
1.E1IDB02-FIIKWAER
2.E1EDKA1-NAME1
3.E1EDKA1-STRAS
for(int k = 0;k<FIIKWAER.length;k++)
if(FIIKWEAR[k].equalsIgnoreCase("CNY"))
result.addValue(NAME1[k].substring(11,12));
else if(!(FIIKWEAR[k].equalsIgnoreCase("CNY"))&&(NAME1[k].length() <= 35))
result.addValue(STRAS[k].substring(1,35));
else if(!(FIIKWEAR[k].equalsIgnoreCase("CNY"))&&(NAME1[k].length() > 35))
result.addValue(NAME1[k].substring(35,36)); -
Nakisa OrgChart STVN 21 JAVA Connectivity issue with ECC 6.0 Ehp4
Dear Nakisa,
We have deployed Nakisa component with following steps:
1. Java component OrgChart21 TalentOrgChart21_16.sca on SAP Netweaver CE 7.1 Ehp1.
2. applied Nakisa "STVN21_Addon_NW701.SAR" and "STVN21TP_OCOMECC60_1_1.zip" on SAP ERP 6.0 Ehp4.
3. Created SSO connectivity between NWCE and ERP 6.0 Ehp4.
5. Applied Nakisa License on portal using following URL:
http://coe-lba-asd1.group.coe:57000/OrgChart/manager.jsp
6. We have provided security settings entries without role mapping and getting following issues while accessing Nakisa user portal:
404 Not Found
SAP NetWeaver Application Server 7.11 / AS Java 7.11
Error: The requested resource /default.jsp is not available
Troubleshooting Guide https://sdn.sap.com/irj/sdn/wiki?path=/display/jsts/home
Details: File [default.jsp] not found in application root of alias [/] of Java EE application [sap.com/com.sap.engine.docs.examples].
Now we would require implement connectivity between Nakisa JAVA component and ERP 6.0 Ehp4. Please help us with its procedure.
Regards,
RajHello,
The connectivity if I understand you correctly is based on the Connection String.
Please refer to the page 33 "Setting the Authentication Source" on the Administrator Guide for STVN2.1.
An example of connection string would be:
ASHOST=SAPTWO SYSNR=02 USER=gsmith PASSWD=PWD1234 CLIENT=800
Cheers,
Bentow. -
Hi Experts,
I want to call JAVA program in ABAP, how I can achive this.
-Rajneesh GuptaHi Rajneesh,
You can use the the class CL_GUI_FRONTEND_SERVICES. In this you can use the EXECUTE method .
Before this you need to create a connection in SM59 where you need to define the path of the Java batch file.
You can also use the FM 'SXPG_COMMAND_EXECUTE'. Where you can define the path of the Java batch file kept on the application server.You can create external OS command using SM69 and then call that external OS command using the above FM.
Thanks & Regards,
Anuj -
Hi,
I have installed Oracle 10g on Fedora Core 6. I've been trying to connect to the database via java using jdk1.5(using both drivers, classes12.jar and ojdbc14.jar). But its giving an error Network Adapter Failed. Can any one shed some light on this. Individually both are working fine, oracle 10g and jdk1.5
Thanks in advance
ShankyYeah....i was tryin to connect from the same system. And also i have checked the version of java to be jdk1.6. Are there any new drivers from oracle side for jdk1.6?
Also which oracle driver should be used for jdk1.5?
And btw....what is tnsping?
I am able to connect to Oracle using SQL*Plus normally. What is meant by name resolution?
Thanks in advance for your patience
Regards
Shanky
Maybe you are looking for
-
Windows Update error code 80070057.
Replaced hard drive. Installed Windows 7. Went to perform Windows update and received error code 80070057.
-
I haven't been able to open a Premiere Pro CS4 file (.prproj) in Premiere Pro CS3. I get the message "The project could not be loaded, it may be damaged or contain outdated elements." And CS4 will not save as a CS3 file (.prproj). Why, you ask, wou
-
Is there a way to limit Purchase Order Display by Cost Center?
We want to limit who can view specific purchases. Has anyone done this before? Thanks! Chris Lintner
-
That's weird... the vi doesn't LOOK broken!?!?
Sorry NI, but after the 12,000th time getting this message I'm starting to think its too funny not to post. Why did I upgrade to 8.2 again? -Devin I got 99 problems but 8.6 ain't one.
-
Does any one know if/when more companies will sign up to using Passbook in the UK?
Hi, I really enjoy using Passbook but there aren't many companies currently using it. Does any one know whether we will have more companies or brands signing up to use Passbook soon? Thanks