venkat paruchuri

Greenhorn
+ Follow
since Aug 15, 2001
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by venkat paruchuri

I have an EJB running on Websphere application. I have written a sample client which is as JSP file running on Tomcat. I am able to connect to Websphere from Tomcat and lookup the EJB registered with JNDI server of Websphere as below.

Hashtable env = new Hashtable();
env.put(Context.INITIAL_CONTEXT_FACTORY, "com.ibm.websphere.naming.WsnInitialContextFactory");

1. InitialContext initContext = new InitialContext(env);
2. System.out.println("Before looking up HelloJavaHome.");
3. Object obj = initContext.lookup("ejb/HelloJavaHome");
4. System.out.println("After lookup javahome.");
5. HelloJavaHome home = (HelloJavaHome);
6. javax.rmi.PortableRemoteObject.narrow(obj, HelloJavaHome.class);
7.System.out.println("After narrowing home object");
8. HelloJava remote = home.create();
9. String greeting = remote.getGreeting("John Smith");
10. System.out.println("Greeting :" + greeting);

I am getting the following exception after printing the statement at line 7.


java.lang.ClassCastException
at com.sun.corba.se.internal.iiop.ShutdownUtilDelegate.isLocal(ShutdownUtilDelegate.java:39)
at javax.rmi.CORBA.Util.isLocal(Util.java:262)
at com.mycompany._HelloJavaHome_Stub.create(_HelloJavaHome_Stub.java:202)
at com.mycompany.client.RemoteConn.connect(RemoteConn.java:62)
at com.mycompany.client.Greeting.getGreeting(Greeting.java:130)
at com.mycompany.Wsconnect.getGreeting(Wsconnect.java:11)
at org.apache.jsp.index_jsp._jspService(index_jsp.java:63)
at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:137)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:210)
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:295)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:241)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:247)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:193)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:256)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
at org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2422)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:180)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
at org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatcherValve.java:171)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:163)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:174)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
at org.apache.coyote.tomcat4.CoyoteAdapter.service(CoyoteAdapter.java:199)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:828)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:700)
at org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:584)
at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:683)
at java.lang.Thread.run(Thread.java:534)

I have set the client jar file of EJB application (which includes META-INF and application-client.xml and ibm-application-client-bind.xml files) in class path of the webapplication in Tomcat. Also I added the following lines in the web.xml file of the webapplication in Tomcat.

<ejb-ref>
<ejb-ref-name>ejb/HelloJava</ejb-ref-name>
<ejb-ref-type>Session</ejb-ref-type>
<home>com.deque.HelloJavaHome</home>
<remote>com.deque.HelloJava</remote>
<ejb-link>HelloJava</ejb-link>
</ejb-ref>


Has anybody experienced this problem? Can anybody help me why I am getting ClassCastException? The same program ran successfully from command line without any problem. I greatly appreciate if somebody could help me ASAP.
Thanks in advance
Is it possible to set some directories in java extension diretories path before JVM has started?

If possible I would appreciate your help in this regard.

Unfortunately I can not lauch my client program from a shortcut. I need to call my client from a third party application.
18 years ago
I am running a prgram from command line which requires to pass command line argument with -D option to set several directories in the JVM for java extension mechanism.

I could successfully run my program as below by using a variable.
set EXT_DIRS = "C:\Progra~1\IBM\AppClient\java\jre\lib\ext;C:\Progra~1\IBM\AppClient\classes;C:\Progra~1\IBM\AppClient\lib;C:\Progra~1\IBM\AppClient\lib\ext;C:\Progra~1\IBM\AppClient\java\lib;C:\Progra~1\IBM\AppClient\java\jre\lib;C:\Progra~1\IBM\AppClient\properties;C:\Progra~1\IBM\AppClient\java\jre\lib;C:\Progra~1\IBM\AppClient\java\jre\lib\ext;"

java -Djava.exit.dirs %EXT_DIRS% com.mycompany.client

