Win a copy of liveProject: Build an ML Recommender System this week in the Artificial Intelligence and Machine Learning forum!

Aleksandar Mitrev

+ Follow
since Mar 21, 2008
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 Aleksandar Mitrev

Hi to everyone.
I don't know is this is the right place to post my question because I haven't determine where my problem lies.

My application is throwing the following exception:

This is happening in production I'm not able to get this problem in development and for that I'm not able to solve it.

From what I was able to find in the web, the cause for this can be:
1. Over jdbc connection, a JBoss connection is wrapped but the wrapper is empty. The original JDBC connection inside is no longer there.
2. JDBC Connection is already closed and trying to work with close connection is the reason why I'm getting this exception.
3. The transaction manger detects transaction that is taking to long then the transaction timeout.

So if someone can point me what is the problem because I'm not able to get this problem in mine development environment.
Also what logs can I add that will help me detect the problem in production - I'm using Java, JBoss, JDBC, Postgres.

I'have enable connection close monitoring by adding <track-statements>true</track-statements> in the datasource.
Also to add is that the issue is not consistent
Thanks Steve for your quick reply
So in my case the same record is retrieved from DB-tabale job, but two different instance are been created for example:
Thread-1 gets it from DB and initialize Job job1 = readByIdFromDB("1111")
Thread-2 gets it from DB and initialize Job job2 = readByIdFromDB("1111")
so the expression job1==job2 gives false
but for job1.equals(job2) will return true
From what you are saying and I was able to understand synchronization wont going to work for me in this case. So can you tell me more about that database locks, how can I use it in my problem. I'm using postgres and I'm not rely familiar with this
Hi everyone
I have a thread issue in my code that should not be happening - but is. So I'm trying to make some work around. I will try to explain my problems with simple code as I can - because the code that I'm experiencing the issue is big and complicated so in short the code:

So my problem begins when two thread are trying to execute-read-write changes on the same jobObject at the same time that makes mess in my application
What I need is a way that when a thread is entering "if(job.getStatus.equals("redye")){" with e.g. job object with id=1111 no other thread can enter this code for the same jobObject-1111 until the first thread is finished - leaves the if statement
I also have problems synchronizing it because the "execute" method is call with different instance of ExecuteJob
I can use ExecuteJob.class for synchronization but I will lose the point and benefits of multithreading
I'm wondering if there is something like this that can be implemented for my issue:

or maybe
After updating the spring form 3.0.2 to 3.1.0 in my project I'm getting the following error:

Тo be sure that the update of spring causes the problem I've return old spring jars 3.0.2 and everything worked well
If someone has idea why this is happening pleas write
9 years ago

Paul Clapham wrote:You should also check out the "mail.smtp.from" property (documented here).

Thanks for the replay
I think for my problem there Is no solution - not that I can find
My scenario that I want : having three mails mailA, mailB, mailC then sending mail from mailB to mailC and if the mailC dos not exist(invalid mail) the failed email notification is return to mailA
But the usual behavior is: the failed email notification is return to the sender mailB
I've tried some potential solutions for example setting: mimeMessage.setFrom("mailB"); mimeMessage.addRecipients("mailC"); mimeMessage.setReplyTo("mailA"); mimeMessage.setSender("mailA"); but no luck
My problem may depend a lot from the mail server and its configuration. Thanks anyway
9 years ago

Paul Clapham wrote:

Aleksandar Mitrev wrote:The ideal will be to catch the failed mail notification and to change the recipient or somehow forward it

Apparently you didn't read anything I wrote.

so nothing i guaranteed and can't be done
9 years ago

Paul Clapham wrote:Did you use the "setReplyTo" method of Message?

Also, you don't seem to understand how e-mail works. You give the message to your server -- that's what the "send" message does. Your server will then try to find the server for each of the "to" addresses on the message and give the message to those servers. However since any of those servers may be down at the time, your server will try for perhaps a couple of days before it gives up and deems the message to be undeliverable.

Naturally your JavaMail code doesn't wait for that to happen, it just gives the message to the server and returns. Similarly the other server, the one which your server decided belonged to one of the "to" addresses, may also tell you that it can't deliver the message. That may be because there is no such address on that server, or because that address's mailbox is full, or because it thinks your message is spam. That also happens later. The other server may send a return e-mail saying your message was undeliverable, or it may just discard the message silently.

As for the Delivery Status Reports, you can ask for one but the receiving server is not obliged to send you one.

