Win a copy of Rust Web Development this week in the Other Languages forum!

Gaurav Saxena

+ Follow
since May 28, 2002
Cows and Likes
Total received
In last 30 days
Total given
Total received
Received in last 30 days
Total given
Given in last 30 days
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Gaurav Saxena

Ok I got it running.It took a while to figure out what the issue was....
The Verion of javaassist.jar that i was using was an old one. Downloaded the latest version from this url and replaced the old one with the new one lib directory and it started working.

download javaassist url :

I am on the basics itself. I have no idea what this file does, but without it it was throwing some other runtime exception. And in some forum it was suggested to put this file in the classpath. SO that exception was gone, and this new exception was thrown at runtime.
I guess javassist is required for using Java Persistence API with Annotated classes.
I am trying that helloworld example in 2nd chapter of Java Persistence with Hibernate book. Finished of the basic helloworld thing using hibernate.
Moved on to trying the same helloworld thing using Java Persistence and hibernate using annotations . Thats where I am stuck for a long long time.
thanks for the reply! Yeah I think I got too many jars in my lib and probably JVM is picking up one that it is not supposed to pick up. Anyways, I am doing this hibernate thing for the first time and did'nt have no idea about the jars to be used so put a lot of jar files in lib. Here is a list

I dont know which ones are the required ones and which ones are redundant. Using eclipse 3.2.2 and Ant to build and run the helloworld example.
Can you please let me know which jar files can be removed from the above list?
And thanks a tonne for the response Cameron!
Hi All
I am new to hibernate and EJB 3.0 persistence. Getting following error when i try to run the example from 2nd chapter of book EJB 3.0 persistence with hibernate

Exception in thread "main" java.lang.NoSuchMethodError: javassist.bytecode.AnnotationsAttribute.getAnnotation(Ljava/lang/String Ljavassist/bytecode/annotation/Annotation;
[java] at org.hibernate.ejb.packaging.JarVisitor.checkAnnotationMatching(
[java] at org.hibernate.ejb.packaging.JarVisitor.executeJavaElementFilter(
[java] at org.hibernate.ejb.packaging.JarVisitor.addElement(
[java] at org.hibernate.ejb.packaging.ExplodedJarVisitor.getClassNamesInTree(
[java] at org.hibernate.ejb.packaging.ExplodedJarVisitor.getClassNamesInTree(
[java] at org.hibernate.ejb.packaging.ExplodedJarVisitor.doProcessElements(
[java] at org.hibernate.ejb.packaging.JarVisitor.getMatchingEntries(
[java] at org.hibernate.ejb.Ejb3Configuration.addMetadataFromVisitor(
[java] at org.hibernate.ejb.Ejb3Configuration.configure(
[java] at org.hibernate.ejb.HibernatePersistence.createEntityManagerFactory(
[java] at javax.persistence.Persistence.createEntityManagerFactory(
[java] at javax.persistence.Persistence.createEntityManagerFactory(
[java] at hello.HelloWorld.session1(Unknown Source)
[java] at hello.HelloWorld.main(Unknown Source)
[java] Java Result: 1

There is no compilation error. Am i missing some jar file?

Hi JoJo i tried to set the compiler options as indicated in your post but it still does'nt work for me......I m using JDK1.5 on windows XP machine and xmlbeans version 2.2.0......any idea what could be wrong
here is the stack trace..

at java.lang.Runtime.exec(Unknown Source)
at java.lang.Runtime.exec(Unknown Source)
at org.apache.xmlbeans.impl.tool.CodeGenUtil.externalCompile(CodeGenUtil
at org.apache.xmlbeans.impl.tool.SchemaCompiler.compile(SchemaCompiler.j
at org.apache.xmlbeans.impl.tool.SchemaCompiler.main(

Please help!
Hi Sri
The books you have seen were probably written to cater to SCJP 1.2 requirements. As of SCJP 1.4 all these things have been left out.
And anyways information at Sun's site should be trusted more than any thing else when it comes to Java and Java related technologies
Ok Ernest as you say
---------------------------------------------------------------------------No copies are made of the constants (other than copies that are inlined into code.) When a class implements an interface, the compiler doesn't copy the interface's constants into that class; there's just one set of static values associated with the interface itself.
then why is it discouraged to have static Constants in an interface and then let all the required files implement that interface? I believe one of the reasons is that if you modify the value of constants in the interface then all the classes implementing the interface will have to be recompiled in order to access the modified constants. But on the other hand if u place all the static constants in a normal java class then modification of the constants' value will not require the classes using this class to be recompiled. Is that true? Will be of gr8 help if u can throw some more light on what exactly goes on behind the scenes when a class extends another class or implements an interface.
16 years ago
Hi all
Sorry if i've posted this in wrong place(I beleive it shud be posted in advance java ) anyways lets continue....
I know it's a bad practice - to declare Constants in an interface and then implement that interface in the classes using those constants. But thats a different topic for discussion. I've come across a peculiar situation, a framework to be precise which is as follows :-

1. There is a Base Interface Say A - This interface has "n" no. of String Constants used in the application and absolutely no methods at all. Sample code is as follows
public interface A{
String AAA = "abc";
String BBB = "def";
String CCC = "ghi";

2. There are two more interfaces B and C. Both B and C extend interface A and both have different sets of methods.

public interface B extends A{
String method A() throws SomeException;
void method B(ParamA a, ParamB b) throws SomeException;
String method C(ParamC c) throws SomeException;

public interface C extends B{
String method D(ParamE e, ParamF f) throws SomeException;

The above three interfaces are a part of the basic framework which the application uses for customization according to different situations.

3. now there is a Class say Class X which is required to implement both interfaces as it has to implement both sets of methods.

Class X implements B,C{

My question is - "How will the Java Compiler treat all the String variables declared in Interface A, when we compile the Class X?
As Both interfaces B and C extend A, and X implemets both B and C,will the Class X actually be getting each Variable of interface A twice - once thru the inheritance tree A-->B-->X and second time thru the inheritance tree
All i can say is it's bad and Confusing design according to me...
Can some one throw some light on what happens behind the scenes when class X is compiled?
Thanx and Regards
16 years ago
I have written a JUnit test client to test my session bean.After deploying the session bean in the Weblogic 8.11 and running the JUnit test client i am getting the following error.

java.rmi.RemoteException: EJB Exception: ; nested exception is:
at weblogic.rjvm.BasicOutboundRequest.sendReceive(
at weblogic.rmi.cluster.ReplicaAwareRemoteRef.invoke(
at weblogic.rmi.cluster.ReplicaAwareRemoteRef.invoke(
nState(Unknown Source)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(
at sun.reflect.DelegatingMethodAccessorImpl.invoke(
at java.lang.reflect.Method.invoke(
at junit.framework.TestCase.runTest(
at junit.framework.TestCase.runBare(
at junit.framework.TestResult$1.protect(
at junit.framework.TestResult.runProtected(
at junit.framework.TestSuite.runTest(
at junit.textui.TestRunner.doRun(
at junit.textui.TestRunner.start(
at junit.textui.TestRunner.main(
Caused by: java.lang.NoClassDefFoundError
at Source)
at weblogic.rmi.internal.BasicServerRef.invoke(
at weblogic.rmi.cluster.ReplicaAwareServerRef.invoke(
at weblogic.rmi.internal.BasicServerRef$
at weblogic.rmi.internal.BasicServerRef.handleRequest(
at weblogic.rmi.internal.BasicExecuteRequest.execute(
at weblogic.kernel.ExecuteThread.execute(

Please help
Thanx and Regards
17 years ago
Basic difference between An Application Server and a web erver is that A Web server has no support for running EJBs. It Only provieds support for running web-applications (having JSPs, Servlet, plain Java classes etc.). If at all your application requires Support for Enterprise Java Beans then to host your EJBs you require an Application server.
thats the most basic difference bn. and Appserver and a Web-Server.For more information try a lil bit of googling and browse thru
17 years ago
hey ashok
First read the Java docs properly. All ur basic doubts will get cleared. If at all you still have doubts you r most welcome here!
17 years ago
Hi Ashok
This is what the definition of transient says -
"Transient instance fields are neither saved nor restored by the standard serialisation mechanism". So if at all u want some field to be serialized dont make it as transient/static in the first place.
Hope it clears ur doubt
17 years ago
A bit more efficient would be

public class MyImmutableClass { private final List data; MyImmutableClass(final List inData) { data = Collections.unmodifiableList(new ArrayList(inData)); } public List getData() { return data; }}


Obviously this is immutable iff the objects you've put in "inData" are...

- Peter

Hi peter
Are you trying to say that if the List <b>inData</b> contains objects that are mutable then MyImmutableClass will not really be immutable?
Please clarify
17 years ago
Hi all
First of all i dont know whether this question shud be posted here or in some other forum. My apologies in advance if this is not the forum for this question.
Coming back to my point. the questions are
1. Why do we need the String objects to be immutable?
2. Can i have a class (say MyClass) and make it immutable? If yea then can any one throw some light on how this can be done?
Thanx in advance
17 years ago