Gourab Guha

Greenhorn
+ Follow
since Nov 06, 2006
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 Gourab Guha

Hi All,

I want to know about any tool, which can make easier the creation of java documentation comments in my source file or if you have any idea about any plug-in of Eclipse which can be used for the same.

Regards,
Gourab
16 years ago
ya they mast be same. Actually I copied those jars from the lib directory to my Eclipse workspace and set the classpath.

Regards,
Gourab Guha
16 years ago
Hi All,

I have problem to lookup RMIAdaptor from the JNDI namespace of Jboss.
The code that I have written is follows.

import java.util.Properties;
import javax.naming.InitialContext;

public class ServiceLocator
{
public static void main(String[] args)
{
try
{
Properties enviornment = new Properties();
enviornment.setProperty("java.naming.factory.initial","org.jnp.interfaces.NamingContextFactory");
enviornment.setProperty("java.naming.provider.url","jnp://localhost:1099");
enviornment.setProperty("java.naming.factory.url.pkgs","org.jboss.naming rg.jnp.interfaces");

InitialContext initialContext = new InitialContext(enviornment);
initialContext.lookup("jmx/rmi/RMIAdaptor");

}
catch(Exception e)
{
e.printStackTrace();

}
}
}

When I am executing the program I am getting the following exception

javax.naming.NamingException: Could not dereference object [Root exception is javax.naming.CommunicationException [Root exception is java.io.InvalidClassException: org.jboss.invocation.InvokerInterceptor; unable to create instance]]
at org.jnp.interfaces.NamingContext.resolveLink(NamingContext.java:1067)
at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:700)
at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:587)
at javax.naming.InitialContext.lookup(InitialContext.java:351)
at ServiceLocator.main(ServiceLocator.java:17)
Caused by: javax.naming.CommunicationException [Root exception is java.io.InvalidClassException: org.jboss.invocation.InvokerInterceptor; unable to create instance]
at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:722)
at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:587)
at javax.naming.InitialContext.lookup(InitialContext.java:351)
at org.jnp.interfaces.NamingContext.resolveLink(NamingContext.java:1061)
... 4 more
Caused by: java.io.InvalidClassException: org.jboss.invocation.InvokerInterceptor; unable to create instance
at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1700)
at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1299)
at java.io.ObjectInputStream.skipCustomData(ObjectInputStream.java:1877)
at java.io.ObjectInputStream.readExternalData(ObjectInputStream.java:1765)
at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1711)
at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1299)
at java.io.ObjectInputStream.readObject(ObjectInputStream.java:339)
at org.jboss.proxy.Interceptor.readExternal(Interceptor.java:80)
at java.io.ObjectInputStream.readExternalData(ObjectInputStream.java:1753)
at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1711)
at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1299)
at java.io.ObjectInputStream.readObject(ObjectInputStream.java:339)
at org.jboss.proxy.Interceptor.readExternal(Interceptor.java:80)
at java.io.ObjectInputStream.readExternalData(ObjectInputStream.java:1753)
at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1711)
at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1299)
at java.io.ObjectInputStream.readObject(ObjectInputStream.java:339)
at org.jboss.proxy.ClientContainer.readExternal(ClientContainer.java:156)
at java.io.ObjectInputStream.readExternalData(ObjectInputStream.java:1753)
at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1711)
at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1299)
at java.io.ObjectInputStream.defaultReadFields(ObjectInputStream.java:1912)
at java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:1836)
at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1713)
at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1299)
at java.io.ObjectInputStream.readObject(ObjectInputStream.java:339)
at java.rmi.MarshalledObject.get(MarshalledObject.java:135)
at org.jnp.interfaces.MarshalledValuePair.get(MarshalledValuePair.java:72)
at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:652)
... 7 more


Can anybody help me please?
16 years ago
Hi All,

I have problem to lookup RMIAdaptor from the JNDI namespace of Jboss, When I want to access JBoss JMX.

The code that I have written is follows.

import java.util.Properties;
import javax.naming.InitialContext;

public class ServiceLocator
{
public static void main(String[] args)
{
try
{
Properties enviornment = new Properties();
enviornment.setProperty("java.naming.factory.initial","org.jnp.interfaces.NamingContextFactory");
enviornment.setProperty("java.naming.provider.url","jnp://localhost:1099");
enviornment.setProperty("java.naming.factory.url.pkgs","org.jboss.naming rg.jnp.interfaces");

InitialContext initialContext = new InitialContext(enviornment);
initialContext.lookup("jmx/rmi/RMIAdaptor");

}
catch(Exception e)
{
e.printStackTrace();

}
}
}

