pavithra raghu

Greenhorn
+ Follow
since Dec 22, 2011
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by pavithra raghu

i am not understanding where to go in that website, help me out, i am doing that for my project
11 years ago
How to upload image, which should be taken from the jsp and send it to servlet which stores them in database.
I have idea that we have to use a library, the library which i am trying is commons-fileupload-1.2.2.jar. but i dont know the methods or the logic behind it
please help me out
11 years ago
this was my servlet program


package servlet;

import bean.statefullLocal;
import java.io.IOException;
import java.io.PrintWriter;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.naming.Context;
import javax.naming.InitialContext;
import javax.naming.NamingException;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;


@WebServlet(name="servletbean", urlPatterns={"/servletbean"})
public class servletbean extends HttpServlet {
statefullLocal statefull = lookupstatefullLocal();


protected void processRequest(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
response.setContentType("text/html;charset=UTF-8");
PrintWriter out = response.getWriter();
try {

out.println("<html>");
out.println("<head>");
out.println("<title>Servlet servletbean</title>");
out.println("</head>");
out.println("<body>");
out.println("<h1>Servlet servletbean at " + request.getContextPath () + "</h1>");
int zahl = statefull.getIntMemory();
statefull.setIntMemory(zahl + 10);
out.println(statefull.getIntMemory());
out.println("</body>");
out.println("</html>");

} finally {
out.close();
}
}


@Override
protected void doGet(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
processRequest(request, response);
}

@Override
protected void doPost(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
processRequest(request, response);
}


@Override
public String getServletInfo() {
return "Short description";
}// </editor-fold>

private statefullLocal lookupstatefullLocal() {
try {
Context c = new InitialContext();
// return (statefullLocal) c.lookup("java:global/statelessbean-war/statelessbean-ejb/statefull!bean.statefullLocal");
return (statefullLocal) c.lookup("java:global/statelessbean-ejb/statefullLocal");
} catch (NamingException ne) {
Logger.getLogger(getClass().getName()).log(Level.SEVERE, "exception caught", ne);
throw new RuntimeException(ne);
}
}

}

[b]my ejb file is
[/b]


package bean;

import javax.ejb.Stateful;


@Stateful
public class statefull implements statefullLocal {
Integer intMemory=0;
public Integer getIntMemory() {
return intMemory;
}

public void setIntMemory(int intMemory) {
this.intMemory = intMemory;
}

// Add business logic below. (Right-click in editor and choose
// "Insert Code > Add Business Method")

}

and I got the error as
type Exception report

message

descriptionThe server encountered an internal error () that prevented it from fulfilling this request.

exception

javax.servlet.ServletException: PWC1392: Error instantiating servlet class servlet.servletbean

root cause

com.sun.enterprise.container.common.spi.util.InjectionException: Error creating managed object for class servlet.servletbean

root cause

java.lang.RuntimeException: javax.naming.NamingException: Lookup failed for 'java:global/statelessbean-ejb/statefullLocal' in SerialContext [Root exception is javax.naming.NameNotFoundException: statelessbean-ejb]

root cause

javax.naming.NamingException: Lookup failed for 'java:global/statelessbean-ejb/statefullLocal' in SerialContext [Root exception is javax.naming.NameNotFoundException: statelessbean-ejb]

root cause

javax.naming.NameNotFoundException: statelessbean-ejb

note The full stack traces of the exception and its root causes are available in the GlassFish v3 lo




i tried with all the possibilities of lookup but its not working please help in getting output
Hi,
I am finding very difficult in creating an example in statefull session bean in netbeans 6.9.1,
please help