Win a copy of Machine Learning for Business: Using Amazon SageMaker and JupyterE this week in the Jython/Python forum
or Object Design Style Guide in the Object-Oriented programming forum!

Sri Harsha Yenuganti

Greenhorn
+ Follow
since Mar 02, 2010
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 Sri Harsha Yenuganti

I am trying to use Envers to audit the updates/inserts into my tables. I have created audit tables with extension _AUDIT in the DB.

But when I actually run the application, I dont see any entries in the audit tables. I even have no errors or exceptions thrown. Entries are being inserted into the main tables but the AUDIT tables are not updated.

Here is my ENVERS configuration :

hibernate.cfg.xml:

<!-- Hibernate ENVERS Configuration -->
<property name="org.hibernate.envers.audit_table_suffix">_AUDIT</property>
<property name="org.hibernate.envers.revision_field_name">REVISION_ID</property>
<property name="org.hibernate.envers.revision_type_field_name">REVTYPE</property>
<property name="org.hibernate.envers.do_not_audit_optimistic_locking_field">true</property>
<property name="org.hibernate.envers.default_schema">ROCC</property>

<!-- Hibernate ENVERS Listener Configuration -->

<listener class="org.hibernate.envers.event.AuditEventListener" type="post-insert"/>
<listener class="org.hibernate.envers.event.AuditEventListener" type="post-update"/>
<listener class="org.hibernate.envers.event.AuditEventListener" type="post-delete"/>
<listener class="org.hibernate.envers.event.AuditEventListener" type="pre-collection-update"/>
<listener class="org.hibernate.envers.event.AuditEventListener" type="pre-collection-remove"/>
<listener class="org.hibernate.envers.event.AuditEventListener" type="post-collection-recreate"/>


My table is as follows:

/**
* Transaction generated by hbm2java
*/
@Audited
@Entity
@Table(name = "TRANSACTION", schema = "ROCC")
public class TransactionTable implements java.io.Serializable{...}

The Audit table is TRANSACTION_AUDIT in the same schema.

Can any one tell me why the auditing is not working?

We need to process the records first come first serve basis. Or at least the records should be processed by the end of the day they are recieved. So random seed generation may not help us.

I am thinking of these options. Can you tell me will these things work? If yes, which would be better one.

1. Using Hibernate and having a distributed cache. Maintain a list of records accessed in cache. Whenever the EJB reads a record, the hibernate goes through the distributed cache and if it finds a match, return null/error.

The problem is that the list should be dumped at some point of time not to make it too big. If we dump the list, we are back to the beginning of the problem.

2. Have a sequence ID on the first table.
Use a seperate simple table that holds the sequence number of the latest record accessed. Have a pessimistic lock on this simple table. EJB comes to this table to get the sequence number of the record to be fetched. But having a second table and pessimistic lock on it may be a performance hit when the incoming orders are 250,000/day.

3. The sequence ID can be placed in a distributed cache if we have one. But we cant configure a new distributed cache just for the purpose of holding this single key if it is not already in place.

4. Place a sequence number in a JMS queue. EJB reads the queue, gets the new sequence number and goes to fetch the record. Mean while it increments the sequence number and places it back into the queue for another EJB to pick up.





Hi ,

We are using a TimerEJB that periodically gets a record from DB2. But the cluster will have many such EJB instances running accessing the same DB getting records. Now our problem is to find a way to eliminate duplicate reads from the DB by these EJB instances. We cant make the TimerEJB cluster-wide singleton because the incoming request volume is very huge, 250,000/day.

Can any one suggest the best way to eliminate duplicate reads in this situation? Does Hibernate/JPA provide an easier way to do this?

Thank You,
Sri.

Ernest Friedman-Hill wrote:Type signatures are case-sensitive: ()v -> ()V .




ThankYou Friedman.. It worked !!

I do have another issue in the same class for the parameterized constructor ... As that is similar I will post it here only ..


Signature generated from javap :
(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;ILjava/lang/String;IIJILjava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;IIILjava/lang/String;Ljava/lang/String;)V


I have just copy pasted the signature into this GetMethodID function :





But I am getting the error :

Problem with the constructor
Exception in thread "Thread-23" java.lang.NoSuchMethodError: <init>
9 years ago
I have no error when I am trying to call any method of the "Ursa_Routing_Output" object from the JNI code. But I am getting this error when calling the constructor.

Problem with the Empty constructor
Exception in thread "Thread-23" java.lang.NoSuchMethodError: <init>
at com.comail.jni.UVSdk.getRPO(Native Method)



The corresponding methods in the Java class are :





The corresponding class signatures generated through javap are :

public com.comail.pojo.Ursa_Routing_Output();
Signature: ()V

public java.lang.String getAreaCommitment();
Signature: ()Ljava/lang/String;


The code is able to find the class and its other methods. But it is not able to locate the constructor.

