Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8476797
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T18:16:44+00:00 2026-06-10T18:16:44+00:00

I have a really strange Problem with my new Vaadin Project. If I start

  • 0

I have a really strange Problem with my new Vaadin Project.
If I start my Application and log in with a User, then switch the Browser and open the Site again, it seems that the Sessions will be shared. I have the same Content in both Windows.

I readed a few forum Posts about this Problem, all they say don´t open the App in the same Browser. Ok, i startet a VM, but, the same Problem. Or, remove all static variables from the context. I have done that, now using the ThreadLocal-Pattern.

I have absolutly no idea whats wrong. What I believe is that the Spring Context kills Vaadin, has anyone ever had this experience with Vaadin and Spring?

To bring Spring and Vaadin togehter I use the Spring Intgration Addon for Vaadin by Nicolas Frankel (https://vaadin.com/directory#addon/spring-integration)

I will post my Application Code for further investigation.

===================

The Vaadin Application Class:

public class MainApplication extends Application implements HttpServletRequestListener    {
private static final long serialVersionUID = 2067470624065324231L;

private static ThreadLocal<MainApplication> threadLocal = new ThreadLocal<MainApplication>();

private Window mainWindow;

//Viewmanager
private ViewManager viewManager;

private Professor professor;

//DAO Classes and Bean Setter´s
ProfessorDAO professorDAO;
QuestionDAO questionDAO;
AnswerDAO answerDAO;
AnsweredDAO answeredDAO;
QRCodeDAO qrCodeDAO;

public void setProfessorDAO(ProfessorDAO professorDAO) {
    System.out.println("Setting ProfessorDAO!");
    System.out.println(professorDAO.toString());
    this.professorDAO = professorDAO;
}

public void setQuestionDAO(QuestionDAO questionDAO) {
    System.out.println("Setting QuestionDAO!");
    System.out.println(questionDAO.toString());
    this.questionDAO = questionDAO;
}

public void setAnswerDAO(AnswerDAO answerDAO) {
    System.out.println("Setting AnswerDAO!");
    System.out.println(answerDAO.toString());
    this.answerDAO = answerDAO;
}

public void setAnsweredDAO(AnsweredDAO answeredDAO) {
    System.out.println("Setting AnsweredDAO!");
    System.out.println(answeredDAO.toString());
    this.answeredDAO = answeredDAO;
}

public void setQrCodeDAO(QRCodeDAO qrCodeDAO) {
    System.out.println("Setting QRCodeDAO!");
    System.out.println(qrCodeDAO.toString());
    this.qrCodeDAO = qrCodeDAO;
}

public ProfessorDAO getProfessorDAO() {
    return professorDAO;
}

public QuestionDAO getQuestionDAO() {
    return questionDAO;
}

public AnswerDAO getAnswerDAO() {
    return answerDAO;
}

public AnsweredDAO getAnsweredDAO() {
    return answeredDAO;
}

public QRCodeDAO getQrCodeDAO() {
    return qrCodeDAO;
}

//Currently logged in Professor.
public Professor getProfessor() {
    return professor;
}

public void setProfessor(Professor professor) {
    this.professor = professor;
}



public static void setInstance(MainApplication application){
    threadLocal.set(application);
}

public ViewManager getViewManager() {
    return viewManager;
}

public void setViewManager(ViewManager viewManager) {
    this.viewManager = viewManager;
}

public static MainApplication getInstance(){
    return threadLocal.get();
}

public MainApplication() {
}

@Override
public void init() {
    setInstance(this);

    setTheme("crs");

    mainWindow = new Window("CRS -- Classroom Response System");
    setMainWindow(mainWindow);

    viewManager = new ViewManager(mainWindow);

    viewManager.switchScreen(LoginScreen.class.getName(), new LoginScreen());


    //mainWindow = new MainWindow("CRS -- Classroom Response System");
    //setMainWindow(mainWindow);


}


public void onRequestStart(HttpServletRequest request,
        HttpServletResponse response) {
    MainApplication.setInstance(this);

}

public void onRequestEnd(HttpServletRequest request,
        HttpServletResponse response) {
    threadLocal.remove();

}

The web.xml:

<display-name>CRSServer</display-name>


<context-param>
    <description>
    Vaadin production mode</description>
    <param-name>productionMode</param-name>
    <param-value>false</param-value>
</context-param>


<servlet>
    <servlet-name>CRS</servlet-name>
    <servlet-class>ch.frankel.vaadin.spring.SpringApplicationServlet</servlet-class>
    <init-param>
        <description>
        Vaadin application class to start</description>
        <param-name>applicationBeanName</param-name>
        <param-value>cs.hm.edu.kreipl.crs.frontend.MainApplication</param-value>
    </init-param>

    <init-param>
        <description>
        Application widgetset</description>
        <param-name>widgetset</param-name>
        <param-value>cs.hm.edu.kreipl.crs.widgetset.CrsserverWidgetset</param-value>
    </init-param>
</servlet>


<servlet-mapping>
    <servlet-name>CRS</servlet-name>
    <url-pattern>/*</url-pattern>
</servlet-mapping>

<listener>
    <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>


<listener>
    <listener-class>org.springframework.web.context.request.RequestContextListener</listener-class>
</listener>


<context-param>
    <param-name>contextConfigLocation</param-name>  
    <param-value>WEB-INF/spring-config.xml</param-value>
</context-param>

The Spring Context

<context:component-scan base-package="cs.hm.edu.kreipl.crs" />
<bean id="myDataSource"
    class="org.springframework.jdbc.datasource.DriverManagerDataSource">
    <property name="driverClassName"
        value="com.mysql.jdbc.Driver">
    </property>
    <property name="url" value="jdbc:mysql://localhost:3306/crs"></property>
    <property name="username" value="crs"></property>
    <property name="password" value="password"></property>
</bean>

<bean id="mySessionFactory" class="org.springframework.orm.hibernate3.annotation.AnnotationSessionFactoryBean">
    <property name="dataSource" ref="myDataSource"/>
    <property name="annotatedClasses">
        <list>
            <value>cs.hm.edu.kreipl.crs.database.entity.Professor</value>
            <value>cs.hm.edu.kreipl.crs.database.entity.Answer</value>
            <value>cs.hm.edu.kreipl.crs.database.entity.Answered</value>
            <value>cs.hm.edu.kreipl.crs.database.entity.Question</value>
            <value>cs.hm.edu.kreipl.crs.database.entity.QuestionQRCode</value>
        </list>
    </property>
    <property name="hibernateProperties">
        <props>
            <prop key="hibernate.dialect">org.hibernate.dialect.MySQL5Dialect</prop>
            <prop key="hibernate.show_sql">true</prop>
            <prop key="hbm2ddl.auto">create</prop>
    </props>
    </property>
</bean>

<bean id="transactionManager" class="org.springframework.orm.hibernate3.HibernateTransactionManager">
    <property name="sessionFactory" ref="mySessionFactory" />
</bean>

<tx:annotation-driven/>

<!-- VAADIn Startup -->
<bean id="cs.hm.edu.kreipl.crs.frontend.MainApplication" class="cs.hm.edu.kreipl.crs.frontend.MainApplication">
    <property name="answerDAO" ref="answerDAO" />
    <property name="answeredDAO" ref="answeredDAO" />
    <property name="professorDAO" ref="professorDAO" />
    <property name="qrCodeDAO" ref="qrCodeDAO" />
    <property name="questionDAO" ref="questionDAO" />
</bean>



<bean id="professorDAO" class="cs.hm.edu.kreipl.crs.database.implementation.ProfessorDAOImpl">
    <constructor-arg>
        <value>cs.hm.edu.kreipl.crs.database.entity.Professor</value>
    </constructor-arg>
    <property name="hibernateTemplate" ref="mySessionFactory"/>
</bean>
<bean id="questionDAO" class="cs.hm.edu.kreipl.crs.database.implementation.QuestionDAOImpl">
    <constructor-arg>
        <value>cs.hm.edu.kreipl.crs.database.entity.Question</value>
    </constructor-arg>
    <property name="hibernateTemplate" ref="mySessionFactory"/>
</bean>
<bean id="qrCodeDAO" class="cs.hm.edu.kreipl.crs.database.implementation.QRCodeDAOImpl">
    <constructor-arg>
        <value>cs.hm.edu.kreipl.crs.database.entity.QuestionQRCode</value>
    </constructor-arg>
    <property name="hibernateTemplate" ref="mySessionFactory"/>
</bean>
<bean id="answerDAO" class="cs.hm.edu.kreipl.crs.database.implementation.AnswerDAOImpl">
    <constructor-arg>
        <value>cs.hm.edu.kreipl.crs.database.entity.Answer</value>
    </constructor-arg>
    <property name="hibernateTemplate" ref="mySessionFactory"/>
</bean>
<bean id="answeredDAO" class="cs.hm.edu.kreipl.crs.database.implementation.AnsweredDAOImpl">
    <constructor-arg>
        <value>cs.hm.edu.kreipl.crs.database.entity.Answered</value>
    </constructor-arg>
    <property name="hibernateTemplate" ref="mySessionFactory"/>
</bean>
<bean id="deviceDAO" class="cs.hm.edu.kreipl.crs.database.implementation.DeviceDAOImpl">
    <constructor-arg>
        <value>cs.hm.edu.kreipl.crs.database.entity.Device</value>
    </constructor-arg>
    <property name="hibernateTemplate" ref="mySessionFactory"/>
</bean>

If you need any further classes please let me now.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-10T18:16:46+00:00Added an answer on June 10, 2026 at 6:16 pm

    I am using Vaadin + Spring but without Spring Integration Addon.
    I think that the problem is that you are not creating a new Vaadin applicationBean for the new user that requests the application.

    In my app, I pass the applicationBean in web.xml. My Vaadin application is annotated with:

    Application Class

    @Component(value = "appName")
    @Scope(value = "session")
    class AppName extends Application {
    ....
    }
    

    WEB.XML

        <init-param>
            <param-name>applicationBean</param-name>
            <param-value>appName</param-value>
        </init-param>
    

    And for every new session Servlet returns new app.
    In your web.xml you pass your vaadin application like this:

    Your WEB.XML

       <init-param>
            <description>
            Vaadin application class to start</description>
            <param-name>applicationBeanName</param-name>
            <param-value>cs.hm.edu.kreipl.crs.frontend.MainApplication</param-value>
        </init-param>
    

    So it returns every time the same app for all users. And that’s what I think causes the problem.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a strange problem and really dont know where to start debug. I
Hi everyone I have a really strange problem. I create a new subclass of
We have a really strange problem in xpages regarding dates, the Notesdocument we have
I have a really strange problem with SQL Server 2008. We have an e-commerce
I have a really strange problem and I'm completely puzzled. I have a piece
I'm having a really strange problem. I have 2 virtual machines running ubuntu 11.4
I have a really strange issue. I am working on a Java SWING application
I've come across a really strange problem. I have written a simple Deck class
We have a strange problem. I added a couple of new schema's and orchestrations
Today I faced a strange problem. I have an application which is the same

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.