But I want to set the extension directories in the java program rather than passing at commandline. So, I tried using the System.setProperty("java.ext.dirs", "list of directories in EXT_DIRS");

But I did not work for me. I guess it is a security issue. Is there a way or workaround to accomplish my task?

Immediate help is greatly appreciated.
18 years ago
I am trying to use JSP running on Tomcat as client to EJB application deployed on websphere.

I have created a folder by name 'myclient' under "C:\Program Files\Apache Group\Tomcat 4.1\webapps". I also created subfolders 'WEB-INF' and 'lib' under 'myclient'. I have added an ejb reference in web.xml file under 'WEB-INF' as below.

<ejb-ref id="EjbRef_1">
<ejb-ref-name>ejb/HelloJavaHome</ejb-ref-name>
<ejb-ref-type>Session</ejb-ref-type>
<home>HelloJavaHome</home>
<remote>HelloJava</remote>
<ejb-link>HelloJava</ejb-link>
</ejb-ref>

I have placed client jar of my EJB application in 'lib' folder along with other jar files that are picked up from websphere runtime enviromment to interact with EJB deployed on websphere. These jar files include,

j2ee.jar
bootstrap.jar
ejbcontainer.jar
lmproxy.jar
naming.jar
namingclient.jar
ras.jar
server.jar
wsexception.jar
myappclient.jar (client jar file of my EJB application)

I have written a sample JSP file to execute it in Tomcat which interacts with EJB on websphere. The JSP code snippet to communicate with EJB is,

//////////////////////////////////
index.jsp
-------------

<%@ page import="java.util.Hashtable" %>

<%@ page import="javax.ejb.EJBHome" %>
<%@ page import="javax.ejb.EJBObject" %>

<%@ page import="javax.naming.Context" %>
<%@ page import="javax.naming.InitialContext" %>

<%@ page import="HelloJavaHome" %>
<%@ page import="HelloJava" %>

<%
String name = request.getParameter("name");
String greeting = "";

try{
if(name != null) {

Hashtable env = new Hashtable();
env.put(Context.INITIAL_CONTEXT_FACTORY, "com.ibm.websphere.naming.WsnInitialContextFactory");
env.put(Context.PROVIDER_URL, "iiop://localhost:2809");
InitialContext initContext = new InitialContext(env);
System.out.println("Initial contect created");
Object obj = initContext.lookup("java:comp/env/ejb/HelloJavaHome");
System.out.println("Lookup successful");
HelloJavaHome home = (HelloJavaHome) javax.rmi.PortableRemoteObject.narrow(obj,HelloJavaHome.class);
HelloJava remote = home.create();
greeting = remote.getGreeting(name);

System.out.println("Greeting :" + greeting);


}
}
catch(Exception e){
greeting = e.getMessage();
}

%>

////////////////////////////////////////

I am getting below compilation errors when I invoked index.jsp after I have started both websphere and tomcat servers.



[javac] Compiling 1 source file
[javac] C:\Program Files\Apache Group\Tomcat 4.1\work\Standalone\localhost\myclient\index_jsp.java:67: cannot access javax.ejb.EJBHome
[javac] file javax\ejb\EJBHome.class not found
[javac] HelloJava remote = home.create();
[javac] ^
[javac] C:\Program Files\Apache Group\Tomcat 4.1\work\Standalone\localhost\myclient\index_jsp.java:68: cannot access javax.ejb.EJBObject
[javac] file javax\ejb\EJBObject.class not found
[javac] greeting = remote.getGreeting(name);
[javac] ^
[javac] 2 errors


I appreciate if somebody could help me fixing the above errors ASAP. Thanks in advance
I am trying to establish communication between two app servers. I have a sample EJB deployed on Websphere and wish to call its business methods from a JSP page which is running on Apache Tomcat server. (ie) Tomcat is client to websphere. Is it possible to do? If so, what are the client Jar files of websphere that I should make available to JSP page on Tomcat? Do I need to set any Jars in Tomcat environment variables? Lood forward for your immediate help. Thanks in advance.
Hi,

