Java SFTP API/Sample application
I'm looking for either sample java code of how to send files via sftp or a java api to do this. Jscape looks to be the standard for doing this although it costs quite a bit, wondering if there is free code out there?
Thanks for any help in advance!!!
Check out JCraft's Java Secure Channel (JSch) project -- it's an implementation of SSH (with scp, sftp, etc.) in Java -- with some examples that might get you started: http://www.jcraft.com/jsch/
The code is distributed free under a BSD-style license which is described on the site.
Greg
Similar Messages
-
SSO java sample application problem
Hi all,
I am trying to run the SSO java sample application, but am experiencing a problem:
When I request the papp.jsp page I end up in an infinte loop, caught between papp.jsp and ssosignon.jsp.
An earlier thread in this forum discussed the same problem, guessing that the cookie handling was the problem. This thread recommended a particlar servlet , ShowCookie, for inspecting the cookies for the current session.
I have installed this cookie on the server, but don't see anything but one cookie, JSESSIONID.
At present I am running the jsp sample app on a Tomcat server, while Oracle 9iAS with sso and portal is running on another machine on the LAN.
The configuration of the SSO sample application is as follows:
Cut from SSOEnablerJspBean.java:
// Listener token for this partner application name
private static String m_listenerToken = "wmli007251:8080";
// Partner application session cookie name
private static String m_cookieName = "SSO_PAPP_JSP_ID";
// Partner application session domain
private static String m_cookieDomain = "wmli007251:8080/";
// Partner application session path scope
private static String m_cookiePath = "/";
// Host name of the database
private static String m_dbHostName = "wmsi001370";
// Port for database
private static String m_dbPort = "1521";
// Sehema name
private static String m_dbSchemaName = "testpartnerapp";
// Schema password
private static String m_dbSchemaPasswd = "testpartnerapp";
// Database SID name
private static String m_dbSID = "IASDB.WMDATA.DK";
// Requested URL (User requested page)
private static String m_requestUrl = "http://wmli007251:8080/testsso/papp.jsp";
// Cancel URL(Home page for this application which don't require authentication)
private static String m_cancelUrl = "http://wmli007251:8080/testsso/fejl.html";
Values specified in the Oracle Portal partner app administration page:
ID: 1326
Token: O87JOE971326
Encryption key: 67854625C8B9BE96
Logon-URL: http://wmsi001370:7777/pls/orasso/orasso.wwsso_app_admin.ls_login
single signoff-URL: http://wmsi001370:7777/pls/orasso/orasso.wwsso_app_admin.ls_logout
Name: testsso
Start-URL: http://wmli007251:8080/testsso/
Succes-URL: http://wmli007251:8080/testsso/ssosignon.jsp
Log off-URL: http://wmli007251:8080/testsso/papplogoff.jsp
Finally I have specified the cookie version to be v1.0 when running the regapp.sql script. Other parameters for this script are copied from the values specified above.
Unfortunately the discussion in the earlier thread did not go any further but to recognize the cookieproblem, so I am now looking for help to move further on from here.
Any ideas will be greatly appreciated!
/MadsPierre - When you work on the sample application, you should test the pages in a separate browser instance. Don't use the Run Page links from the Builder. The sample app has a different authentication scheme from that used in the development environment so it'll work better for you to use a separate development browser from the application testing browser. In the testing browser, to request the page you just modified, login to the application, then change the page ID in the URL. Then put some navigation controls into the application so you can run your page more easily by clicking links from other pages.
Scott -
Sample application for connecting to model in WD java
Hi ,
Can any one help me out how to connect to model to access sql as i am very new to webdynpro java.Hi Vijayalakshmi,
Check these
https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/library/user-interface-technology/webdynpro/wd%20java/wdjava%20tutorials%207.0/using%20ejbs%20in%20web%20dynpro%20applications.pdf
Check this for sample applications & tutorials
https://www.sdn.sap.com/irj/sdn/webdynpro?rid=/library/uuid/49f2ea90-0201-0010-ce8e-de18b94aee2d#20
regards
Sumit -
Sample application of Flex using java
Can anybody tell or send any URL regarding sample applcation i.e.
developed using Flex and java
I am confused abt web.xml
means how to integrate that flex application.Thx Dear,
At least I got some reply from someone.
Actually I m trying to search it but not getting any help.
My prob is.
I want to develop sample application using Flex and Spring framework.
Let say there is form called
Employee.mxml & there are 2 text boxes for username & password .I want to read values entered by user in these text boxes from flex form using Spring framework.
so can u send me any URL sothat i can get help for this.
Please help me ASAP. -
Java WebDynpro Sample Applications to learn.
Hi There,
I am new to Java WebDynpro ,I am looking for sample applications so that i can practice how to develope the webdynpro components and actually i want to learn how to do the external context mapping.
Thanks,
Rashmi.Hi,
You can find lots of help in SDN like, where you can find may documents related to many topics just go through the following links and browse as per your requirement.
Blogs
[https://www.sdn.sap.com/irj/sdn/advancedsearch?cat=sdn_weblog&query=webdynproJavatutorials&adv=false&sortby=cm_rnd_rankvalue]
Libraries
[https://www.sdn.sap.com/irj/sdn/advancedsearch?cat=sdn_library&query=webdynproJavatutorials&adv=false&sortby=cm_rnd_rankvalue]
e-Learning
[https://www.sdn.sap.com/irj/sdn/advancedsearch?cat=sdn_media&query=webdynproJavatutorials&adv=false&sortby=cm_rnd_rankvalue]
wiki's
[https://www.sdn.sap.com/irj/sdn/advancedsearch?cat=sdn_wiki&query=webdynproJavatutorials&adv=false&sortby=cm_rnd_rankvalue]
and also you can search in forums.
Regards
Raghu -
MDM Java API Samples Framework
hi MDM experts,
I need MDM Java API Samples Framework.zip file
its urgent help me
thanks
ram.[Try this document|https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/c0eb1f75-136d-2a10-99b2-ea60f1dee9e8] there is a link in there to the ZIP you are looking for.
-
Where is "MDM Java API Samples Framework.zip"?
hi everyone,
I was reading the "How To Use tthe MDM Java API" document (https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/c0eb1f75-136d-2a10-99b2-ea60f1dee9e8) and it referenced a zip file called "MDM Java API Samples Framework.zip".
Unfortunately I cannot seem to find that zip file anywhere!
Does anyone know where I can find this file so that I can look at the examples?
Thanks very much,
mmHello Mike:
Go here:
Data Unification How-to Guides for SAP NetWeaver 7.0 [original link is broken]
And the First howTo has the "attached system files". Inside you'll find what you are looking for
Kind Regards
Alejandro -
SSO SDK Java Sample Application
I have configured the sample application (servlet-based), shown in SSO SDK Developer guide.
I followed all the steps very carefully. When I try to access the partner application, it redirect me to
the login form of the Login Server, and then loop between the sign-on URL and the requested URL.
It seems that the cookie with the user name is lost during redirection. The readme file refers that in a case like this I should check the value of the application cookie domain.
I am running the sample in a single pc environment and my server name is localhost. Which is the right value for the application cookie domain (localhost, .localhost ?????).
In addition, my cookie path value is "/".
Thanks in advance.This problem is their in the early version of SDK.
The latest version has correct comparison with null -
Web Services API Sample w/ Filters
Does anyone know how to use a Filter in a doOracleSearch call using the Java proxies supplied for the Web Services API? I tried doing this but it appears there is a conflict with Servlet Filter class. When I used the complete path to the class, it compiles, but upon deployment and execution on OC4J I get a symbol not found error. Here is an excerpt of the problem code:
if( query != null && search_type.equals("advanced") )
String str_doc_type = request.getParameter("document_type");
int start = orderByDate ? 1 : startIndex;
int hits = orderByDate ? recencyHits : pageHitCount;
oracle.search.query.webservice.client.Filter[] myfilterArray = null;
oracle.search.query.webservice.client.Filter filterDocType = new oracle.search.query.webservice.client.Filter(112,"string","equals","4918");
myfilterArray[0] = filterDocType;
try
res = ctx.doOracleSearch(
query, // query
new Integer( start ), // start index
new Integer( hits ), // documents requested
Boolean.TRUE, // duplicates removed
Boolean.FALSE, // duplicates marked
groups, // data groups
locale.getLanguage(), // query language
null, // document language
Boolean.TRUE, // return count
null, // filter connector
myfilterArray, // filters
null // fetch attributes
catch( Exception e )
searchException = e;
}Hi,
I am trying to deploy this sample application. I received the following error:
[oracle@dev1 home]$ /home/oracle/oracle/product/10.1.8/ses1/jdk/jre/bin/java -ja
r /home/oracle/oracle/product/10.1.8/ses1/oc4j/j2ee/home/admin_client.jar deploy
er:oc4j:dev1.psa:5740 oc4jadmin oraidev1 -deploy -file /home/oracle/oracle/produ
ct/10.1.8/ses1/oc4j/j2ee/OC4J_SEARCH/applications/sample.ear -deploymentName ses
_query -bindAllWebApps http-web-site
08/05/20 11:20:29 Notification ==>Application Deployer for ses_query STARTS.
08/05/20 11:20:29 Notification ==>Copy the archive to /home/oracle/oracle/produc
t/10.1.8/ses1/oc4j/j2ee/OC4J_SEARCH/applications/ses_query.ear
08/05/20 11:20:29 Notification ==>Initialize /home/oracle/oracle/product/10.1.8/
ses1/oc4j/j2ee/OC4J_SEARCH/applications/ses_query.ear begins...
08/05/20 11:20:29 Notification ==>Unpacking ses_query.ear
08/05/20 11:20:29 Notification ==>Error while unpacking ses_query.ear
java.util.zip.ZipException: error in opening zip file
at java.util.zip.ZipFile.open(Native Method)
at java.util.zip.ZipFile.<init>(ZipFile.java:112)
at java.util.jar.JarFile.<init>(JarFile.java:127)
at java.util.jar.JarFile.<init>(JarFile.java:92)
at oracle.oc4j.util.FileUtils.unjar(FileUtils.java:309)
at oracle.oc4j.util.FileUtils.autoUnpack(FileUtils.java:488)
at com.evermind.server.deployment.EnterpriseArchive.<init>(EnterpriseArc
hive.java:234)
at oracle.oc4j.admin.internal.ApplicationDeployer.initArchive(Applicatio
nDeployer.java:412)
at oracle.oc4j.admin.internal.ApplicationDeployer.doDeploy(ApplicationDe
ployer.java:187)
at oracle.oc4j.admin.internal.DeployerBase.execute(DeployerBase.java:93)
at oracle.oc4j.admin.jmx.server.mbeans.deploy.OC4JDeployerRunnable.doRun
(OC4JDeployerRunnable.java:52)
at oracle.oc4j.admin.jmx.server.mbeans.deploy.DeployerRunnable.run(Deplo
yerRunnable.java:81)
at com.evermind.util.ReleasableResourcePooledExecutor$MyWorker.run(Relea
sableResourcePooledExecutor.java:298)
at java.lang.Thread.run(Thread.java:534)
08/05/20 11:20:29 Notification ==>Operation failed with error:
Unable to find/read file META-INF/application.xml in /home/oracle/oracle/product
/10.1.8/ses1/oc4j/j2ee/OC4J_SEARCH/applications/ses_query (META-INF/application.
xml)
Deploy error: Deploy error: Operation failed with error:
Unable to find/read file META-INF/application.xml in /home/oracle/oracle/product
/10.1.8/ses1/oc4j/j2ee/OC4J_SEARCH/applications/ses_query (META-INF/application.
xml)
Please help!!
Thanks!
Regards,
Deva -
Performance issue with Business Objects Java JRC API in CRXI R2 version
A report is developed using java JRC API in CR XI release 2. When I generate the report in the designer, it took less than 5 seconds to display the results in crystal report viewer inside the designer. But in the QA environment, when I generate the same report from the application, it takes almost 1 to 1.5 minutes to display the same results in PDF. I also noticed that if the dataset contains bigger volume of data, then the reports are taking even longer almost 15 to 20 minutes.
While generating the report from the application, I noticed that most of time is taken during the execution of the com.crystaldecisions.report.web.viewer.ReportExportControl Object method as shown in following line of code
exportControl.processHttpRequest(request, response, context, null)
We thought the delay in exporting the report to PDF might be the layout of the report and data conversion to PDF for such a bigger volume of data.
Then we investigated the issue and experimented quickly to generate the same report with same result set data from the application using XML, XSL and converted the output XSL-FO to PDF using Apache FOP (Formatting Objects Processor) implementation. The time taken to export the report to PDF is less than 6 seconds. By doing this experiment, it is proved that the issue is not with conversion of data to PDF but it is the performance problem with Business Objects Java JRC API in CR XI R2.
In this regard, I searched for the above issue in the SAP community Network Forums -> Crystal Reports and Xcelsius -> Java Development -> Crystal Reports. But I did not find any answers or solutions for this kind of issue in the forums.
Any suggestion, hint in this matter is very much appreciated.Ted, The setReportAppServer problem is resolved. Now I could able to generate the report with hardcoded values in the SQLs in just 6 seconds where as the same report was generated in CRXI R2 in 1 minute 15 seconds as mentioned in the earlier message.
But, our exisiting application passes the parameter values to the SQLs embedded in the report. For some reason the parameters are not being passed to the report and the report displays only the labels without data.
As per the crj 12 samples codes, the code is written as shown below.
1. Created ReportClient Document
2. SetReportAppServer
3. Open the report
4. Getting DatabaseController and switching the database connection at runtime
5. Then setting the parameters as detailed below
ParameteFields parameterFieldController = reportClientDoc.getDataDefController().getParameterFieldController();
parameterFieldController.setCurrentValue("", "paramname",paramvalue);
parameterFieldController.setCurrentValue("", "paramname",paramavalue);
byteArrayInputStream = (ByteArrayInputStream)reportClientDoc.getPrintOutputController().export(ReportExportFormat.PDF);
6. Streaming the report to the browser
Why the parematers are not being passed to the report? Do I need to follow the order of setting these parameters? Did I miss any line of code for setting Params using crj 12?
Any help in this regard would be greatly appreciated. -
Attn: Installing the Sample Applications from the ifs Development Kit
There are a number of problems with the sample Applications included in the
Developer's kit. These need to manually fixed in order to get the demos to work.
#1: Solaris Only
The install of the iFS Development Kit, replaces the existing adk.jar with a new
one containing some additional classes. Unfortunately the install process does not
set the correct privileges on the new version of adk.jar. Please ensure that the
file $ORACLE_HOME/ifs/lib/adk.jar is world readable.
Bug # 1304730
This issue will be resolved on the next drop of the Oracle Internet File System
development kit.
#2: Generic
There is a problem with the way in which the login.jsp establishes a connection to
the repository. The current code makes incorrect assumptions about the name of the
iFS Service and the schema password.
The following changes are required.
In order to connect to the repository 4 pieces of information are required.
1. The iFS User Name
2. The iFS User's password
3. The properties file to be used
4. The database password of the user who owns the iFS Schema
The Login.jsp needs to be altered so that it requests these four arguments before
attempting to establish a connection to the repository.
(The current version only requests username and password).
All four arguments need to be provided as arguments to the login method on the
underlying JavaBean that the JSP invokes when it want to open a connection
to the repository.
***************** HERE IS THE REVISED CODE FOR INSURANCE APPLICATIONS ************
********************************** LOGIN.JSP *************************************
<%@ page import = "ifsdevkit.sampleapps.insurance.InsuranceLogin" %>
<%@ page import = "oracle.ifs.adk.security.IfsHttpLogin" %>
<html><head>
<jsp:useBean id="inslogin" scope="session" class="ifsdevkit.sampleapps.insurance.InsuranceLogin" />
<jsp:setProperty name="inslogin" property="*"/>
<%
String REDIRECT_PATH = "/public/examples/insuranceApp/claims";
boolean loggedIn = false;
if (inslogin.getSession() != null && inslogin.getResolver() != null)
// Use existing insurance login
loggedIn = true;
else
// No existing insurance login
IfsHttpLogin login = (IfsHttpLogin) request.getSession(true).getValue("IfsHttpLogin");
if (login != null && login.getSession() != null && login.getResolver() != null)
// Use existing IfsHttpLogin login
inslogin.init(login.getSession(), login.getResolver());
loggedIn = true;
if (!loggedIn)
String username = request.getParameter("username");
String password = request.getParameter("password");
String serviceName = request.getParameter("serviceName");
String schemaPassword = request.getParameter("schemaPassword");
if (username != null && password != null &&
!username.trim().equals("") && !password.trim().equals(""))
// Login using username/password
try
if (serviceName == null | | serviceName.trim().equals(""))
serviceName = "IfsDefault";
inslogin.init(username, password, serviceName, schemaPassword);
request.getSession(true).putValue("IfsHttpLogin", inslogin);
loggedIn = true;
catch (Exception e)
%>
<SCRIPT LANGUAGE="JavaScript1.2">
alert("The username or Password was not valid, please try again.");
</SCRIPT>
<%
if (loggedIn)
// Redirect to the directory where the claim files reside
response.sendRedirect(REDIRECT_PATH);
else
%>
<title>Insurance Demo App Login</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body bgcolor="#FFFFFF">
<form METHOD=POST NAME="loginform" ACTION="login.jsp">
<table>
<tr>
<td><b>Username:</b></td>
<td><input type="text" name="username" value=""></td>
</tr>
<tr>
<td><b>Password:</b></td>
<td><input type="password" name="password" value=""></td>
& lt;/tr>
<tr>
<td><b>Service Name:</b></td>
<td><input type="text" name="serviceName" value="IfsDefault"></td>
</tr>
<tr>
<td><b>Schema Password:</b></td>
<td><input type="password" name="schemaPassword" value=""></td>
</tr>
<tr>
<td> </td>
<td> </td>
</tr>
<tr>
<td>
<input type="submit" value="Log in">
</td>
<td>
<input type="reset" value="Reset">
</td>
</tr>
</table>
</form>
</body>
</html>
<% } %>
*************************** END INSURANCE LOGIN.JSP ******************************
This code has been changed so that it requests the four agruments that are required
to connect to the repository and passes them to the login method on the underlying
bean. Note that we have provided the complete source code to this file in order to
make it simple to deploy the revised version of the code. Simply cut and paste this
code into a new file called login.jsp. Copy the File into the iFS
repository folder /ifs/jsp-bin/ifsdevkit/sampleapps/insurance.
****************************** INSURANCELOGIN.JAVA *******************************
package ifsdevkit.sampleapps.insurance;
* Copyright (c) 2000 Oracle Corporation. All rights reserved.
import java.util.Locale;
import javax.servlet.http.HttpSessionBindingEvent;
import oracle.ifs.beans.DirectoryUser;
import oracle.ifs.beans.FolderPathResolver;
import oracle.ifs.beans.LibrarySession;
import oracle.ifs.beans.LibraryService;
import oracle.ifs.common.CleartextCredential;
import oracle.ifs.common.ConnectOptions;
import oracle.ifs.common.IfsException;
import oracle.ifs.adk.security.IfsHttpLogin;
* The login bean for the Insurance demo app.
* <p>
* This class provide the login info. The class implements the
* <code>IfsHttpLogin</code> interface so it can share login data with other
* login beans.
* @author Edward Yu
* @version 1.0
* @see IfsHttpLogin
public class InsuranceLogin implements IfsHttpLogin
* The <code>LibrarySession</code>.
private LibrarySession m_session;
* The <code>FolderPathResolver</code>.
private FolderPathResolver m_resolver;
* Default constructor required by the jsp spec for the USEBEAN tag
* @exception IfsException
public InsuranceLogin()
throws IfsException
* Make a connection to iFS
* @param username The username to be used for login.
* @param password The password to be used for login.
* @param serviceName The service name to be used for login.
* @param schemaPassword The schema password to be used for login.
* @exception IfsException if operation failed.
public void init(String username, String password, String serviceName,
String schemaPassword)
throws IfsException
LibraryService service = new LibraryService();
CleartextCredential me = new CleartextCredential(username, password);
ConnectOptions connection = new ConnectOptions();
connection.setLocale(Locale.getDefault());
connection.setServiceName(serviceName);
connection.setServicePassword(schemaPassword);
m_session = service.connect(me, connection);
m_resolver = new FolderPathResolver(m_session);
m_resolver.setRootFolder();
DirectoryUser user = m_session.getDirectoryUser();
if (user.isAdminEnabled())
m_session.setAdministrationMode(true);
* Initialize the login bean.
* <p>
* The default constructor does not set the necessary fields so it needs
* to be set instantiation.
* @param session The <code>LibrarySession</code> object.
* @param resolver The <code>FolderPathResolver</code> object.
public void init(LibrarySession session, FolderPathResolver resolver)
m_session = session;
m_resolver = resolver;
* Return the login's session object.
* @return The <code>LibrarySession</code> object.
public LibrarySession getSession()
return m_session;
* Return the login's path resolver.
* @return The <code>FolderPathResolver</code> object.
public FolderPathResolver getResolver()
return m_resolver;
* Called when this object is bound to the HTTP session object.
* @param event The event when the object is bound to the Http session.
public void valueBound(HttpSessionBindingEvent event)
// do nothing
* Called when this object is unbound from the HTTP session object.
* @param event The event when the object is unbound to the Http session.
public void valueUnbound(HttpSessionBindingEvent event)
m_resolver = null;
try
if (m_session != null)
m_session.disconnect();
catch (IfsException e)
e.printStackTrace();
finally
m_session = null; // release the resources
*****************************END INSURANCELOGIN.JAVA ******************************
This code has been changed so that it accepts the four agruments that are required
to connect to the repository and uses them to connect to the repository. Note that
we have provided the complete source code to this file in order to make it simple
to deploy the revised version of the code. Simply cut and paste this
code into a new file called. Save the file on the native file system
in a file called InsuranceLogin.java in the directory
$ORACLE_HOME/ifs/ifsdevkit/sampleapps/insurance/
*************** HERE IS THE REVISED CODE FOR WEB COMMAND APPLICATIONS ************
********************************** LOGIN.JSP *************************************
<%@ page import = "ifsdevkit.sampleapps.webcommandapp.WebCommandLogin" %>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<meta name="Author" content="Patricia Li">
<title>Login</title>
</head>
<jsp:useBean id="wclogin" scope="session" class="ifsdevkit.sampleapps.webcommandapp.WebCommandLogin" />
<jsp:setProperty name="wclogin" property="*"/>
<%
String REDIRECT_PATH = "/ifs/ifsdevkit/sampleapps/WebCommandApp/html/main.html";
boolean loggedIn = false;
if (wclogin.getSession() != null)
// Use existing WebCommand login
loggedIn = true;
else
String username = request.getParameter("username");
String password = request.getParameter("password");
String serviceName = request.getParameter("serviceName" );
String schemaPassword = request.getParameter("schemaPassword");
if (username != null && password != null)
// Login to iFS
try
wclogin.init(username, password, serviceName, schemaPassword);
request.getSession(true).putValue("IfsHttpLogin", wclogin);
loggedIn = true;
catch (Exception e)
%>
<SCRIPT LANGUAGE="JavaScript1.2">
alert("The credentials are not valid; please try again.");
</SCRIPT>
<%
if (loggedIn == true)
// Go to main page...
response.sendRedirect(REDIRECT_PATH);
else
%>
<title>Web Command App Login</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body bgcolor="#FFFFFF">
<h2>WebCommand Application Login</h2>
<form METHOD=POST NAME="loginform" ACTION="login.jsp">
<table>
<tr>
<td><b>Username:</b></td>
<td><input type="text" name="username" value=""></td>
</tr>
<tr>
<td><b>Password:</b></td>
<td><input type="password" name="password" value=""></td>
</tr>
<tr>
<td><b>Service Name:</b></td>
<td><input type="text" name="serviceName" value="IfsDefault"></td>
</tr>
<tr>
<td><b>Schema Password:</b></td>
<td& gt;<input type="password" name="schemaPassword" value=""></td>
</tr>
<tr>
<td> </td>
<td> </td>
</tr>
<tr>
<td>
<input type="submit" value="Log in">
</td>
<td>
<input type="reset" value="Reset">
</td>
</tr>
</table>
</form>
</body>
</html>
<% } %>
************************* END WEB COMMAND LOGIN.JSP ******************************
This code has been changed so that it requests the four agruments that are required
to connect to the repository and passes them to the login method on the underlying
bean. Note that we have provided the complete source code to this file in order to
make it simple to deploy the revised version of the code. Simply cut and paste this
code into a new file called login.jsp. Copy the File into the iFS repository folder
/ifs/jsp-bin/ifsdevkit/sampleapps/WebCommandApp
****************************WEBCOMMANDLOGIN.JAVA**********************************
package ifsdevkit.sampleapps.webcommandapp;
import java.util.Locale;
import oracle.ifs.beans.DirectoryUser;
import oracle.ifs.beans.FolderPathResolver;
import oracle.ifs.beans.LibrarySession;
import oracle.ifs.beans.LibraryService;
import oracle.ifs.common.CleartextCredential;
import oracle.ifs.common.ConnectOptions;
import oracle.ifs.common.IfsException;
import oracle.ifs.adk.filesystem.IfsFileSystem;
import oracle.ifs.adk.security.IfsHttpLogin;
import javax.servlet.http.HttpSessionBindingEvent;
* WebCommand application that illustrates the usage of the
* File System API.
* @version 1.0
* @pub
public class WebCommandLogin implements IfsHttpLogin
private LibrarySession m_session; // Session
private FolderPathResolver m_resolver; // Resolver
private IfsFileSystem m_ifs; // File System object
* Default constructor required by the jsp spec for the USEBEAN tag
public WebCommandLogin()
throws IfsException
* Make a connection to iFS
* @pub
public void init(String username, String password, String serviceName,
String schemaPassword)
throws IfsException
LibraryService service = new LibraryService();
CleartextCredential cred = new CleartextCredential(username, password);
ConnectOptions options = new ConnectOptions();
options.setLocale(Locale.getDefault());
options.setServiceName(serviceName);
options.setServicePassword(schemaPassword);
m_session = service.connect(cred, options);
m_resolver = new FolderPathResolver(m_session);
m_resolver.setRootFolder();
m_ifs = new IfsFileSystem(m_session);
DirectoryUser user = (DirectoryUser) m_session.getDirectoryUser();
if (user.isAdminEnabled())
m_session.setAdministrationMode(true);
* Use the existing connection.
* The default constructor does not set the necessary fields.
* @pub
public void init(LibrarySession session, FolderPathResolver resolver)
throws IfsException
m_session = session;
m_resolver = resolver;
m_ifs = new IfsFileSystem(m_session);
* Return the login's session
* @pub
public LibrarySession getSession()
return m_session;
* Return the login's path resolver
* @pub
public FolderPathResolver getResolver()
return m_resolver;
* Return the IfsFileSystem API object
* @pub
public IfsFileSystem getIfsFileSystem()
return m_ifs;
* Implementation of valueBound
* @pub
public void valueBound(HttpSessionBindingEvent e)
* Implementation of valueUnbound
* @pub
public void valueUnbound(HttpSessionBindingEvent e)
try
m_session.disconnect();
catch (IfsException ie)
************************* END WEBCOMMANDLOGIN.JAVA *******************************
This code has been changed so that it accepts the four agruments that are required
to connect to the repository and uses them to connect to the repository. Note that
we have provided the comple te source code to this file in order to make it simple
to deploy the revised version of the code. Simply cut and paste this code into a
new file called WebCommandLogin.java in the directory
$ORACLE_HOME/ifs/ifsdevkit/sampleapps/webcommandapp/
Compile the java class.
Copy the classfile to $ORACLE_HOME/ifs/custom_classes/ifsdevkit/sampleapps/webcommandapp/
Stop and Start all of the protocol servers.
This issue will be resolved on the next drop of the Oracle Internet File System
development kit.
#3. Making the BaseRendererClass available to the Protocol Servers
Note this step is not required if you have the 1.0.8.3 patch set installed.
Install the BaseRenderer Class. The BaseRenderer class is delivered in the jar file
ifsdevkit.jar and can be used to simplify the task of creating a custom renderer.
Unfortunately the jar file containing this class is not referenced in any of the Classpaths
used by the iFS protocol servers. This means that they will not be able to load any
customer renderers that extend BaseRenderer. In order to make BaseRenderer available
to the Protocol Servers it need to be placed in the appropriate directory under
<ORACLE_HOME>/ifs/custom_classes.
Extract the class from the ifsdevkit.jar.
ifsdevkit.jar is located in <ORACLE_HOME>/ifs/lib after the devkit has been installed.
jar -xvf ifsdevkit.jar
extracted: META-INF/MANIFEST.MF
extracted: BaseRenderer.class
Create the following directory heirachy in <ORACLE_HOME>/ifs/custom classes
oracle/ifs/server/renderers
Copy <ORACLE_HOME>/ifs/lib/BaseRenderer.class to
<ORACLE_HOME/ifs/custom_classes/oracle/ifs/server/renderers
That should do it.
Regards
Mark D. Drake
nullMoving to Top
-
Oracle Spatial book sample application
Hi all,
On Monday I received the Oracle Spatial book and I would like to post a topic about it. First of all I would like to congratulate the authors for their huge effort doing this excellent book. I think it will be very useful to the people that works with Spatial.
Next, my question is about the sample application showed in chapter 12 (SampleApplication.jsp). I run correctly mapviewer in my server and I can do the other examples, nevertheless when I want to start this application I recieve this error message about 'jdbc/spatial10g not found' in my web browser:
500 Internal Server Error
javax.naming.NameNotFoundException: jdbc/spatial10g not found
at com.evermind[Oracle Application Server Containers for J2EE 10g (9.0.4.0.0)].server.rmi.RMIContext.lookup(RMIContext.java:149)
at com.evermind[Oracle Application Server Containers for J2EE 10g (9.0.4.0.0)].server.ApplicationContext.lookup(ApplicationContext.java:248)
at com.evermind[Oracle Application Server Containers for J2EE 10g (9.0.4.0.0)].server.ApplicationContext.lookup(ApplicationContext.java:119)
at javax.naming.InitialContext.lookup(InitialContext.java:347)
at spatial2d_book._sample_2d_app._SampleApplication._jspService(_SampleApplication.java:264)
[SRC:/spatial-book/sample-app/SampleApplication.jsp:248]
at com.orionserver[Oracle Application Server Containers for J2EE 10g (9.0.4.0.0)].http.OrionHttpJspPage.service(OrionHttpJspPage.java:56)
at oracle.jsp.runtimev2.JspPageTable.service(JspPageTable.java:349)
at oracle.jsp.runtimev2.JspServlet.internalService(JspServlet.java:509)
at oracle.jsp.runtimev2.JspServlet.service(JspServlet.java:413)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at com.evermind[Oracle Application Server Containers for J2EE 10g (9.0.4.0.0)].server.http.ServletRequestDispatcher.invoke(ServletRequestDispatcher.java:765)
at com.evermind[Oracle Application Server Containers for J2EE 10g (9.0.4.0.0)].server.http.ServletRequestDispatcher.forwardInternal(ServletRequestDispatcher.java:317)
at com.evermind[Oracle Application Server Containers for J2EE 10g (9.0.4.0.0)].server.http.HttpRequestHandler.processRequest(HttpRequestHandler.java:790)
at com.evermind[Oracle Application Server Containers for J2EE 10g (9.0.4.0.0)].server.http.HttpRequestHandler.run(HttpRequestHandler.java:270)
at com.evermind[Oracle Application Server Containers for J2EE 10g (9.0.4.0.0)].server.http.HttpRequestHandler.run(HttpRequestHandler.java:112)
at com.evermind[Oracle Application Server Containers for J2EE 10g (9.0.4.0.0)].util.ReleasableResourcePooledExecutor$MyWorker.run(ReleasableResourcePooledExecutor.java:192)
at java.lang.Thread.run(Thread.java:534)
I am using Java 2 Runtime Environment version 1.4.2_02 and I think I have correctly configured the shared libraries in the oc4j server (sdoapi.jar, sdonm.jar, ojdbc14.jar, etc.). Anyway, I think I will be missing something but I don't know what.
I would be very grateful if somebody could help me.
Juan M.Hi Juan
Thanks for purchasing our book, and thanks also for the kind words.
I think I know what that problem is.
The application uses the network API. That API needs a database connection for the initial loading of the network. The connection used is provided by OC4J. This is done in the following code lines in the SampleApplication.jsp:
// Get JDBC database connection
InitialContext ic = new InitialContext();
DataSource ds = (DataSource) ic.lookup("jdbc/"+dataSource.toLowerCase());
Connection conn = ds.getConnection();
// Load network
net = NetworkManager.readNetwork(conn, networkName);
In other words, for this to work, you need a datasource defined for OC4J, called "jdbc/spatial10g" (since dataSource is defined by default to be "SPATIAL10G".
To define the datasource, refer to chapter 11, page 499, at the bottom of the page. You need to add the following to your data-sources.xml config file ($OC4J_HOME/j2ee/home/config/data-sources.xml):
<data-source
class="com.evermind.sql.DriverManagerDataSource"
name="spatial10g"
location="jdbc/spatial10gCore"
xa-location="jdbc/xa/spatial10gXA"
ejb-location="jdbc/spatial10g"
connection-driver="oracle.jdbc.driver.OracleDriver"
username="spatial"
password="spatial"
url="jdbc:oracle:thin:@localhost:1521:orcl101"
inactivity-timeout="30"
/>
(Adapt the url parameter to match your database definition)
Thanks for pointing out this problem. We will update the errata page (http://www.apress.com/book/errataDisplay.html?bID=315&sID=2374) with clearer instructions.
Albert Godfrind -
How to program and develop a Java TV API
Hi all,
I am a new for Java TV API
I want to programming a application for digital TV systems, but a don't know how can I begin.
I would have a step by step your help
code for a sample
what's emulator to test
environment to deploy
etc.
please help me.
thanksSee http://www.interactivetvweb.org
-
ANN : New Oracle XDK 10g Sample Application
Hello,
Check out this new Oracle XDK 10g Sample Application at http://otn.oracle.com/sample_code/tech/xml/index.html that demonstrates the Unicode Support of XDK using the scenario of a Real Estate Portal. This sample application also discusses the XSLT Extensions and illustrates the following features:
- Encoding XML documents in different character sets ( UTF-8, UTF-16, ISO-8859-1 )
- Sending and receiving XML documents over HTTP along with character encoding information
- Using single style-sheet for multilingual HTML page generation with the help of XSLT extension function facility provided by Oracle XDK 10g
- Storing XML documents in XMLType column of Oracle database along with appropriate encoding
- Generating XML documents on using Oracle XDK 10g DOM API's along with encoding attribute
The sample application supports two languages; English and French.
Regards,
OTN TeamI have got the following error when i run the WebServicesAssembler.jar
D:\Oracle\Oc4j\j2ee\home>java -jar d:/oracle/oc4j/webservices/lib/WebServicesAss
embler.jar -config etc/config.xml
Exception in thread "main" java.util.zip.ZipException: The system cannot find th
e path specified
at java.util.zip.ZipFile.open(Native Method)
at java.util.zip.ZipFile.<init>(ZipFile.java:105)
at java.util.jar.JarFile.<init>(JarFile.java:110)
at java.util.jar.JarFile.<init>(JarFile.java:52)
D:\Oracle\Oc4j\j2ee\home>java -jar WebServicesAssembler.jar -config etc/config.x
ml
Exception in thread "main" java.lang.InstantiationException: Unknown deployment
tag in JMS Web Service Example: <option>
at com.evermind.xml.XMLConfig.parseDeploymentMainNode(XMLConfig.java:293
at oracle.j2ee.ws.tools.WsAssemblerConfig.parseDeploymentMainNode(WsAsse
mblerConfig.java:68)
at com.evermind.xml.XMLConfig.parseRootNode(XMLConfig.java:268)
at com.evermind.xml.XMLConfig.init(XMLConfig.java:147)
at com.evermind.xml.XMLConfig.init(XMLConfig.java:88)
at oracle.j2ee.ws.tools.WsAssemblerConfig.init(WsAssemblerConfig.java:30
at oracle.j2ee.ws.tools.WsAssembler.main(WsAssembler.java:17) -
Problem using Java Mail API with WLS 7.0
Hi All,
I am trying to use the Java Mail API provided by WLS 7.0. I have made the
settings metioned in the WLS 7.0 docs. However when I try to run the program I
am getting the following error:
javax.naming.NoInitialContextException: Need to specify class name in environment
or system property, or as an applet parameter, or in an application resource file:
java.naming.factory.initial
at javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:6
46)
at javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:246
at javax.naming.InitialContext.getURLOrDefaultInitCtx(InitialContext.jav
a:283)
at javax.naming.InitialContext.lookup(InitialContext.java:350)
The code that I have written is as follows
import java.util.*;
import javax.activation.*;
import javax.mail.*;
import javax.mail.internet.*;
import javax.naming.*;
import java.io.*;
import java.net.InetAddress;
import java.util.Properties;
import java.util.Date;
public class MailTo {
public static void main(String args[])
try
//Context ic = getInitialContext();
InitialContext ic = new InitialContext();
/* My jndi name is "testSession" */
Session session = (Session) ic.lookup("testSession"); /* THE PROBLEM IS SHOWN
IN THIS LINE */
Properties props = new Properties();
props.put("mail.transport.protocol", "smtp");
props.put("mail.smtp.host", "XX.XX.XX.XX");
/* For security reasons I have written the ip add in this format */
props.put("mail.from", "[email protected]"); /* for security reasons i have
changed the mail address */
Session session2 = session.getInstance(props);
Message msg = new MimeMessage(session2);
msg.setFrom();
msg.setRecipients(Message.RecipientType.TO, InternetAddress.parse("[email protected]",
false));
msg.setSubject("Test Message");
msg.setSentDate(new Date());
MimeBodyPart mbp = new MimeBodyPart();
mbp.setText("This is a mail sent to you using JAVA Mail API and Weblogic Server");
Multipart mp = new MimeMultipart();
mp.addBodyPart(mbp);
msg.setContent(mp);
Transport.send(msg);
catch(Exception e)
e.printStackTrace();
}//end of main
public static Context getInitialContext()
throws NamingException
Properties p = new Properties();
p.put(Context.INITIAL_CONTEXT_FACTORY, "weblogic.jndi.WLInitialContextFactory");
p.put(Context.PROVIDER_URL, "t3://localhost:7501/testWebApp");
p.put(Context.SECURITY_PRINCIPAL, "weblogic");
p.put(Context.SECURITY_CREDENTIALS, "weblogic");
return new InitialContext(p);
}//end of class
Can anyone please tell me what is the problem. I thought that we cannot directly
do
InitialContext ic = new InitialContext();
So I had written a method getInitialContext() as shown in the above piece of code,
but that too did not work.
Eagerly awaiting a response.
Jimmy ShahYou can use InitialContext ic = new InitialContext() only if you are using a startup class, servlet or a JSP i.e
server side code.
If you are using a java client you need to use Context ic = getInitialContext();
Try this code
import java.util.*;
import javax.activation.*;
import javax.mail.*;
import javax.mail.internet.*;
import javax.naming.*;
import java.io.*;
import java.net.InetAddress;
import java.util.Properties;
import java.util.Date;
public class MailTo {
public static void main(String args[])
try {
Properties h = new Properties();
h.put(Context.INITIAL_CONTEXT_FACTORY,"weblogic.jndi.WLInitialContextFactory");
h.put(Context.PROVIDER_URL, "t3://localhost:7001");
Context ic = new InitialContext(h);
Session session = (Session) ic.lookup("testSession");
Properties props = new Properties();
props.put("mail.transport.protocol", "smtp");
props.put("mail.smtp.host", "XX.XX.XX.XX");
props.put("mail.from", "[email protected]");
Session session2 = session.getInstance(props);
Message msg = new MimeMessage(session2);
msg.setFrom();
msg.setRecipients(Message.RecipientType.TO,InternetAddress.parse("[email protected]",false));
msg.setSubject("Test Message");
msg.setSentDate(new Date());
MimeBodyPart mbp = new MimeBodyPart();
mbp.setText("This is a mail sent to you using JAVA Mail API and Weblogic Server");
Multipart mp = new MimeMultipart();
mp.addBodyPart(mbp);
msg.setContent(mp);
Transport.send(msg);
catch(Exception e)
e.printStackTrace();
}//end of main
}//end of class
We have shipped a javamail example in the samples\server\src\examples\javamail folder.
Jimmy Shah wrote:
Hi All,
I am trying to use the Java Mail API provided by WLS 7.0. I have made the
settings metioned in the WLS 7.0 docs. However when I try to run the program I
am getting the following error:
javax.naming.NoInitialContextException: Need to specify class name in environment
or system property, or as an applet parameter, or in an application resource file:
java.naming.factory.initial
at javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:6
46)
at javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:246
at javax.naming.InitialContext.getURLOrDefaultInitCtx(InitialContext.jav
a:283)
at javax.naming.InitialContext.lookup(InitialContext.java:350)
The code that I have written is as follows
import java.util.*;
import javax.activation.*;
import javax.mail.*;
import javax.mail.internet.*;
import javax.naming.*;
import java.io.*;
import java.net.InetAddress;
import java.util.Properties;
import java.util.Date;
public class MailTo {
public static void main(String args[])
try
//Context ic = getInitialContext();
InitialContext ic = new InitialContext();
/* My jndi name is "testSession" */
Session session = (Session) ic.lookup("testSession"); /* THE PROBLEM IS SHOWN
IN THIS LINE */
Properties props = new Properties();
props.put("mail.transport.protocol", "smtp");
props.put("mail.smtp.host", "XX.XX.XX.XX");
/* For security reasons I have written the ip add in this format */
props.put("mail.from", "[email protected]"); /* for security reasons i have
changed the mail address */
Session session2 = session.getInstance(props);
Message msg = new MimeMessage(session2);
msg.setFrom();
msg.setRecipients(Message.RecipientType.TO, InternetAddress.parse("[email protected]",
false));
msg.setSubject("Test Message");
msg.setSentDate(new Date());
MimeBodyPart mbp = new MimeBodyPart();
mbp.setText("This is a mail sent to you using JAVA Mail API and Weblogic Server");
Multipart mp = new MimeMultipart();
mp.addBodyPart(mbp);
msg.setContent(mp);
Transport.send(msg);
catch(Exception e)
e.printStackTrace();
}//end of main
public static Context getInitialContext()
throws NamingException
Properties p = new Properties();
p.put(Context.INITIAL_CONTEXT_FACTORY, "weblogic.jndi.WLInitialContextFactory");
p.put(Context.PROVIDER_URL, "t3://localhost:7501/testWebApp");
p.put(Context.SECURITY_PRINCIPAL, "weblogic");
p.put(Context.SECURITY_CREDENTIALS, "weblogic");
return new InitialContext(p);
}//end of class
Can anyone please tell me what is the problem. I thought that we cannot directly
do
InitialContext ic = new InitialContext();
So I had written a method getInitialContext() as shown in the above piece of code,
but that too did not work.
Eagerly awaiting a response.
Jimmy Shah--
Rajesh Mirchandani
Developer Relations Engineer
BEA Support
Maybe you are looking for
-
Changes to Pre-Insallation of Win 8.1 pro
I am looking into buying a new laptop ( 16 GB Memory, 1+ TB storage with SDD, etc) would like to have several drives - c,d,e, f, etc each for separate Relational databases SQL Server version(S), Oracle, DB2 and such for my convenience. The pre-instal
-
Property change listener error with jtabbedpane
Greetings I have a property change listener on my jtabbedpane (2 panes (index 0 of course and index 1). my problem is when i want to run my app it gives me a java null pointer exception. I believe it is b/c it is starting the app and it see the prope
-
Creating Photo Collages with Automator
Hi. I'd like to use automator to create a photo collage from a set of pictures. Let's say I have four pictures, each of varying dimensions. They're named sequentially in the order I'd like them to appear. I'd like an automator script that would take
-
My older iMac is having frequent kernel panics. They occur most often after waking the computer up or while online. If I do a safe boot I am able to go online and put the computer to sleep and wake it up with no problem. Does the fact that it seems t
-
Only Illustrator crashing on Startup OS X 8.5
Please help ... I am getting the following error Process: Adobe Illustrator [430] Path: /Applications/Adobe Illustrator CS4/Adobe Illustrator.app/Contents/MacOS/Adobe Illustrator Identifier: com.adobe.illustrator Version: