I fixed as below
ObjectMessage objectMessage = (ObjectMessage) messages.nextElement();
QueueBrowser queueBrowser = session.createBrowser(queue);
Enumeration<ObjectMessage> messages = queueBrowser.getEnumeration();
while (messages.hasMoreElements()) {
ObjectMessage objectMessage = (ObjectMessage) messages;// error here
Jms jms = new Jms();
People p = jms.new People();
p = (People) objectMessage.getObject();
System.err.println(p.getName());
}