Yes I've used setReplyTo(setting the mail from user A) I also set SMTP server and is working fine if mail is send to valid email address.
If email is send to invalid mail the behavior is also expected - normal : failed mail notification is send to the sender. But like I said I don't want failed notification email to be send to the sender of the mail( but to other email(user A)
I've tried to put Transport.sent(message) in try-catch with thread delaying and hoping that javax.mail.SendFailedException(Invalid address) will be thrown and from there to make custom failed mail notification that will be sent to user A email
Also like I pointed above I've tried implementing javax.mail.event.TransportListener but messageNotDelivered method was never called
That are the cases that I've tried
The ideal will be to catch the failed mail notification and to change the recipient or somehow forward it
I hope you'll understand my English :)
9 years ago
I'm trying to create simple mail application using JavaMail API But I've encounter some problems
What I'm trying to do is: user A is sending mail to user B through some administration mail(ex. - the mail is actually send by the so if user B has invalid mail the failed mail notification is send to
What I want is the failed mail notification to be send to user A mail instead to the Is this possible?
I've tried it manual by implementing javax.mail.event.TransportListener and in public void messageNotDelivered(TransportEvent e) method creating my own costume failed notification mail and sending it to user A but the method was never invoked
Also I'm checking if it is possible to accomplish this with DeliveryStatus MessageHeaders MultipartReport but I can't find tutorial - examples
If you have some suggestion please help!
9 years ago
I'm trying to check if the form fields are empty inside spring flow declaration. I don't want to create Validator because I wan a simple check for form field required like
ValidationUtils.rejectIfEmptyOrWhiteSpace(errors, "name", "name.required" )
so is it possible to do this outside of validator class inside flow declaration - for example something like this:
If there is not such syntax in Spring, OGNL and EL, How can I preform this check inside validator for example
10 years ago

Mark Spritzler wrote:Well, you just add the association mapping to your mapping.

See the Hibernate documentation for xml mapping of associations here

I am also going to move this to the ORM forum as this isn't a Spring question. Thanks


Thanks mark your reply gave me direction what my mistake is
I was getting error on one-to-many declaration and a assuming that my mistake is there but actual my mistake was that I've didn't added the spring-jpa jar
Thanks again
I'm creating application who contains two model class Student and Grade and using org.springframework.orm.hibernate3.LocalSessionFactoryBean to persist them
The two model class and the relation between them is:

I've manage to persist the two classes separable with out the relation between(the composition in Student class)
I'm wondering is there something like

that like a state to put it in the hibernate-mapping and make the persistence with the corresponding relation.
I'm not using JPA Annotation in the model and my tables in the database are

Student table:

Grade table:
I've started learning spring before several months I've read a entire book about spring first and after that I've start it reading it for the second time but now creating some code and projects while reading the chapters . Processing throw chapters I've notes that the chapter Spring Web Flow is out of use. For example there is no FormAction class no web flow a lot of the class are with 90% of the methods deprecated. So I'm asking if you can tell me what book should I read to don't repeat the mistake and lose so much time
I'm planing to start reading the Aprss - Spring Enterprise Recipes but the book is published november 2009 and I'm afraid that and this book can have a lot of old and removed techniques
I'm also wondering what is the now technique that replace the Spring Web Flow - that resolves the problematic that Spring web flow was resolving
10 years ago
Thanks Mark that was a big help for me you saved me days of headache
10 years ago
I'm new at spring I've start reading a book from Wrox - Beginning Spring Framework.
I'm orientating from this book examples on creating my first data persisting application using maven, spring, hsqldb.
For several days I'm trying to create the application but no luck I'm getting frustrate I can't sleep . I know my post is going to be big but I'm hoping someone read it and help me make it work
I've created the model - class Album in directory /MyProject/src/main/java/model

I've also created Repository class in MyProject/src/main/java/dao directory called AlbumJpaRepository

I've created a execution file with main method in MyProject/src/main/java/dao directory

I've created two configuration XML files beans.xml and persistanceContext.xml in MyProject/src/main/resources directory

and the persistanceContext.xml

I'm starting the HSQLDB server successfully from the directory where my hsqldb- file is with the command
java -cp hsqldb- org.hsqldb.Server -database.0 temp -dbname.0 pix
and also successfully compiling the MyProject without any errors with maven. But when I try to execute the main class AlbumDao with the comand
mvn exec:java -Dexec.mainClass=dao.AlbumDao
I'm getting error ending like this

I've set it the dependencies in the pom.xml file I've also added sqltool.rc file in my home directory C:\Users\account that contains the following :

and still getting the same error
Some help
I may be on a wrong track and there is no way I can make it work with this approach or with this three softwares (Maven, Spring, HSQLDB ) for example I may also need a server Tomcat
10 years ago
Thanks David that solve my problem. It is fanny that I did not saw that but I wasn't expected syntax error. I thought that you can create war files only if your code is syntax errors free and that’s why I wasn’t checking for that kind of error
10 years ago