I am using websphere studio 5.1.2 with fix pack 3. I have a sample Stateless Session Bean (EJB) deployed and running on websphere.

I wrote a small Java client program as below.


import java.util.Hashtable;

import HelloJavaHome;
import HelloJava;
import javax.naming.InitialContext;
import javax.naming.Context;

import javax.ejb.EJBHome;
import javax.ejb.EJBObject;

public class RemoteConn {

public static void main(String[] ar) throws Exception{
String greeting = "";

try{

Hashtable env = new Hashtable();
//env.put(Context.INITIAL_CONTEXT_FACTORY, "com.ibm.websphere.naming.WsnInitialContextFactory");
//env.put(Context.INITIAL_CONTEXT_FACTORY, "com.ibm.ejs.ns.jndi.CNInitialContextFactory");

env.put(Context.INITIAL_CONTEXT_FACTORY, "com.ibm.ws.naming.util.WsnInitCtxFactory");

//env.put(Context.PROVIDER_URL, "corbaloc:iiop:myhost.mycompany.com:2809/NameServiceCellPersistentRoot");

env.put(Context.PROVIDER_URL, "iiop://localhost:2809");

System.out.println("Before creating context ");

InitialContext initContext = new InitialContext(env);

System.out.println("Before looking up HelloJavaHome.");

//Object obj = initContext.lookup("java:comp/env/ejb/HelloJavaHome");
Object obj = initContext.lookup("ejb/HelloJavaHome");

System.out.println("After lookup javahome.");

HelloJavaHome home = (HelloJavaHome) javax.rmi.PortableRemoteObject.narrow(obj, HelloJavaHome.class);
HelloJava remote = home.create();
greeting = remote.getGreeting("John");
}
catch(Exception e){
e.printStackTrace();
}

System.out.println("Greeting::"+ greeting);
}
}


I did not have any problem if I write and run this client from Websphere studio environment..

However its giving lot of compilation and runtime errors when I tried to run from command line.

I could eliminated compilation errors by setting the below jar files in the classpath.

testclient.jar; (client jar of my EJB)
j2ee.jar;
naming.jar;ras.jar;
wsexception.jar;
bootstrap.jar;
namingclient.jar;
websphere.jar;server.jar;
ejbcontainer.jar;
ecutils.jar;

Now it is throwing runtime error after the statement, "Before looking up HelloJavaHome.", has printed. Here is the stack trace of exception ..

Exception in thread "main" java.lang.NoClassDefFoundError: com.ibm.CORBA.iiop.GlobalORBFactory
at com.ibm.ejs.oa.EJSORBImpl.class$(EJSORBImpl.java:44)
at com.ibm.ejs.oa.EJSORBImpl.initializeORB(EJSORBImpl.java:195)
at com.ibm.ejs.oa.EJSClientORBImpl.(EJSClientORBImpl.java:93)
at com.ibm.ejs.oa.EJSClientORBImpl.(EJSClientORBImpl.java:65)
at com.ibm.ejs.oa.EJSORB.init(EJSORB.java:385)
at com.ibm.ws.naming.util.Helpers.getOrb(Helpers.java:284)
at com.ibm.ws.naming.util.WsnInitCtxFactory.getInitialContextInternal(WsnInitCtxFactory.java:369)
at com.ibm.ws.naming.util.WsnInitCtx.getContext(WsnInitCtx.java:112)
at com.ibm.ws.naming.util.WsnInitCtx.getContextIfNull(WsnInitCtx.java:422)
at com.ibm.ws.naming.util.WsnInitCtx.lookup(WsnInitCtx.java:143)
at javax.naming.InitialContext.lookup(InitialContext.java:347)
at RemoteEJBConn.main(RemoteEJBConn.java:38)

