Stas Melnychenko

+ Follow
since Feb 20, 2012
Stas likes ...
Merit badge: grant badges
For More
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 Stas Melnychenko

Mark Spritzler wrote:Well, first I recommend using the @Transactional annotation in your code instead of the verbose xml style of Transaction configuration.

Also, it looks to me that it probably is in your hibernate.cfg.xml file. That it doesn't have a DataSource configured in that file.

I also recommend no longer using a hibernate.cfg.xml file and put the configuration in your Spring configuration, which includes defining a bean for your DataSource.


You are right, now, when I have DataSource, apllication running well. Thanks.
One more question. What have I write to Spring configuration instead

in hibernate.cfg.xml?
11 years ago
Hello. I try manage transactions with Spring.
This is my applicationContext.xml:

When I try to run my web application, I get an error:
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'userService' defined in ServletContext resource [/WEB-INF/applicationContext.xml]: Initialization of bean failed;
nested exception is
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'txAdvice': Cannot resolve reference to bean 'transactionManager' while setting bean property 'transactionManager';
nested exception is
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'transactionManager' defined in ServletContext resource [/WEB-INF/applicationContext.xml]: Invocation of init method failed;
nested exception
is org.hibernate.service.UnknownUnwrapTypeException: Cannot unwrap to requested type [javax.sql.DataSource]

Please help.
11 years ago
I remove immediate=true from my submit button.
Work fine!
11 years ago
I figured out, that setter never called.
11 years ago
I made some change with same result

And value is still null.
11 years ago
I have selectOneMenu item on my page

And I have backbean:

11 years ago

Rob Spoor wrote:Did you add all the required JSF JAR files to your application's WEB-INF/lib folder?

Yes, I have jsf-impl.jar and jsf-api.jar in WEB-INF/lib folder.
Application work on jetty, so I think I added all libraries I need.
12 years ago
When I run my web application with jetty - it works.
But when I deploy it to Tomcat 6 - I get this error:

SEVERE: Servlet.service() for servlet jsp threw exception
org.apache.jasper.JasperException: PWC6033: Error in Javac compilation for JSP

PWC6197: An error occurred at line: 20 in the jsp file: /pages/mainpage.jsp
PWC6199: Generated servlet error:
package com.sun.faces.taglib.jsf_core does not exist

I do not understand anything. Pleas help. I will give all information you need.
12 years ago
I have two jsp pages in my web application: mainpage.jsp and registration.jsp.
Part of mainpage.jsp

When I click on registration link right I got mainpage, I get HTTP ERROR 404 and next url in address-bar:

But if I click login button at first and then click registration link - all work wright. Url is

A understand, that I miss some initialization, but I cannot find it.


12 years ago
I write my first web application, and I use JSF, Spring, Hibernate.
At first, I wrote authorization/registration part.
I have two pages, mainpage.jsp contain login form, and registration.jsp contain registering form.
And this is my beans:

So, my backbeans UserLogin and UserInfo are request-scoped, because its contain error messages like "Password is incorrect" or "User UserName already exists". And now I need one more session-scoped bean for containing current logged user. But I an not sure, HOW, so tell me please, am I wright:
I want to add new bean UserInfo and change existing bean UserLogin:

and method of UserLogin:

I change to

and UserInfo will contain

Am I on wright way or this is bad shot?

Another method: leave all beans in current stand, and just get current http session in login procedure and save user in it.

So what way is better?

12 years ago
As for me, Head First Java is good choice. But reading is not enough. You have to do exercises, lot of them. For examle, this exercises were interesting and useful for me.
I have been independently studying Java for 4 months and after I got my first work in Java.
12 years ago

Jeff Verdegan wrote:

Stas Melnychenko wrote:InputStream is abstract.

That doesn't really answer the question at all.

And note that, for instance, OutputStream.write(byte b[]) is not abstract.

Tnx, I understood.
12 years ago
String objects are immutable!

try this:

12 years ago