Can any one help me to locate the problem?
9 years ago
How can I know which is the default garbage collector for every update of JDK? Can I see this information in any documentation from Sun ?
9 years ago

Wouter Oet wrote:You can use the following command: java -verbose:gc className



This command simply doesn't work !!
9 years ago

Hebert Coelho wrote:When I was studying for SCJP in any moment they mention this. They say that all you need to know is that you can sugest to the Garbage Collection to take action.

And nothing more...

Why would you want such thing?



My application is running fine on JDK 1.6 Update 14(Oracle WebLogic 11g(10.3.2) ) . But my app server JVM is getting crashed on JDK 1.6 Update 12(Oracle Weblogic 10.3.0).
From Update 14, Sun has implemented a new G1 garbage collector. I just want to know whether the crash is due to the garbage collector in JDK 1.6 update 12 because from the JDK 1.6 documentation I can see that there is some bug in the CMS garbage collector which corrupts the heap and crashes the JVM.

I want to check the name of the garbage collector in both the versions to see if they are using the same default garbage collector.




9 years ago
Apart from using jconsole, Is there any location/configuration file that I can look at to know the garbage collector thats in use ? Or Can I print the name of the garbage collector in use using any JVM Command/options?
9 years ago
Hi,

I am using JNI to call some back end logic. Everything is working fine except a memory leak which is crashing the JVM after repeated runs. In one function, I am creating and returning a large "jobject" to Java code from JNI. This object is not being deleted after the return from the JNI call. The JVM is being crashed when the code tries to create the same object in the next run as the PermGen Object Space is utilized 99%. The JVM is being crashed in the GCTask thread as shown from the crash dump log files.

Here is the Memory info from the crash dump log file:

Heap
PSYoungGen total 196224K, used 78894K [0x0000002ad4070000, 0x0000002ae5e30000, 0x0000002ae95c0000)
eden space 195840K, 40% used [0x0000002ad4070000,0x0000002ad8d23870,0x0000002adffb0000)
from space 384K, 91% used [0x0000002ae04a0000,0x0000002ae04f8040,0x0000002ae0500000)
to space 48384K, 0% used [0x0000002ae2ef0000,0x0000002ae2ef0000,0x0000002ae5e30000)
PSOldGen total 524288K, used 124951K [0x0000002aa95c0000, 0x0000002ac95c0000, 0x0000002ad4070000)
object space 524288K, 23% used [0x0000002aa95c0000,0x0000002ab0fc5c80,0x0000002ac95c0000)
PSPermGen total 106688K, used 106538K [0x0000002a995c0000, 0x0000002a9fdf0000, 0x0000002aa95c0000)
object space 106688K, 99% used [0x0000002a995c0000,0x0000002a9fdca950,0x0000002a9fdf0000)


Is there any way that I can forcibly delete that local reference object manually as GC is not deleting it?

For each run I have to check if the object is there in the environment, and if if yes, I need to delete it. Is there any way that i can check if a particular object is present in the JNI env ?

How can I see all the references to that object which are blocking the object from being garbage-collected?
9 years ago

I am using JNI to run some native code from Java. The code runs fine in Windows XP system. When i port the code to Linux and try running it there, It runs perfectly for 2-3 times. And after that it crashes. This crash is so random that it crashes the first time sometimes. Sometimes it works for 2-3 times and then crashes.

As the code is running fine for some time, the problem may be with the memory.

My Java Memory Arguments are "-Xms 768m -Xmx1024m".
Java Version : 1.6.0_12 and I am running my application in Weblogic 11g.

Every time it crashes, it gives me a JVM crash dump file, from which I am not able to decode the problem.

Here is the latest crash dump file:


Can anyone help me to locate the reason for these random crashes ? Is the problem with Heap Memory as some of the statics say the memory space is 99% used ?
9 years ago
How can I check whether the JRE on my system is a 32bit or 64 bit? I am using Red Hat Linux.
9 years ago
I am trying to use JNI calls to C library in UNIX environment. I tried to run a simple hello world application using

java -Djava.library.path=. com.fedex.jni.Hello

I have the "libHello_JNI.so" library in the current directory. But why is it still complaining

Exception in thread "Main Thread" java.lang.UnsatisfiedLinkError: no Hello_JNI in java.library.path
at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1682)
at java.lang.Runtime.loadLibrary0(Runtime.java:823)
at java.lang.System.loadLibrary(System.java:1030)
at com.fedex.jni.Hello.<clinit>(Hello.java:6)

I have tried setting the LD_LIBRARY_PATH to the directory containing "libHello_JNI.so". Even that did not work !!
Can anyone help me ?
9 years ago
I have a source file Hello.cpp. The processor architecture is x86-64. I am generating the shared library using the following command :

gcc -shared -m64 -I/path/to/include/files -fPIC Hello.cpp -o libHello_JNI.so

This library is in the folder specified on the path. Even then I am getting the error !

Can you tell me where I am going wrong ?

Thank You.


9 years ago