I appreciate if sombody could help me ASAP fixing this problem.
I am new to using Sun ONE application server. My requirement is to capture a remote image file through EJB and save it on the hard disk rather than saving to databse and should be used by webserver (Tomcat in Sun ONE) to display the preview of created image to the user. In order to fulfill my requirement, which location the image file should be created on the box (where Appserver was installed) and how to refer to this image file from webserver using http protocol to display the preview? I would really appreciate if somebody could help me ASAP.


Thanks in advance.
Hi,

I am trying to implement NTLM proxy authentication in my application. The implementation for Basic and Digest schemes has been pretty straight forward.

For Basic,
-------------
URL url = new URL("http://java.sun.com");
HttpURLConnection con = (HttpURLConnection) url.openConnection();

con.setRequestProperty("Proxy-Authenticate", "Basic realm="+ realmName);
String authentication = new sun.misc.BASE64Encoder().encode( (uname + ":"+ pwd).getBytes() );
con.setRequestProperty("Proxy-Authorization", "Basic "+ authentication );

similarly I could implement for Digest mechanism.

I have problem implementing it for NTLM authentication mechanism for Proxy. If a page in the server is protected using NTLM scheme, Internet Explorer will present a dialog to enter username, password and domain(if user belongs to different domain) to get access to the resource on the server.

I have requirment to implement the same in my java application using HTTP Connection. I have no idea how to set the domain, username and pwd in the connection object. I found some information on NTLM at http://davenport.sourceforge.net/ntlm.html which provides with an example in the bottom of the page. But, I did not understand how to set Type 1, Type 2 and Type 3 messages in the connection object.

I appreciate if somebody can help me out ASAP.

Thanks in advance.
Hi,

I need to authenticate HTTP request using NTLM scheme through proxy in my standalone application. I have taken look at http://davenport.sourceforge.net/ntlm.html and http://www.innovation.ch/java/ntlm.html and understood the theory described in them but the implementation is still unclear.

How do I create messages of type (1) , (2) and (3) to use them back and forth between client and server?

I would appreciate if somebody can help me with an example of

1) how to send NTLM negotiate to server ?
2) how to capture the server's challenge? and
3) how to send response back to server with credentials?

