Win a copy of Microservices Testing (Live Project) this week in the Spring forum!

Dean Chester

Ranch Hand
+ Follow
since Jul 26, 2009
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 Dean Chester

Hi,
I'm 17 and wanting to take the SCJA and then move on to SCJP. I am just wondering if there are any restrictions on age, also are the resources sun also do are they worth it. I am currently doing my A-Levels and I will be doing this in my spare time. My aim is to be at Master/Level 3 by the time I go to university, which I want to study Computer Science.
Thanks in Advance
Dean
12 years ago
Thanks Misha that seems to have fixed the error.
Dean
12 years ago
Hi, I have set up tomcat to use a connection pool yet after the mysql timeout on connections the connections previously open in the pool are not opened.Here is what my context.xml file looks like:

As you can see i have included autoReconnect as true yet it doesn't. I have checked the process on the database after 8 hours which is what the time out is set to. If anyone can help then please help me as this has been a problem for a few months yet has just cropped up as urgent due to my software going live soon.
Thanks in Advance
Dean Chester
12 years ago
Here is what is in my JSP:

I get data from the bean and then post it on the webpage. I pass an array list as which is erroring as it is saying its empty(when its not if it queried the database). The arraylist is full of years and all i do is sort them so that i can display them as headers in the JSP, like this


That is achieved via a for loop that just counts downwards from the highest value in the arraylist to the lowest value in the arraylist. I have tried just the single connection approach as i was advised to go for by my brother, then this came up so I said I was moving the application to connection pooling. I think that it opens a connection the first time in the pool then the JSP loading fails, next time as that connection is already open it is ok to retrieve the data from the database.

To correct anusha

it will be opened once and the connection will be available at the application level till the server shut downs

Mysql has a default time out on connections of 8 hours then it will close all connections if not in use.

If you need anything else let me know.
Dean Chester
12 years ago
JSP
Hi,
I have written an application that works if the there is a connection open to the database, but if there are no connections open to the database then it fails. If i refresh the page after a failure it works. Has anyone got any suggestions to fix this issue it has been bugging me for some time now. I have moved my program to using a connection pool instead of opening a connection every time hoping that this would resolve the issue yet it hasn't. Another solution that was put to me was to use a cronjob every hour and refresh the webpage yet i don't like this approach. Has anyone got any other suggestions?
Thanks in Advance
Dean
P.S I know that this maybe in the wrong place yet it happens when i try to load a JSP.
12 years ago
JSP
Hi
Does anyone know of a good tutorial for a file upload system yet i also have other inputs in the form. I have a form that works but only as an upload so can anyone suggest something for a form with other details. I would store the stuff in the database so it would be possible to put it in the database yet i would much prefer the filename.
Thanks in Advance
Dean
12 years ago

Jeanne Boyarsky wrote:Dean,
This line is a problem.


Session is an implicit variable in the JSP. It is not a type. You could say new MimeMessage(s);. Or HttpSession s = Session....

Also, I hope you are just using this to experiment. The mail code should be in a Java class.



Yes i know that i can put this in my servlet of anything that i'm writing i am just interested in getting something so it will email people for registration purposes.
Dean
12 years ago
JSP
You could just generate a JSP with the users information with the relevant directory and then use a standardised layout for it and insert like the user name and things when the user registers.
Dean
12 years ago
JSP
Hi
I found this on the web so i thought i could change the code to send emails for when new users register yet this example code doesn't work

This is on the index page thats why the link just reloads the index page.
The error i got was this:
An error occurred at line: 17 in the jsp file: /index.jsp
Session cannot be resolved to a type
14: Properties props = new Properties();
15: props.put("mail.smtp.host", "mail.example.com");
16:
17: Session s = Session.getInstance(props, null);
18: MimeMessage message = new MimeMessage(s);
19:
20: try {

Has Anyone got a solution? Or know of an easier way of getting emails sent via a JSP/servlet. BTW I did change the SMTP server and the email addresses yet changed them for the purpose of showing you my code.
Thanks in Advance
Dean
12 years ago
JSP
Hi
Does anyone know how to log out when using basic authentication? I now have something working with it after many months of playing its just now i can't log out.
Thanks in Advance
Dean.
12 years ago
How do you mean i enabled session persistance on tomcat which uses a database and that works.
Dean
12 years ago
No in my database which it access as i can get logged in just when i come to do something once logged in i have to relogin.
Dean
12 years ago