0

I have a UserService that fails with ClassNotFound when using ViewScoped but works with SessionScoped and I'm hoping someone can tell me why. My application mixes JSF2 with Spring.

The error I get is:

java.lang.ClassNotFoundException: com.dave.user.service.IUserService

The managed bean is

@ManagedBean(name="ClientMB")
@ViewScoped
public class ClientMB implements Serializable{


@ManagedProperty(value="#{UserService}")
IUserService  userService;

public IUserService getUserService() {
    return userService;
}

public void setUserService(IUserService userService) {
    this.userService = userService;
}

The UserService is defined as

public class UserService implements Serializable, IUserService  {

// UserDAO is injected...
IUserDAO userDAO;

}

The IUserService is just an interface:

public interface IUserService {

The declaration in ApplicationContext is

<bean id="UserService" class="com.dave.user.service.UserService">
    <property name="userDAO" ref="UserDAO" />
</bean>

As I said, this works fine using SessionScoped, but fails when I change the managed bean to ViewScoped.

4

1 に答える 1

0

Problem came from changing the state saving from server to client. Once I returned the state saving to server viewscope worked fine. Not quite sure why that happened but embarassing none the less.

于 2012-10-12T19:49:02.547 に答える