rakesh kadulkar

Ranch Hand
+ Follow
since Jul 24, 2008
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
In last 30 days
0
Forums and Threads

Recent posts by rakesh kadulkar

Hi,

I am getting ClassCastException while building the hibernate session factory.
The hibernate session factory gets built without any error on my local setup which is exactly same as prod setup.
However this error does not occures always. The hibernate session factory gets built always but sometimes I get to see this error in the tomcat logs and thus my application stops working.
As a workaround we take a reboot on the tomcat server and the problem gets solved.
Below is the code I use for getting sessions from the session factory.



The exception I receive in the logs is



I don't understand why this is happening. The same tomcat also runs some other applications.
Can this be due to some other application. This is just a guess. I am not sure of this.

Further in the exception logs provided above, I see a statement saying

Could not read mappings from resource: File.hbm.xml
and
Duplicate class/entity mapping com.yyyy.transcript.File

Is it because the HibernateSessionFactory.class may be calling a rebuildSessionFactory method().

Your help in this regard is very much appreciated.

Thanks
Rakesh
Hi Guys,

I get the exception


When I try to make a REST web service call using the jersey client API.
The same code works fine on my local machine , the only difference on local and on production is Local tomcat is running on port 8080 and production tomcat is running on port 80.
I have made the respective changes in the code.
My URL looks like "http://IP..Only/TJMS/services/fileservices/addfile".
I googled for this error and i found that this error occurs when the server is not running. But my server is running.
To track the error, I have used mozilla poster plugin to make the REST service call and I made call to the same URL mentioned above and for surprise it worked well.
Please assist me in this.

-Rakesh
Nothing the problem is solved.

Just restarted the tomcat and it is done.

I wonder why this happened but i am happy that the problem is solved now.

Anyways thanks for the concern.

Please reply if you have an idea of what is the problem.
12 years ago
Hi team,

I have created an application using Hibernate and REST web services.
I have deployed the application on my local tomcat 6.0 using JRE version : 1.6.0_13 and everything is working fine.
But when I deployed the same project on the production which is running tomcat 6.0 and jre version is : 1.6.0_17, the SessionFactory building code fails and when I see the logs.. I see there a ClassCastException.
I know one thing for sure that this error is environment related.
Please assist me in this.

Regards,
Rakesh.
12 years ago
Great that's solved my problem.
Thank you.

- Rakesh
12 years ago
Hi,

I am new to web services so trying out the tutorials over the net.
I am using JAX-RS tutorials for myeclipse.
I have created a demo application which successfully produces XML response for a list of entities but the same application if configured to produce JSON response for list of entities it is giving below error.

"A message body writer for Java type, class java.util.ArrayList, and MIME media type, application/json, was not found"

My entity and the web service is as below.

WEB Service



Your help in this regards is appreciated.

Best Regards,
Rakesh Kadulkar
12 years ago
Hi,
The code is scattered all around and cannot be placed here.
There are multuple wrappers.
However if I use the same code to insert a fresh self created object into the database then it works.

Regards,
Rakesh
Hi,

I have a record in the database.
1 - I am reading this record using JPA into an Object.
2 - Then delete this record from the database.
3 - Now modify the state of the read object and then reinsert the record back into the database.
I found that steps 1 and 2 are working fine but step 3 is not working fine.
The records does not actually go into the database and no error is shown on the logs.
Where can be the problem guys.

Regards,
Rakesh
Hi any update on the same.
If I try to create a record manually and try to insert it into the database the record gets inserted successfully but I am getting an object from the database,
deleting it into the database and then updating the state of the object and then trying to persists the same object back into the database however i find that it does not gets inserted into the database. Please let me know what may be the error.

Regards,
Rakesh

lokesh chenta wrote:If persist is not working, I am not sure how the entities are present in the database to be updated or deleted. Are they being manually created by using some db connecting utility?
If so, I can think of one particular issue. In case of persist, the db has to know what value to use as Id/primary key. But if you manually insert entities in db with some random id, update or delte using that Id will not be an issue with the db since the id is already there.
May be you can use something like auto generation strategy for primary key and then try to persist the entities and see if that works.



Yes you are write the records are already present in the database. They are inserted using the sql developer tool.
However the records are updated/deleted using EJB. And they are getting updated/deleted successfully.
However when i am inserting using EJB it is not getting inserted and further it does not shows any error in the logs.

I cannot use sequence/auto generation as I am suing composite primary key.
I have posted the structure beloe.
Please refer to it and suggest me what may be going wrong here.

Best Regards,
Rakesh
Dear all,
Thanks for the replies.
I had been through the links that are provided. Those will be useful to me in the future.
But my problem is not yet resolved. Here below i am sharing the entire class and the id class





Your help in this regards is appreciated.
Best Regards,
Rakesh
Hi,

If this is the case. Neither updates nor delete should be performed on the same.
However the same is being performed.
So now what may be the reason behing entity not getting persisted into the database.
Hi all,

I am new to EJB.
I trying to store an Entity bean into Database using EntityManager.persist() method.
However I can see that object is not going into the database and no error or exception is shown on the console.
In contrast to this the same entity manager is deleting and updating the beans and working fine.
What may be the reason.

Below is part of my persistence.xml





The Entity bean as below






Please suggest.

Best Regards,
Rakesh
Hi,

any update on below.

Regards,
Rakesh
13 years ago