9 |
import javax.jms.Queue; |
import javax.jms.Queue; |
10 |
import javax.jms.Session; |
import javax.jms.Session; |
11 |
import javax.jms.TextMessage; |
import javax.jms.TextMessage; |
|
import javax.naming.InitialContext; |
|
|
import javax.naming.NamingException; |
|
12 |
import javax.servlet.ServletException; |
import javax.servlet.ServletException; |
13 |
import javax.servlet.annotation.WebServlet; |
import javax.servlet.annotation.WebServlet; |
14 |
import javax.servlet.http.HttpServlet; |
import javax.servlet.http.HttpServlet; |
21 |
private static final long serialVersionUID = 1L; |
private static final long serialVersionUID = 1L; |
22 |
|
|
23 |
|
|
24 |
// why doesn't @Resource work ?? |
// resource mapped vars may of course not be static ! |
25 |
@Resource(mappedName = "jms/helloFactory") |
@Resource(mappedName = "jms/helloFactory") |
26 |
private static ConnectionFactory connectionFactory; |
private ConnectionFactory connectionFactory; |
27 |
|
|
28 |
@Resource(mappedName = "jms/hello") |
@Resource(mappedName = "jms/hello") |
29 |
private static Queue queue; |
private Queue queue; |
30 |
|
|
31 |
|
|
32 |
@Override |
@Override |
33 |
public void init() throws ServletException { |
public void init() throws ServletException { |
34 |
|
/* |
35 |
try { |
try { |
36 |
InitialContext ic = new InitialContext(); |
InitialContext ic = new InitialContext(); |
37 |
if (connectionFactory == null) { |
if (connectionFactory == null) { |
44 |
} |
} |
45 |
} catch(NamingException ne) { |
} catch(NamingException ne) { |
46 |
throw new ServletException(ne); |
throw new ServletException(ne); |
47 |
} |
}*/ |
48 |
} |
} |
49 |
|
|
50 |
|
|