Win a copy of Microservices Testing (Live Project) this week in the Spring forum!

Rashi Gulati

Ranch Hand
+ Follow
since Jan 08, 2004
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 Rashi Gulati

env.put("java.naming.provider.url", "iiop://localhost:3700");

Make sure 3700 is the RMI port.

let's assume your default page is CheckLogin

By this your URL will be http://localhost:3700/CheckLogin.hello

But as CheckLogin is in a "EAR" under some package suppose it is "Default" then

env.put("java.naming.provider.url", "iiop://localhost:3700/Default");

and hence the url will be http://localhost:3700/Default/CheckLogin.hello

Hope this will help

Regards
Rashi
Hi SUJITH SUNIL KANAPARTHI

Class.forName(jdbc dbc:YourDriver) actually work this way:
YourDriver is a class which has a static block in that static block you are creating the instance of YourDriver class which in turn will call the DriverManager.registerDriver and hence will get registerd with the DriverManager as DriverManager maintains the list of all the drivers registered with it.
Something like this
class YourDriver implements Driver
{
static
{
YourDriver d = new YourDriver();
DriverManager.registerDriver(d);
}
}

Instead of writing Class.forName(jdbc dbc:YourDriver) you can also write a command on the command prompt like this
jdbc.drivers = jdbc dbc:YourDriver :jdbc dbc:YourDriver2:jdbc dbc:YourDriver3
and so on by this you are actually adding the Drivers to the java.lang.System property so when the DriverManager class is intialized it looks for jdbc.drivers if user has entered drivers then it will load them, by this you can specify more then one driver seprated with :

I hope this will help
Take care
Rashi
Thanks a ton Jeanne.

Regards
Rashi
17 years ago
Hi

I have to create a new desk/workspace in Websphere i don't know how to go about that can you please suggest some good online material on that.

Thanks
Regards
Rashi
17 years ago
Thanks a lot Jeanne.

Regards
Rashi
17 years ago
Hi All

Somehow i have changed the settings of Websphere and now if i make any changes in any of the java file then i have to rebuild the whole project in order to make those changes effective and it is time consuming process earlier when i used to save the java file then it use to compile the java file and all changes were apprant but now every time i make a change i have rebuild the whole project.
Could you please suggest some soliution for this. I am using

WebSphere Studio Application Developer (Windows)
Version: 5.1.0

Thanks
Regards
Rashi
17 years ago
Hi Ramnath

In that case try to restart your websphere. Most of the time this issue is resolved by restarting the websphere.

Rashi
17 years ago
Thanks alot Joe i have tried that and now it is working fine, that was really bugging me for so long.
Thanks alot
Regards
Rashi
18 years ago
Hi
I have written a program which takes the number from the user then calculate the factorial on that number and then create the file like 1.txt,2.txt and so on then write the factorial to this file but my problem is that iam able to create the file but iam not able to write it to the file iam enclosing the code as well please have alook.

import java.io.*;
import java.lang.*;

public class CalculateFactorialFile
{
String fileName,newfileName;
String ext =".txt";
int number,factorial,count;
File file;
InputStreamReader dataInput;
BufferedReader buffer;
FileWriter fileOutput;


int input()
{
int count=1;
int flag=0;
String s;
try
{
dataInput= new InputStreamReader(System.in);
buffer = new BufferedReader(dataInput);
System.out.print("Enter the number :");
s=buffer.readLine();
number=Integer.parseInt(s);
System.out.println("Number is :"+number);
}
catch(IOException e)
{
System.out.println("Exception"+e);
}
return number;
}

int calculateFactorial(int number)
{
factorial=1;
for(count=1;count<=number;count++)
{
factorial=count*factorial;
}
System.out.print("Factorial is :"+factorial);
return factorial;
}

void output(int factorial)
{
int flag=0;
boolean result;
int count=1;

System.out.println("Fact :"+factorial);
while(flag==0)
{

fileName= count+ext;
file = new File(fileName);

try
{
result=file.createNewFile();
if(result==false)
{
count++;
}
else
{
flag=1;
}


}
catch(FileNotFoundException f)
{
System.out.println("FileNotFound"+f);
}
catch(IOException i)
{
System.out.println("IOexception"+i);
}

}

try
{
if(fileOutput== null)
{
fileOutput = new FileWriter(file);
fileOutput.write(factorial);
}
}
catch(IOException eo)
{
System.out.println("IOException"+eo);
}
catch(Exception r)
{
System.out.println("Exception"+r);
}
}

public static void main(String args[])
{
CalculateFactorialFile fac = new CalculateFactorialFile();
int actualNumber,fact;
System.out.println("Taking input");
actualNumber=fac.input();
System.out.println("Calculating factorial");
fact=fac.calculateFactorial(actualNumber);
System.out.println("Writing output");
fac.output(fact);
}
}

Regards
Rashi
18 years ago
Thanks Joe now i got it.

Regards
Rashi
18 years ago
Hi

I am facing a problem i am trying to read a integer from the keyboard by creating DataInputStream, and using readInt() function but i came to know that readInt() function actually calculates the binary values that's why it is not giving the appropriate result, so my question is then where we use readInt() function when it cannot read an integer. Please help
int input()
{
try
{
dataInput= new DataInputStream(System.in);
System.out.print("Enter the number :");
number=dataInput.readInt();
System.out.println("Number is :"+number);
}
catch(IOException e)
{
System.out.println("Exception"+e);
}
return number;
}

Regards
Rashi
18 years ago
Dear Anjanesh

It would be better if you use j2me wireless toolkit, then atleast you save yourself from running the application from command prompt, it will take care of your classpath as well. If you need the url to download the kit i will post the url.

Regards
Rashi
18 years ago
Dear Nathan

Here is the link for the tutorial on RMI whoes Hello World program I was trying to run.
http://www.ccs.neu.edu/home/kenb/com3337/rmi_tut.html
I am following the same instructions given in this tutorial but still getting this exception Exception: java.lang.ClassCastException:sun.rmi.registry.RegistryImpl_stub while running the HelloClient

Regards
Rashi
18 years ago
Hi

This is my first application in RMI I am facing problem while running the client HelloClient Exception: java.lang.ClassCastException:sun.rmi.registry.RegistryImpl_stub

Please Help
Regards
Rashi
18 years ago
Thanks Lasse Koskela

Regards
Rashi
18 years ago