When I am executing the program I am getting the following exception

javax.naming.NamingException: Could not dereference object [Root exception is javax.naming.CommunicationException [Root exception is java.io.InvalidClassException: org.jboss.invocation.InvokerInterceptor; unable to create instance]]
at org.jnp.interfaces.NamingContext.resolveLink(NamingContext.java:1067)
at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:700)
at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:587)
at javax.naming.InitialContext.lookup(InitialContext.java:351)
at ServiceLocator.main(ServiceLocator.java:17)
Caused by: javax.naming.CommunicationException [Root exception is java.io.InvalidClassException: org.jboss.invocation.InvokerInterceptor; unable to create instance]
at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:722)
at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:587)
at javax.naming.InitialContext.lookup(InitialContext.java:351)
at org.jnp.interfaces.NamingContext.resolveLink(NamingContext.java:1061)
... 4 more
Caused by: java.io.InvalidClassException: org.jboss.invocation.InvokerInterceptor; unable to create instance
at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1700)
at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1299)
at java.io.ObjectInputStream.skipCustomData(ObjectInputStream.java:1877)
at java.io.ObjectInputStream.readExternalData(ObjectInputStream.java:1765)
at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1711)
at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1299)
at java.io.ObjectInputStream.readObject(ObjectInputStream.java:339)
at org.jboss.proxy.Interceptor.readExternal(Interceptor.java:80)
at java.io.ObjectInputStream.readExternalData(ObjectInputStream.java:1753)
at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1711)
at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1299)
at java.io.ObjectInputStream.readObject(ObjectInputStream.java:339)
at org.jboss.proxy.Interceptor.readExternal(Interceptor.java:80)
at java.io.ObjectInputStream.readExternalData(ObjectInputStream.java:1753)
at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1711)
at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1299)
at java.io.ObjectInputStream.readObject(ObjectInputStream.java:339)
at org.jboss.proxy.ClientContainer.readExternal(ClientContainer.java:156)
at java.io.ObjectInputStream.readExternalData(ObjectInputStream.java:1753)
at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1711)
at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1299)
at java.io.ObjectInputStream.defaultReadFields(ObjectInputStream.java:1912)
at java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:1836)
at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1713)
at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1299)
at java.io.ObjectInputStream.readObject(ObjectInputStream.java:339)
at java.rmi.MarshalledObject.get(MarshalledObject.java:135)
at org.jnp.interfaces.MarshalledValuePair.get(MarshalledValuePair.java:72)
at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:652)
... 7 more


Can anybody help me please?

Regards,
Gourab Guha.
Hi All,

I have written a very simple Java program to write a XML document. I am using the default implementation of DOM provided by Sun, that means javax.xml and org.w3c.dom packages.

Here is the code snippet.

TransformerFactory transFactory = TransformerFactory.newInstance();
Transformer transformer = transFactory.newTransformer();

// The following property is used to create the element in different lines of the xml
transformer.setOutputProperty(OutputKeys.INDENT,"Yes");

Source input = new DOMSource(document); // passing the instance of Document
Result output = new StreamResult(os); // passing the instance of OutputStream
transformer.transform(input , output);

The output created is like this

<root>
<element att=�val1� >
<subElement>text</subElement>
</element>
</root>

I want the output will be like this

<root>
<element att=�val1� >
<subElement>text</subElement>
</element>
</root>

Please help me how can I create the output like the above. Is it possible to create such transformation by sun default DOM implementation? (which I am using).

Regards,
Gourab
Hi All,

If I have a main method in Java which returns int
public static int main(String args[])
then at the time of compiling the program we don�t get any compilation error, but at run time why a java.lang.NoSuchMethodError occurs?

My another question is also similar with the above one.
Let say I have 2 class, one is TestClass1.java and TestClass2.java

// TestClass1
class TestClass1
{
public static void main(String[] args)
{
TestClass2 testClass2 = new TestClass2();
testClass2.testMethod();
}
}

// TestClass2
class TestClass2
{
public void testMethod()
{
System.out.println("I am in testMethod of TestClass2");
//return 1;
}
}

We are calling testMethod() of TestClass2 from TestClass1. After compiling these 2 program if I execute the TestClass1 program then it runs perfectly. Now if I change the return type of testMethos() and compile only TestClass2 not the TestClass1 and run TestClass1 then an exception is thrown from main that is also java.lang.NoSuchMethodError. Is this related with the previous problem any more?

