NetBeans Forums
| View previous topic :: View next topic |
| Author |
Message |
dae_mon
Joined: 03 May 2009 Posts: 1
|
Posted: Sun May 03, 2009 6:02 am Post subject: Netbeans 5.5.1 Error |
|
|
Hi i'm busy doing a project that requires as to use Message-Driven Beans so far i have had no problem in creating the Beans but when it come to using them in my servlet i get the following error: javax.annotation.Resource.authentication Type()Javax/annotation/Resource$AuthenticationType;at com.sun.enterprise.deployment.annotation.AnnotationInfo@ba356 .
The code i am using in the servlet is as follows:
package web2;
import ejb.iconEntityBean;
import ejb.iconMessageEntity;
import ejb.iconMessageEntityFacadeLocal;
import ejb.loginBean;
import java.io.*;
import java.util.Iterator;
import java.util.List;
import javax.annotation.Resource.AuthenticationType;
import javax.annotation.Resource;
import javax.ejb.EJB;
import javax.jms.Connection;
import javax.jms.ConnectionFactory;
import javax.jms.JMSException;
import javax.jms.MessageProducer;
import javax.jms.ObjectMessage;
import javax.jms.Queue;
import javax.jms.Session;
import javax.servlet.*;
import javax.servlet.http.*;
public class message extends HttpServlet {
@EJB
private iconMessageEntityFacadeLocal iconMessageEntityFacade;
@Resource(mappedName="jms/iconMessageBeanFactory")
private ConnectionFactory connectionFactory;
@Resource(mappedName="jms/iconMessageBean")
private Queue queue;
/** Processes requests for both HTTP <code>GET</code> and <code>POST</code> methods.
* @param request servlet request
* @param response servlet response
*/
protected void processRequest(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
response.setContentType("text/html;charset=UTF-8");
PrintWriter out = response.getWriter();
out.println("<html>");
out.println("<head>");
out.println("<title>Icon Store</title>");
out.println("</head>");
out.println(" <body bgcolor='#a395e0'>");
out.println("<center>");
String id2 = request.getParameter("id2");
String name = request.getParameter("name");
String color = request.getParameter("color");
String price = request.getParameter("price");
String gender = request.getParameter("gender");
String stock = request.getParameter("stock");
String type = request.getParameter("type");
String clothID = request.getParameter("clothID");
String ans = "";
String[] stuff;
iconEntityBean icBean = new iconEntityBean();
loginBean logBean = new loginBean();
int row = 0;
System.out.println(id2);
if(id2!=null ) {
try {
row = icBean.UpdateClothes(id2, name, color, price, gender, stock, type);
} catch (Exception e) {
e.printStackTrace();
}
if(row == 1) {
try {
Connection conn = connectionFactory.createConnection();
Session sess = conn.createSession(false, Session.AUTO_ACKNOWLEDGE);
MessageProducer messageProducer = sess.createProducer(queue);
ObjectMessage message = sess.createObjectMessage();
iconMessageEntity icmEntity = new iconMessageEntity();
icmEntity.setIconMessage(name);
message.setObject(icmEntity);
messageProducer.send(message);
messageProducer.close();
conn.close();
} catch(JMSException e) {
e.printStackTrace();
}catch (Exception e)
{
out.println("Can not find info");
}
} else {
out.println("Was unable to update clothing item");
}
List list = iconMessageEntityFacade.findAll();
for (Iterator it = list.iterator(); it.hasNext(); ) {
iconMessageEntity e = (iconMessageEntity) it.next();
out.println(e.getIconMessage() + "was updated successfully");
}
}else if(clothID != null) {
try {
row = icBean.DelClothes(clothID);
} catch (Exception e) {
e.printStackTrace();
}
if(row == 1) {
try {
ans = logBean.Clothe(clothID);
stuff = ans.split(":");
String name2 = stuff[1];
Connection conn = connectionFactory.createConnection();
Session sess = conn.createSession(false, Session.AUTO_ACKNOWLEDGE);
MessageProducer messageProducer = sess.createProducer(queue);
ObjectMessage message = sess.createObjectMessage();
iconMessageEntity icmEntity = new iconMessageEntity();
icmEntity.setIconMessage(name2);
message.setObject(icmEntity);
messageProducer.send(message);
messageProducer.close();
conn.close();
} catch(JMSException e) {
e.printStackTrace();
}
} else {
out.println("Was unable to update clothing item");
}
List list = iconMessageEntityFacade.findAll();
for (Iterator it = list.iterator(); it.hasNext(); ) {
iconMessageEntity e = (iconMessageEntity) it.next();
out.println(e.getIconMessage() + "was deleted successfully");
}
} else {
try {
row = icBean.AddClothes(name, color, price, gender, stock, type);
} catch (Exception e) {
e.printStackTrace();
}
if(row == 1) {
try {
Connection conn = connectionFactory.createConnection();
Session sess = conn.createSession(false, Session.AUTO_ACKNOWLEDGE);
MessageProducer messageProducer = sess.createProducer(queue);
ObjectMessage message = sess.createObjectMessage();
iconMessageEntity icmEntity = new iconMessageEntity();
icmEntity.setIconMessage(name);
message.setObject(icmEntity);
messageProducer.send(message);
messageProducer.close();
conn.close();
} catch(JMSException e) {
e.printStackTrace();
}
} else {
out.println("Was unable to add clothing item");
}
List list = iconMessageEntityFacade.findAll();
for (Iterator it = list.iterator(); it.hasNext(); ) {
iconMessageEntity e = (iconMessageEntity) it.next();
out.println(e.getIconMessage() + "was updated successfully");
}
}
out.println("</center>>");
out.println("<div class='link'>");
out.println("<table>");
out.println("<tr>");
out.println("<td class='td'>");
out.println("<a class='a' href='log.jsp'>Log Out</a>");
out.println("</td>");
out.println("</tr>");
out.println("<tr>");
out.println("<td class='td'>");
out.println("<a class='a' href='own.jsp?name=add'>Add Item</a>");
out.println("</td>");
out.println("</tr>");
out.println("<tr>");
out.println("<td class='td'>");
out.println("<a class='a' href='own.jsp?name=del'>Delete Itemt</a>");
out.println("</td>");
out.println("</tr>");
out.println("<tr>");
out.println("<td class='td'>");
out.println("<a class='a' href='own.jsp?name=upd'>Update Item</a>");
out.println("</td>");
out.println("</tr>");
out.println("</table>");
out.println("</div>");
out.println("</body>");
out.println("</html>");
out.close();
}
// <editor-fold defaultstate="collapsed" desc="HttpServlet methods. Click on the + sign on the left to edit the code.">
/** Handles the HTTP <code>GET</code> method.
* @param request servlet request
* @param response servlet response
*/
protected void doGet(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
processRequest(request, response);
}
/** Handles the HTTP <code>POST</code> method.
* @param request servlet request
* @param response servlet response
*/
protected void doPost(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
processRequest(request, response);
}
/** Returns a short description of the servlet.
*/
public String getServletInfo() {
return "Short description";
}
// </editor-fold>
}
The code for the message driven bean is from a book provided to me. I am very new to J2EE and do not know what the error is refering to. If anyone can either tell me what the error means or a way to stop netbeans throwing the abovementioned error i would really appreciate it. |
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum You can attach files in this forum You can download files in this forum
|
|