Thanks in advance
I am trying to validate my XML file against XML Schema using sun MSV (multi schema validator)and have problems with continuing validation after first missing attribute. I want all validation errors reported irrespective of whether they are missing, unexpected, or invalid. Multi Schema validator seemed the best choice since it supports multiple schemas (RelaxNG, schematron, W3C) but this is a show stopper for me.
Does anyone know how to continue past this problem or would you suggest using JAXB / JAXP (which one) instead?
I am including the code for reference:
// creating verifier object
VerifierFactory factory = new com.sun.msv.verifier.jarv.TheFactoryImpl();
Verifier verifier = (factory.compileSchema("sample.xsd").newVerifier();
//creating DOM tree
DocumentBuilderFactory domf = DocumentBuilderFactory.newInstance();
domf.setNamespaceAware(true);
DocumentBuilder builder = domf.newDocumentBuilder();
Document dom = builder.parse(new File("sample.xml"));
// validate DOM tree by Node wise...
validateElement(verifier, dom.getDocumentElement());

// methods to validate each node in the DOM
public void validateElement(Verifier verifier, Node node){
verifyElement(verifier, node);
NodeList nL = node.getChildNodes();
int len = nL.getLength();
for(int i=0; i<len; i++){
Node n = nL.item(i);
validateElement(verifier, n);
}
}

public void verifyElement(Verifier verifier, Node node){
try{
verifier.verify(node);
}
catch(ValidityViolation vv){
System.out.println(vv.getMessage() );
}
catch(Exception e){
e.printStackTrace();
}
}
code for sample.xsd
----------------------
<?xml version="1.0" encoding="UTF-8"?>
<xsd:schema xmlns:xsd="http://www.w3.org/2000/10/XMLSchema">
<xsd:element name="html">
<xsd:complexType>
<xsd:sequence>
<xsd:element ref="body"/>
</xsd:sequence>
<xsd:attribute name="lang" type="xsd:string" use="required"/>
</xsd:complexType>
</xsd:element>
<xsd:element name="body">
<xsd:complexType>
<xsd:sequence>
<xsd:element ref="img"/>
<xsd:element ref="p" />
</xsd:sequence>
<xsd:attribute name="bgcolor" type="xsd:string" use="required"/>
</xsd:complexType>
</xsd:element>

<xsd:element name="img">
<xsd:complexType>
<xsd:attribute name="src" type="xsd:string" use="required"/>
<xsd:attribute name="alt" type="xsd:string" use="required"/>
</xsd:complexType>
</xsd:element>
<xsd:element name="p" type="xsd:string" minOccurs="1" maxOccurs="1"/>
</xsd:schema>
code for sample.xml
--------------------
<html height="40">
<head>
<title>Sample XML file </title>
</head>
<body fgcolor="red" fgColor="white">
<img />
</body>
</html>

output of the program:
----------------------
unexpected attribute "height" in the tag "html"
tag name "head" is not allowed.
tag name "title" is not allowed.
unexpected attribute "fgColor" in the tag "body"
element "img" is missing "alt" attribute
Results expecting from the validator
----------------------------------------
1) should continue looking for "lang" attribute in <html> tag after encountering unknown attribute "height"
2) shoud continue looking for "src" attribute in <img> tag after reporting the missing "alt" attribute.
3) anticipating to report the missing element <p> which has minOccurs=1.
I would appreciate some quick responses as I am absolutely against a brick wall here!
Thanks in advance...
Venkat Paruchuri
Hi,
I have developed a swing application and made EXE using a thrid party software. I wrote autorun.ini file to extract my EXE automatically when CD is inserted into the CD Drive. The code to accomplish is
[autorun]
SHELL\CDStart=Start MyApp Setup
SHELL\CDStart\COMMAND=MyApp.exe
SHELL=CDStart
This particular code is working fine for windows OS.
Now I have created EXE of my application for Linux platform and has problem with auto extracting the EXE, like any other software for windows, when CD is inserted into CD drive. Is it possible to extract EXE automatically in Linux? I appreciate if anybody can help me out to fix this problem? Looking forward for immediate help..
thank you everybody
venkat
20 years ago
Hi Nathan,
Thank you very much for your help. It worked well for me. once again thanks a lot
venkat
21 years ago
Hi,
I am using JTree in my application. I can edit the tree node just by single mouse click and some pause or triple click on the node. I want to accomplish it using keyboard. For this, I have to provide menu item that should enable me editing the node (as in windows OS). I appreciate if anybody can help me in achieving this. Thanks in advance.
21 years ago
Hi friends,

Thank you very much for your help. I got a clue in my problem. I found a method in InterfaceA which will return an another interface object that is implemented by ClassC. That returned interface object being public object I got access from ClassD in package2. so, my problem is solved.
Once again thanks to all of you for your response.
venkat
[ February 25, 2002: Message edited by: venkat paruchuri ]
22 years ago
Hi friends,
I got a situation, how to access the memebers of protected inner class from another package.
The exact problem is, in a package1 there are three classes and one interface.
For example, in a package1,
ClassA has protected inner class called ClassB.
ClassB has protected inner class called ClassC.
ClassB implements interface called InterfaceA.
I have a class called ClassD in an other pacakge called package2, which has to access the public members of the protected inner class ClassC in package1.
pictorically,
package1;
class ClassA {
protected class ClassB implements InterfaceA {
protected class ClassC{
}
}
}
package2;
class ClassD{
how to access memebers of ClassC in package1?
}
I appreciate if any body can help me to overcome this problem. Thanks in advance..
[ February 15, 2002: Message edited by: venkat paruchuri ]
22 years ago