Win a copy of Pragmatic AI this week in the Artificial Intelligence forum!

Alejandro Barrero

Ranch Hand
+ Follow
since Aug 01, 2005
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 Alejandro Barrero

Thank you, you have cleared my confusion after something I read about @Configurablle.
3 weeks ago
I am using it in the following class

I am creating an instance of the class in

The problem is that in method

of  TestRepository I am getting repository null.
I am setting up the application as follows

I think that because of '@EnableJpaRepositories("com.packtpub.springdata.jpa.repository")' above ContactRepository should be injected in TestRepository since I used '@Configurable(autowire = Autowire.BY_NAME,dependencyCheck=true)' because I am instantiating the object myself and it is not managed by Spring. @Configurable is difficult to use and I have read in some cases you must use aspectj.
3 weeks ago
The Spring problem is the same; but one issue came from an Internet tutorial and the other one from a book. I appreciate the time you spend sending me messages, but if you cannot tell me something specific to address the problem, please don't waste your time.
3 weeks ago
The problem is not with the static variable, because

Doesn't work either.
3 weeks ago
The problem in the second case is that I instantiated the class, but even if I use @Configurable the problem continues.
3 weeks ago
The problem continues even after using @Repository
3 weeks ago
The first problem continues even if I use @Component
3 weeks ago
I have another problem; I changed Test

and changed ApplicationContext

Added "com.packtpub.springdata.jpa.repository" for ContactRepository (assumming it is needed

but now repository is null in

public void save(Contact updated) {;

in RepositoryContactService. I really don't know what I am doing wrong.
3 weeks ago
I have asked this question before about code from an Internet tutorial, but I was only told to look at other tutorials. Now I am trying to create an application following example code in the book "Spring Data" by Petri Kainulainen. I have a service RepositoryContactService

My ApplicationContext class sets the package of the service for scanning

I am running class Test

The problem is that the line ";" is giving me service null.
If you believe that you can tell me how to solve this problem, please let me know. If not please don't tell me anything; I am sorry to say this, but it happen this morning.
3 weeks ago
"/WEB-INF/view/" didn't work either.
I would have to look at other tutorials, because my knowledge of Spring doesn't allow me to understand what is wrong.

Looking at the console I found out that there are many exceptions beyond me.

SEVERE: Exception sending context initialized event to listener instance of class [org.springframework.web.context.ContextLoaderListener]
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'entityManagerFactory' defined in com.javaspringclub.config.HibernateConfig: Invocation of init method failed; nested exception is javax.persistence.PersistenceException: [PersistenceUnit: myJpaPersistenceUnit] Unable to build Hibernate SessionFactory
Caused by: javax.persistence.PersistenceException: [PersistenceUnit: myJpaPersistenceUnit] Unable to build Hibernate SessionFactory
Caused by: org.hibernate.exception.GenericJDBCException: Unable to open JDBC Connection for DDL execution
Caused by: java.sql.SQLException: Unknown initial character set index '255' received from server. Initial client character set can be forced via the 'characterEncoding' property.
... 61 more
3 weeks ago
You are correct, that's the correct way to do it; however, I don't just download and run; I followed the tutorial and compared the code with the downloaded code. Of course, I am probably still doing something wrong.
3 weeks ago
I just did with

Still doesn't work. I also tried with

but repository is null in getAllUsers() of UserServiceImpl
3 weeks ago
I downloaded the code in a zip file from a tutorial on the Internet. What path should I create on src?
3 weeks ago
Thanks Khalid, but I still have problems; I used '@Service("userService")' in class UserServiceImpl, but in class Test with 'private static UserService userService;' I am still getting userService null.
3 weeks ago
My apologies for not offering more details, but I have


I also have home.jsp in src/maim/webapp/WEB_INF/view
3 weeks ago