Regards,
Gourab
16 years ago
Dear All,

I have a double regarding the calling mechanism of finalize method. The access specifier of finalize method is protected, not only that if a class overrides this method then also the finalize method can be protected in the subclass of Object. But the concept of protected access specifier is, from outside of the package it can be accessed only from subclass.
The program (may be part of Garbage collector), which calls this (finalize) method mast not be in the same package (that is java.jang) nor it is a subclass of the class (whose finalize method it calls).
Then how the finalize method is getting called by the garbage collector when it is protected?

Regards,
Gourab
16 years ago
Hi All,

I know the basic difference between Thread and Runnable. If my class is extending some class but still we need to make it Thread, then we should use Runnable otherwise we can use any one.
But specifically I want to know is extending Thread gives any added advantage rather then implementing Runnable.
Please let me know the answer.

Regards,
Gourab
Hi Everybody,

I am using a scrollable sensitive result set. What I know about it, if the Data base value has been changed in the mean time when the JDBC application is traversing the result set, the effect will be displayed in the result set. But surprisingly I am not getting the result. Here is the code.

import java.sql.Connection;
//import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;

/**
*
* @author mc11
*
*/
public class TestScrolableSens
{
private static Connection connection = null;
private static Statement statement = null;
private static ResultSet rs = null;

public static void main(String args[])
{
String sql = "SELECT * FROM EMP";
try
{
connection = JDBCLoader.getConnection("dbc:oracle:thin:@off2:1521:VELOZ","scott","tiger");
statement = connection.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE,ResultSet.CONCUR_READ_ONLY);
ResultSet rs = statement.executeQuery(sql);
while(rs.next())
{
Thread.sleep(15000);
String empNo = rs.getString("EMPNO");
int salary = rs.getInt("SAL");
System.out.println(empNo + " " + salary);
}
}
catch(SQLException e)
{
e.printStackTrace();
}
catch(InterruptedException e)
{
e.printStackTrace();
}
}
}

When this program is running I have changes the value in SAL field but getting no effect in the ResultSet.

I am using Oracle as my DataBase and a type-4 driver. And I have checked that this operation is valid by using
boolean dbMetaData.othersUpdatesAreVisible(ResultSet.TYPE_SCROLL_SENSITIVE) method.

Please help me regarding this.

Regards,
Gourab
Hi Everybody,

I am using a scrollable sensitive result set. What I know about it, if the Data base value has been changed in the mean time when the JDBC application is traversing the result set, the effect will be displayed in the result set. But surprisingly I am not getting the result. Here is the code.

import java.sql.Connection;
//import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;

/**
*
* @author mc11
*
*/
public class TestScrolableSens
{
private static Connection connection = null;
private static Statement statement = null;
private static ResultSet rs = null;

public static void main(String args[])
{
String sql = "SELECT * FROM EMP";
try
{
connection = JDBCLoader.getConnection("dbc:oracle:thin:@off2:1521:VELOZ","scott","tiger");
statement = connection.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE,ResultSet.CONCUR_READ_ONLY);
ResultSet rs = statement.executeQuery(sql);
while(rs.next())
{
Thread.sleep(15000);
String empNo = rs.getString("EMPNO");
int salary = rs.getInt("SAL");
System.out.println(empNo + " " + salary);
}
}
catch(SQLException e)
{
e.printStackTrace();
}
catch(InterruptedException e)
{
e.printStackTrace();
}
}
}

When this program is running I have changes the value in SAL field but getting no effect in the ResultSet.

Please help me regarding this.
Regards,
Gourab
Hi All,

I have some problems regarding SNMP. I need to track different system information like Disk partitions, CPU utilizations, memory and others of every machine in a network.
I can gather these data from a single machine where SNMP agent is running. But I need that information from all the machines, which are in a network. Then is it mandatory to install SNMP agent in all these machines in the network or by using a single agent running in a single machine data (Disk partitions, CPU utilizations) of different machine can be gathered? If a single agent can do it then can you please let me the mib or the oid list that I need to use, or any specific configuration I need to make on the agent.
Please help me on these.

Regards,
Gourab
Hi All,

I am very new in SNMP domain, I need to grow the concept of SNMP first, then I need to write some Adaptor like programs in Java that can collect some system information by using SNMP. So I need to know how to access SNMP by Java, can anybody tell me about a tutorial for this (if possible the web link).

Regards,
Gourab