Search Results

Search found 198 results on 8 pages for 'servletexception'.

Page 1/8 | 1 2 3 4 5 6 7 8  | Next Page >

  • HibernateFilter.doFilter ServletException?

    - by Austin R
    I have pretty much zero experience setting up servers, but currently my job is to set one up (don't ask why). It's an an apache-tomcat6 server. I followed some instructions step by step, and when it came time to test that everything was working, here's what I got: I know this is a bit of a shot in the dark, but does anyone know what I can do to fix this? Please let me know if there's any further information I can provide to help!

    Read the article

  • Can't instantiate javax.servlet.ServletException

    - by Denis
    Hello, experts! I am trying to create instance of class javax.servlet.ServletException with following code public class MyTroubleViewer { public static void main(String[] args) { javax.servlet.ServletException servletException = new javax.servlet.ServletException("Hello"); System.out.println(servletException.getMessage()); } } But I get exception on creating: Exception in thread "main" java.lang.ClassFormatError: Absent Code attribute in method that is not native or abstract in class file javax/servlet/ServletException ... Maven helps me with dependecies: <dependency> <groupId>javax</groupId> <artifactId>javaee-api</artifactId> <version>6.0</version> <type>jar</type> <scope>compile</scope> </dependency> What am I doing wrong?

    Read the article

  • javax.servlet.ServletException: Servlet.init() for servlet Relay threw exception

    - by Talha Bin Shakir
    I built application by using Netbeans and its working fine. But When i deployed on TOMCAT I am getting this error javax.servlet.ServletException: Servlet.init() for servlet Relay threw exception org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102) org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:293) org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:849) org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583) org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:454) java.lang.Thread.run(Thread.java:636) *root cause* java.security.AccessControlException: access denied (java.util.PropertyPermission jasper.reports.compile.class.path write) java.security.AccessControlContext.checkPermission(AccessControlContext.java:342) java.security.AccessController.checkPermission(AccessController.java:553) java.lang.SecurityManager.checkPermission(SecurityManager.java:549) java.lang.System.setProperty(System.java:744) com.servlet.Relay.init(Relay.java:38) javax.servlet.GenericServlet.init(GenericServlet.java:212) sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) java.lang.reflect.Method.invoke(Method.java:616) org.apache.catalina.security.SecurityUtil$1.run(SecurityUtil.java:269) java.security.AccessController.doPrivileged(Native Method) javax.security.auth.Subject.doAsPrivileged(Subject.java:537) org.apache.catalina.security.SecurityUtil.execute(SecurityUtil.java:301) org.apache.catalina.security.SecurityUtil.doAsPrivilege(SecurityUtil.java:162) org.apache.catalina.security.SecurityUtil.doAsPrivilege(SecurityUtil.java:115) org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102) org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:293) org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:849) org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583) org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:454) Any Idea.

    Read the article

  • javax.servlet.ServletException: WriteText method cannot write null text

    - by Learner
    I have created a Web application using JSF+Icefaces+Richfaces+Primefaces.It is working great while I run it from eclipse as a project but When I created its WAR file and deployed in GlassFish Server then while rendering a page it is throwing this exception javax.servlet.ServletException: WriteText method cannot write null text I searched but didn't get any good solution.A quick help is highly appreciated Edit:1 I think this would be the relevant part for this <li class="page_item" id="liMasterSearch"> <!-- this is for hide (<li class="page_item hide" id="liMasterSearch"> applied to every class) --> <h:commandLink value="Search" action="#{masterRenderBean.showSimpleSearch}"></h:commandLink> </li> <li class="page_item" id="liAdvanceSearch"> <h:commandLink value="Advance Search" action="#{masterRenderBean.showADVS}"></h:commandLink> </li> Here you can see two links (1) Search and (2) Advance Search when I click on Search , It shows search page (By rendering-Actually I have included all pages in masterpage and render them on commandlink functions) <h:panelGroup rendered="#{not masterRenderBean.simpleSearch}"> <ui:include src="../../WebPages/SearchPages/MasterSearch.xhtml"></ui:include> </h:panelGroup> But When I click on Advance Search link (on which this part should render) <h:panelGroup rendered="#{not masterRenderBean.advs}"> <ui:include src="../../WebPages/SearchPages/PersonalAdvanceSearch.xhtml"/> </h:panelGroup> The browser show the above exception. NOTE: Keep in mind that this problem is occurring in deploying.It is not coming in actual application when I run it from eclipse from code EDIT:2 I found in server logs that this exception is coming due to acefaces and this portion of code <ace:autoCompleteEntry id="txtplaceofbirth" rows="10" autocomplete="false" minChars="2" width="150" value="#{inputPersonal.selectedplcofBirth}" filterMatchMode="none" valueChangeListener="#{inputPersonal.valueChangeEventCity}"> <f:selectItems value="#{inputPersonal.cities}"/> </ace:autoCompleteEntry></h:outputFormat> is messing up.Any idea Why this is hapening? Edit #3: Here is the full tack trace of exception [#|2012-11-19T09:55:48.026+0500|SEVERE|glassfish3.1.2|javax.enterprise.system.std.com.sun.enterprise.server.logging|_ThreadID=53;_ThreadName=Thread-2;|java.lang.NullPointerException: WriteText method cannot write null text at org.icefaces.impl.context.DOMResponseWriter.writeText(DOMResponseWriter.java:314) at org.icefaces.impl.context.DOMResponseWriter.writeText(DOMResponseWriter.java:340) at com.sun.faces.renderkit.html_basic.OutputMessageRenderer.encodeEnd(OutputMessageRenderer.java:163) at javax.faces.component.UIComponentBase.encodeEnd(UIComponentBase.java:875) at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1764) at javax.faces.render.Renderer.encodeChildren(Renderer.java:168) at org.icefaces.impl.renderkit.RendererWrapper.encodeChildren(RendererWrapper.java:49) at javax.faces.component.UIComponentBase.encodeChildren(UIComponentBase.java:845) at com.sun.faces.renderkit.html_basic.HtmlBasicRenderer.encodeRecursive(HtmlBasicRenderer.java:304) at com.sun.faces.renderkit.html_basic.GroupRenderer.encodeChildren(GroupRenderer.java:105) at javax.faces.component.UIComponentBase.encodeChildren(UIComponentBase.java:845) at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1757) at javax.faces.render.Renderer.encodeChildren(Renderer.java:168) at org.icefaces.impl.renderkit.RendererWrapper.encodeChildren(RendererWrapper.java:49) at javax.faces.component.UIComponentBase.encodeChildren(UIComponentBase.java:845) at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1757) at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1760) at org.icefaces.impl.context.DOMPartialViewContext.processPartial(DOMPartialViewContext.java:142) at javax.faces.component.UIViewRoot.encodeChildren(UIViewRoot.java:981) at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1757) at com.sun.faces.application.view.FaceletViewHandlingStrategy.renderView(FaceletViewHandlingStrategy.java:391) at com.sun.faces.application.view.MultiViewHandler.renderView(MultiViewHandler.java:131) at javax.faces.application.ViewHandlerWrapper.renderView(ViewHandlerWrapper.java:288) at com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:121) at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:101) at com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:139) at javax.faces.webapp.FacesServlet.service(FacesServlet.java:594) at org.apache.catalina.core.StandardWrapper.service(StandardWrapper.java:1542) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:281) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175) at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:655) at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:595) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:161) at org.apache.catalina.connector.CoyoteAdapter.doService(CoyoteAdapter.java:331) at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:231) at com.sun.enterprise.v3.services.impl.ContainerMapper$AdapterCallable.call(ContainerMapper.java:317) at com.sun.enterprise.v3.services.impl.ContainerMapper.service(ContainerMapper.java:195) at com.sun.grizzly.http.ProcessorTask.invokeAdapter(ProcessorTask.java:849) at com.sun.grizzly.http.ProcessorTask.doProcess(ProcessorTask.java:746) at com.sun.grizzly.http.ProcessorTask.process(ProcessorTask.java:1045) at com.sun.grizzly.http.DefaultProtocolFilter.execute(DefaultProtocolFilter.java:228) at com.sun.grizzly.DefaultProtocolChain.executeProtocolFilter(DefaultProtocolChain.java:137) at com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:104) at com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:90) at com.sun.grizzly.http.HttpProtocolChain.execute(HttpProtocolChain.java:79) at com.sun.grizzly.ProtocolChainContextTask.doCall(ProtocolChainContextTask.java:54) at com.sun.grizzly.SelectionKeyContextTask.call(SelectionKeyContextTask.java:59) at com.sun.grizzly.ContextTask.run(ContextTask.java:71) at com.sun.grizzly.util.AbstractThreadPool$Worker.doWork(AbstractThreadPool.java:532) at com.sun.grizzly.util.AbstractThreadPool$Worker.run(AbstractThreadPool.java:513) at java.lang.Thread.run(Thread.java:722) |#]

    Read the article

  • Can't run my servlet from tomcat server even though the classes are in package

    - by Mido
    Hi there, i am trying to get my servlet to run, i have been searching for 2 days and trying every possible solution and no luck. The servet class is in the appropriate folder (i.e under the package name). I also added the jar files needed in my servlet into lib folder. the web.xml file maps the url and defines the servlet. So i did everything in the documentation and wt people said in here and still getting this error : type Exception report message description The server encountered an internal error () that prevented it from fulfilling this request. exception javax.servlet.ServletException: Error instantiating servlet class assign1a.RPCServlet org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:108) org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:558) org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:379) org.apache.coyote.http11.Http11AprProcessor.process(Http11AprProcessor.java:282) org.apache.coyote.http11.Http11AprProtocol$Http11ConnectionHandler.process(Http11AprProtocol.java:357) org.apache.tomcat.util.net.AprEndpoint$SocketProcessor.run(AprEndpoint.java:1687) java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886) java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908) java.lang.Thread.run(Thread.java:619) root cause java.lang.NoClassDefFoundError: assign1a/RPCServlet (wrong name: server/RPCServlet) java.lang.ClassLoader.defineClass1(Native Method) java.lang.ClassLoader.defineClassCond(ClassLoader.java:632) java.lang.ClassLoader.defineClass(ClassLoader.java:616) java.security.SecureClassLoader.defineClass(SecureClassLoader.java:141) org.apache.catalina.loader.WebappClassLoader.findClassInternal(WebappClassLoader.java:2820) org.apache.catalina.loader.WebappClassLoader.findClass(WebappClassLoader.java:1143) org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1638) org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1516) org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:108) org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:558) org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:379) org.apache.coyote.http11.Http11AprProcessor.process(Http11AprProcessor.java:282) org.apache.coyote.http11.Http11AprProtocol$Http11ConnectionHandler.process(Http11AprProtocol.java:357) org.apache.tomcat.util.net.AprEndpoint$SocketProcessor.run(AprEndpoint.java:1687) java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886) java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908) java.lang.Thread.run(Thread.java:619) note The full stack trace of the root cause is available in the Apache Tomcat/7.0.5 logs. Also here is my servlet code : package assign1a; import java.io.IOException; import java.util.logging.Level; import java.util.logging.Logger; import javax.servlet.ServletException; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import lib.jsonrpc.RPCService; public class RPCServlet extends HttpServlet { /** * */ private static final long serialVersionUID = -5274024331393844879L; private static final Logger log = Logger.getLogger(RPCServlet.class.getName()); protected RPCService service = new ServiceImpl(); public void doGet(HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException { response.setContentType("text/html"); response.getWriter().write("rpc service " + service.getServiceName() + " is running..."); } public void doPost(HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException { try { service.dispatch(request, response); } catch (Throwable t) { log.log(Level.WARNING, t.getMessage(), t); } } } Please help me :) Thanks. EDIT: here are the contents of my web.xml file <web-app xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd" version="3.0" metadata-complete="true"> <servlet> <servlet-name>jsonrpc</servlet-name> <servlet-class>assign1a.RPCServlet</servlet-class> </servlet> <servlet-mapping> <servlet-name>jsonrpc</servlet-name> <url-pattern>/rpc</url-pattern> </servlet-mapping> </web-app>

    Read the article

  • jsp servlet exception: bean not found within scope.

    - by stu
    I'm getting this error: javax.servlet.ServletException: bean givingFormBean not found within scope on a page with this at the top. The class exists in the classpath, it worked this morning, and I don't get what not found within scope means. I've googled and googled and nothing useful came up.

    Read the article

  • Servlet Exception + Class Cast Exception + Glassfish + Netbeans + JPA Entities + Vaadin

    - by Random Joe
    Hi all, I get this error: StandardWrapperValve[Vaadin Servlet]: PWC1406: Servlet.service() for servlet Vaadin Servlet threw exception java.lang.ClassCastException: com.delhi.entities.Category cannot be cast to com.delhi.entities.Category when I try to run my webapps on glassfish v2. Category is a JPA entity object the offending code according to the server log is: for (Category c : categories) { mymethod(); } categories is derived from: List<Category> categories = q.getResultList(); Any idea what went wrong?

    Read the article

  • javax.servlet.ServletException - how could i get to the cause?

    - by Michal
    Hi, i'm getting a very strange error while opening one of the pages in my web app. The application is built on Seam 2.2 and is using JSF (RichFaces) as a view technology. I run it on Tomcat 6. The error i'm describing doesn't occur on my machine (Mac OS X), but it does on my client's dev machines (Windows) and on the server (Linux Debian). I'm sure i'm running the same version on each system and i have tried connecting to the same database... In logs everything looks fine - each next JSF Phase executes normally, and after the last one, there is this moment when the request starts processing for the SEAM debug page... And this is the stack trace i see on the debug page (nothing is logged): Exception during request processing: Caused by javax.servlet.ServletException with message: "Servlet execution threw an exception" org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:313) org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:83) org.jboss.seam.web.IdentityFilter.doFilter(IdentityFilter.java:40) org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69) org.jboss.seam.web.MultipartFilter.doFilter(MultipartFilter.java:90) org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69) org.jboss.seam.web.ExceptionFilter.doFilter(ExceptionFilter.java:64) org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69) org.jboss.seam.web.RedirectFilter.doFilter(RedirectFilter.java:45) org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69) org.ajax4jsf.webapp.BaseXMLFilter.doXmlFilter(BaseXMLFilter.java:178) org.ajax4jsf.webapp.BaseFilter.handleRequest(BaseFilter.java:290) org.ajax4jsf.webapp.BaseFilter.processUploadsAndHandleRequest(BaseFilter.java:388) org.ajax4jsf.webapp.BaseFilter.doFilter(BaseFilter.java:515) org.jboss.seam.web.Ajax4jsfFilter.doFilter(Ajax4jsfFilter.java:56) org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69) org.jboss.seam.web.LoggingFilter.doFilter(LoggingFilter.java:60) org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69) org.jboss.seam.web.HotDeployFilter.doFilter(HotDeployFilter.java:53) org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69) org.jboss.seam.servlet.SeamFilter.doFilter(SeamFilter.java:158) org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235) org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) pl.mgibowski.alterium.util.LoggingFilter.doFilter(LoggingFilter.java:18) org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235) org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233) org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191) org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:465) org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127) org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102) org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109) org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:298) org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:852) org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:588) org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489) java.lang.Thread.run(Thread.java:619) Exception without any cause... I was trying to catch the exception with my custom Filter (LoggingFilter.java that you can see on the strack trace), using this code: try { filterChain.doFilter(servletRequest, servletResponse); } catch (Throwable e) { e.printStackTrace(); System.out.println("Stack trace:"); System.out.println(e.getStackTrace()); System.out.println("Cause:"); System.out.println(e.getCause()); } But it doesn't catch anything, the line 18 from the stack trace is this one: filterChain.doFilter(servletRequest, servletResponse); nothing gets caught by the try block. Anybody has any ideas about how could i get closer to the real cause?

    Read the article

  • Unable to call webservice from another webservice : NETBEANS

    - by PhoeniX
    ############## WEBSERVICE 1 (banking.java) package bank; import client.TestserviceService; import javax.jws.WebMethod; import javax.jws.WebService; import javax.xml.ws.WebServiceRef; @WebService() public class banking { @WebServiceRef(wsdlLocation = "WEB-INF/wsdl/localhost_23164/testwebservice/testserviceService.wsdl") private TestserviceService service; /** * Web service operation */ @WebMethod(operationName = "getBalance") public int getBalance() { //TODO write your implementation code here: int a=-1; try { // Call Web Service Operation client.Testservice port = service.getTestservicePort(); // TODO process result here java.lang.String result = port.getData(); a= Integer.parseInt(result); System.out.println("Result = "+result); } catch (Exception ex) { // TODO handle custom exceptions here } return a; } } ##################### WEB SERVICE 2 package test; import javax.jws.WebService; @WebService() public class testservice { public String getData() { return "3"; } } I am trying to call webservice refernce of webservice 2 from webservice 1 it can be seen in the code I am using netbeans ****************************************** ERROR I AM GETTING IS INFO: parsing WSDL... INFO: [ERROR] Premature end of file. INFO: line 1 of http://localhost:23164/learnwebservice/bankingService?WSDL WARNING: StandardWrapperValve[banking]: PWC1406: Servlet.service() for servlet banking threw exception javax.servlet.ServletException at org.glassfish.webservices.JAXWSServlet.doPost(JAXWSServlet.java:152) at javax.servlet.http.HttpServlet.service(HttpServlet.java:754) at javax.servlet.http.HttpServlet.service(HttpServlet.java:847) at org.apache.catalina.core.StandardWrapper.service(StandardWrapper.java:1523) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:279) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:188) at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:641) at com.sun.enterprise.web.WebPipeline.invoke(WebPipeline.java:97) at com.sun.enterprise.web.PESessionLockingStandardPipeline.invoke(PESessionLockingStandardPipeline.java:85) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:185) at org.apache.catalina.connector.CoyoteAdapter.doService(CoyoteAdapter.java:332) at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:233) at com.sun.enterprise.v3.services.impl.ContainerMapper.service(ContainerMapper.java:165) at com.sun.grizzly.http.ProcessorTask.invokeAdapter(ProcessorTask.java:791) at com.sun.grizzly.http.ProcessorTask.doProcess(ProcessorTask.java:693) at com.sun.grizzly.http.ProcessorTask.process(ProcessorTask.java:954) at com.sun.grizzly.http.DefaultProtocolFilter.execute(DefaultProtocolFilter.java:170) at com.sun.grizzly.DefaultProtocolChain.executeProtocolFilter(DefaultProtocolChain.java:135) at com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:102) at com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:88) at com.sun.grizzly.http.HttpProtocolChain.execute(HttpProtocolChain.java:76) at com.sun.grizzly.ProtocolChainContextTask.doCall(ProtocolChainContextTask.java:53) at com.sun.grizzly.SelectionKeyContextTask.call(SelectionKeyContextTask.java:57) at com.sun.grizzly.ContextTask.run(ContextTask.java:69) at com.sun.grizzly.util.AbstractThreadPool$Worker.doWork(AbstractThreadPool.java:330) at com.sun.grizzly.util.AbstractThreadPool$Worker.run(AbstractThreadPool.java:309) at java.lang.Thread.run(Thread.java:619) Caused by: javax.servlet.ServletException: Service not found at org.glassfish.webservices.JAXWSServlet.doPost(JAXWSServlet.java:149) ... 26 more WARNING: StandardWrapperValve[banking]: PWC1406: Servlet.service() for servlet banking threw exception javax.servlet.ServletException at org.glassfish.webservices.JAXWSServlet.doPost(JAXWSServlet.java:152) at javax.servlet.http.HttpServlet.service(HttpServlet.java:754) at javax.servlet.http.HttpServlet.service(HttpServlet.java:847) at org.apache.catalina.core.StandardWrapper.service(StandardWrapper.java:1523) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:279) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:188) at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:641) at com.sun.enterprise.web.WebPipeline.invoke(WebPipeline.java:97) at com.sun.enterprise.web.PESessionLockingStandardPipeline.invoke(PESessionLockingStandardPipeline.java:85) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:185) at org.apache.catalina.connector.CoyoteAdapter.doService(CoyoteAdapter.java:332) at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:233) at com.sun.enterprise.v3.services.impl.ContainerMapper.service(ContainerMapper.java:165) at com.sun.grizzly.http.ProcessorTask.invokeAdapter(ProcessorTask.java:791) at com.sun.grizzly.http.ProcessorTask.doProcess(ProcessorTask.java:693) at com.sun.grizzly.http.ProcessorTask.process(ProcessorTask.java:954) at com.sun.grizzly.http.DefaultProtocolFilter.execute(DefaultProtocolFilter.java:170) at com.sun.grizzly.DefaultProtocolChain.executeProtocolFilter(DefaultProtocolChain.java:135) at com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:102) at com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:88) at com.sun.grizzly.http.HttpProtocolChain.execute(HttpProtocolChain.java:76) at com.sun.grizzly.ProtocolChainContextTask.doCall(ProtocolChainContextTask.java:53) at com.sun.grizzly.SelectionKeyContextTask.call(SelectionKeyContextTask.java:57) at com.sun.grizzly.ContextTask.run(ContextTask.java:69) at com.sun.grizzly.util.AbstractThreadPool$Worker.doWork(AbstractThreadPool.java:330) at com.sun.grizzly.util.AbstractThreadPool$Worker.run(AbstractThreadPool.java:309) at java.lang.Thread.run(Thread.java:619) Caused by: javax.servlet.ServletException: Service not found at org.glassfish.webservices.JAXWSServlet.doPost(JAXWSServlet.java:149) ... 26 more WARNING: StandardWrapperValve[banking]: PWC1406: Servlet.service() for servlet banking threw exception javax.servlet.ServletException at org.glassfish.webservices.JAXWSServlet.doPost(JAXWSServlet.java:152) at javax.servlet.http.HttpServlet.service(HttpServlet.java:754) at javax.servlet.http.HttpServlet.service(HttpServlet.java:847) at org.apache.catalina.core.StandardWrapper.service(StandardWrapper.java:1523) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:279) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:188) at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:641) at com.sun.enterprise.web.WebPipeline.invoke(WebPipeline.java:97) at com.sun.enterprise.web.PESessionLockingStandardPipeline.invoke(PESessionLockingStandardPipeline.java:85) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:185) at org.apache.catalina.connector.CoyoteAdapter.doService(CoyoteAdapter.java:332) at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:233) at com.sun.enterprise.v3.services.impl.ContainerMapper.service(ContainerMapper.java:165) at com.sun.grizzly.http.ProcessorTask.invokeAdapter(ProcessorTask.java:791) at com.sun.grizzly.http.ProcessorTask.doProcess(ProcessorTask.java:693) at com.sun.grizzly.http.ProcessorTask.process(ProcessorTask.java:954) at com.sun.grizzly.http.DefaultProtocolFilter.execute(DefaultProtocolFilter.java:170) at com.sun.grizzly.DefaultProtocolChain.executeProtocolFilter(DefaultProtocolChain.java:135) at com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:102) at com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:88) at com.sun.grizzly.http.HttpProtocolChain.execute(HttpProtocolChain.java:76) at com.sun.grizzly.ProtocolChainContextTask.doCall(ProtocolChainContextTask.java:53) at com.sun.grizzly.SelectionKeyContextTask.call(SelectionKeyContextTask.java:57) at com.sun.grizzly.ContextTask.run(ContextTask.java:69) at com.sun.grizzly.util.AbstractThreadPool$Worker.doWork(AbstractThreadPool.java:330) at com.sun.grizzly.util.AbstractThreadPool$Worker.run(AbstractThreadPool.java:309) at java.lang.Thread.run(Thread.java:619) Caused by: javax.servlet.ServletException: Service not found at org.glassfish.webservices.JAXWSServlet.doPost(JAXWSServlet.java:149) ... 26 more WARNING: StandardWrapperValve[banking]: PWC1406: Servlet.service() for servlet banking threw exception javax.servlet.ServletException at org.glassfish.webservices.JAXWSServlet.doPost(JAXWSServlet.java:152) at javax.servlet.http.HttpServlet.service(HttpServlet.java:754) at javax.servlet.http.HttpServlet.service(HttpServlet.java:847) at org.apache.catalina.core.StandardWrapper.service(StandardWrapper.java:1523) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:279) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:188) at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:641) at com.sun.enterprise.web.WebPipeline.invoke(WebPipeline.java:97) at com.sun.enterprise.web.PESessionLockingStandardPipeline.invoke(PESessionLockingStandardPipeline.java:85) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:185) at org.apache.catalina.connector.CoyoteAdapter.doService(CoyoteAdapter.java:332) at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:233) at com.sun.enterprise.v3.services.impl.ContainerMapper.service(ContainerMapper.java:165) at com.sun.grizzly.http.ProcessorTask.invokeAdapter(ProcessorTask.java:791) at com.sun.grizzly.http.ProcessorTask.doProcess(ProcessorTask.java:693) at com.sun.grizzly.http.ProcessorTask.process(ProcessorTask.java:954) at com.sun.grizzly.http.DefaultProtocolFilter.execute(DefaultProtocolFilter.java:170) at com.sun.grizzly.DefaultProtocolChain.executeProtocolFilter(DefaultProtocolChain.java:135) at com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:102) at com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:88) at com.sun.grizzly.http.HttpProtocolChain.execute(HttpProtocolChain.java:76) at com.sun.grizzly.ProtocolChainContextTask.doCall(ProtocolChainContextTask.java:53) at com.sun.grizzly.SelectionKeyContextTask.call(SelectionKeyContextTask.java:57) at com.sun.grizzly.ContextTask.run(ContextTask.java:69) at com.sun.grizzly.util.AbstractThreadPool$Worker.doWork(AbstractThreadPool.java:330) at com.sun.grizzly.util.AbstractThreadPool$Worker.run(AbstractThreadPool.java:309) at java.lang.Thread.run(Thread.java:619) Caused by: javax.servlet.ServletException: Service not found at org.glassfish.webservices.JAXWSServlet.doPost(JAXWSServlet.java:149) ... 26 more INFO: [ERROR] Premature end of file. Failed to read the WSDL document: http//localhost:23164/learnwebservice/bankingService?WSDL, because 1) could not find the document; /2) the document could not be read; 3) the root element of the document is not . INFO: [ERROR] failed.noservice=Could not find wsdl:service in the provided WSDL(s): At least one WSDL with at least one service definition needs to be provided. INFO: Failed to parse the WSDL. INFO: Invoking wsimport with http//localhost:23164/learnwebservice/bankingService?WSDL SEVERE: wsimport failed INFO: parsing WSDL... INFO: [ERROR] Premature end of file. INFO: line 1 of http//localhost:23164/learnwebservice/bankingService?WSDL WARNING: StandardWrapperValve[banking]: PWC1406: Servlet.service() for servlet banking threw exception javax.servlet.ServletException at org.glassfish.webservices.JAXWSServlet.doPost(JAXWSServlet.java:152) at javax.servlet.http.HttpServlet.service(HttpServlet.java:754) at javax.servlet.http.HttpServlet.service(HttpServlet.java:847) at org.apache.catalina.core.StandardWrapper.service(StandardWrapper.java:1523) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:279) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:188) at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:641) at com.sun.enterprise.web.WebPipeline.invoke(WebPipeline.java:97) at com.sun.enterprise.web.PESessionLockingStandardPipeline.invoke(PESessionLockingStandardPipeline.java:85) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:185) at org.apache.catalina.connector.CoyoteAdapter.doService(CoyoteAdapter.java:332) at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:233) at com.sun.enterprise.v3.services.impl.ContainerMapper.service(ContainerMapper.java:165) at com.sun.grizzly.http.ProcessorTask.invokeAdapter(ProcessorTask.java:791) at com.sun.grizzly.http.ProcessorTask.doProcess(ProcessorTask.java:693) at com.sun.grizzly.http.ProcessorTask.process(ProcessorTask.java:954) at com.sun.grizzly.http.DefaultProtocolFilter.execute(DefaultProtocolFilter.java:170) at com.sun.grizzly.DefaultProtocolChain.executeProtocolFilter(DefaultProtocolChain.java:135) at com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:102) at com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:88) at com.sun.grizzly.http.HttpProtocolChain.execute(HttpProtocolChain.java:76) at com.sun.grizzly.ProtocolChainContextTask.doCall(ProtocolChainContextTask.java:53) at com.sun.grizzly.SelectionKeyContextTask.call(SelectionKeyContextTask.java:57) at com.sun.grizzly.ContextTask.run(ContextTask.java:69) at com.sun.grizzly.util.AbstractThreadPool$Worker.doWork(AbstractThreadPool.java:330) at com.sun.grizzly.util.AbstractThreadPool$Worker.run(AbstractThreadPool.java:309) at java.lang.Thread.run(Thread.java:619) Caused by: javax.servlet.ServletException: Service not found at org.glassfish.webservices.JAXWSServlet.doPost(JAXWSServlet.java:149) ... 26 more WARNING: StandardWrapperValve[banking]: PWC1406: Servlet.service() for servlet banking threw exception javax.servlet.ServletException at org.glassfish.webservices.JAXWSServlet.doPost(JAXWSServlet.java:152) at javax.servlet.http.HttpServlet.service(HttpServlet.java:754) at javax.servlet.http.HttpServlet.service(HttpServlet.java:847) at org.apache.catalina.core.StandardWrapper.service(StandardWrapper.java:1523) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:279) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:188) at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:641) at com.sun.enterprise.web.WebPipeline.invoke(WebPipeline.java:97) at com.sun.enterprise.web.PESessionLockingStandardPipeline.invoke(PESessionLockingStandardPipeline.java:85) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:185) at org.apache.catalina.connector.CoyoteAdapter.doService(CoyoteAdapter.java:332) at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:233) at com.sun.enterprise.v3.services.impl.ContainerMapper.service(ContainerMapper.java:165) at com.sun.grizzly.http.ProcessorTask.invokeAdapter(ProcessorTask.java:791) at com.sun.grizzly.http.ProcessorTask.doProcess(ProcessorTask.java:693) at com.sun.grizzly.http.ProcessorTask.process(ProcessorTask.java:954) at com.sun.grizzly.http.DefaultProtocolFilter.execute(DefaultProtocolFilter.java:170) at com.sun.grizzly.DefaultProtocolChain.executeProtocolFilter(DefaultProtocolChain.java:135) at com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:102) at com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:88) at com.sun.grizzly.http.HttpProtocolChain.execute(HttpProtocolChain.java:76) at com.sun.grizzly.ProtocolChainContextTask.doCall(ProtocolChainContextTask.java:53) at com.sun.grizzly.SelectionKeyContextTask.call(SelectionKeyContextTask.java:57) at com.sun.grizzly.ContextTask.run(ContextTask.java:69) at com.sun.grizzly.util.AbstractThreadPool$Worker.doWork(AbstractThreadPool.java:330) at com.sun.grizzly.util.AbstractThreadPool$Worker.run(AbstractThreadPool.java:309) at java.lang.Thread.run(Thread.java:619) Caused by: javax.servlet.ServletException: Service not found at org.glassfish.webservices.JAXWSServlet.doPost(JAXWSServlet.java:149) ... 26 more WARNING: StandardWrapperValve[banking]: PWC1406: Servlet.service() for servlet banking threw exception javax.servlet.ServletException at org.glassfish.webservices.JAXWSServlet.doPost(JAXWSServlet.java:152) at javax.servlet.http.HttpServlet.service(HttpServlet.java:754) at javax.servlet.http.HttpServlet.service(HttpServlet.java:847) at org.apache.catalina.core.StandardWrapper.service(StandardWrapper.java:1523) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:279) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:188) at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:641) at com.sun.enterprise.web.WebPipeline.invoke(WebPipeline.java:97) at com.sun.enterprise.web.PESessionLockingStandardPipeline.invoke(PESessionLockingStandardPipeline.java:85) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:185) at org.apache.catalina.connector.CoyoteAdapter.doService(CoyoteAdapter.java:332) at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:233) at com.sun.enterprise.v3.services.impl.ContainerMapper.service(ContainerMapper.java:165) at com.sun.grizzly.http.ProcessorTask.invokeAdapter(ProcessorTask.java:791) at com.sun.grizzly.http.ProcessorTask.doProcess(ProcessorTask.java:693) at com.sun.grizzly.http.ProcessorTask.process(ProcessorTask.java:954) at com.sun.grizzly.http.DefaultProtocolFilter.execute(DefaultProtocolFilter.java:170) at com.sun.grizzly.DefaultProtocolChain.executeProtocolFilter(DefaultProtocolChain.java:135) at com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:102) at com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:88) at com.sun.grizzly.http.HttpProtocolChain.execute(HttpProtocolChain.java:76) at com.sun.grizzly.ProtocolChainContextTask.doCall(ProtocolChainContextTask.java:53) at com.sun.grizzly.SelectionKeyContextTask.call(SelectionKeyContextTask.java:57) at com.sun.grizzly.ContextTask.run(ContextTask.java:69) at com.sun.grizzly.util.AbstractThreadPool$Worker.doWork(AbstractThreadPool.java:330) at com.sun.grizzly.util.AbstractThreadPool$Worker.run(AbstractThreadPool.java:309) at java.lang.Thread.run(Thread.java:619) Caused by: javax.servlet.ServletException: Service not found at org.glassfish.webservices.JAXWSServlet.doPost(JAXWSServlet.java:149) ... 26 more WARNING: StandardWrapperValve[banking]: PWC1406: Servlet.service() for servlet banking threw exception javax.servlet.ServletException at org.glassfish.webservices.JAXWSServlet.doPost(JAXWSServlet.java:152) at javax.servlet.http.HttpServlet.service(HttpServlet.java:754) at javax.servlet.http.HttpServlet.service(HttpServlet.java:847) at org.apache.catalina.core.StandardWrapper.service(StandardWrapper.java:1523) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:279) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:188) at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:641) at com.sun.enterprise.web.WebPipeline.invoke(WebPipeline.java:97) at com.sun.enterprise.web.PESessionLockingStandardPipeline.invoke(PESessionLockingStandardPipeline.java:85) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:185) at org.apache.catalina.connector.CoyoteAdapter.doService(CoyoteAdapter.java:332) at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:233) at com.sun.enterprise.v3.services.impl.ContainerMapper.service(ContainerMapper.java:165) at com.sun.grizzly.http.ProcessorTask.invokeAdapter(ProcessorTask.java:791) at com.sun.grizzly.http.ProcessorTask.doProcess(ProcessorTask.java:693) at com.sun.grizzly.http.ProcessorTask.process(ProcessorTask.java:954) at com.sun.grizzly.http.DefaultProtocolFilter.execute(DefaultProtocolFilter.java:170) at com.sun.grizzly.DefaultProtocolChain.executeProtocolFilter(DefaultProtocolChain.java:135) at com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:102) at com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:88) at com.sun.grizzly.http.HttpProtocolChain.execute(HttpProtocolChain.java:76) at com.sun.grizzly.ProtocolChainContextTask.doCall(ProtocolChainContextTask.java:53) at com.sun.grizzly.SelectionKeyContextTask.call(SelectionKeyContextTask.java:57) at com.sun.grizzly.ContextTask.run(ContextTask.java:69) at com.sun.grizzly.util.AbstractThreadPool$Worker.doWork(AbstractThreadPool.java:330) at com.sun.grizzly.util.AbstractThreadPool$Worker.run(AbstractThreadPool.java:309) at java.lang.Thread.run(Thread.java:619) Caused by: javax.servlet.ServletException: Service not found at org.glassfish.webservices.JAXWSServlet.doPost(JAXWSServlet.java:149) ... 26 more INFO: [ERROR] Premature end of file. Failed to read the WSDL document: http//localhost:23164/learnwebservice/bankingService?WSDL, because 1) could not find the document; /2) the document could not be read; 3) the root element of the document is not . INFO: [ERROR] failed.noservice=Could not find wsdl:service in the provided WSDL(s): At least one WSDL with at least one service definition needs to be provided. INFO: Failed to parse the WSDL. INFO: Invoking wsimport with http//localhost:23164/learnwebservice/bankingService?WSDL SEVERE: wsimport failed

    Read the article

  • Error with connection in my database servlet

    - by Zerobu
    Hello, I am writing a Database servlet, all seems well except that there seems to be an error in my connection import java.io.IOException; import java.sql.Connection; import java.sql.DriverManager; import java.sql.PreparedStatement; import java.sql.ResultSet; import java.sql.SQLException; import java.sql.Statement; import java.util.ArrayList; import javax.servlet.RequestDispatcher; import javax.servlet.ServletContext; import javax.servlet.ServletException; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; public class DBServlet3 extends HttpServlet { private static final long serialVersionUID = 1L; @Override public void init() throws ServletException { super.init(); try { String jdbcDriverClass= getServletContext().getInitParameter( "jdbcDriverClass" ); if (jdbcDriverClass == null) throw new ServletException( "Could not find jdbcDriverClass initialization parameter" ); Class.forName( jdbcDriverClass ); } catch (ClassNotFoundException e) { throw new ServletException( "Could not load JDBC driver class", e ); } } @Override protected void doGet( HttpServletRequest request, HttpServletResponse response ) throws ServletException, IOException { RequestDispatcher dispatcher= request.getRequestDispatcher( "/db.jsp" ); ServletContext application= getServletContext(); ArrayList<String> names= new ArrayList<String>(); try { Connection connection= null; Statement statement= null; ResultSet results= null; try { String jdbcUrl= application.getInitParameter( "jdbcUrl" ); String jdbcUser= application.getInitParameter( "jdbcUser" ); String jdbcPassword= application.getInitParameter( "jdbcPassword" ); connection= DriverManager.getConnection( jdbcUrl, jdbcUser, jdbcPassword ); statement= connection.createStatement(); results= statement.executeQuery( "SELECT * FROM students" ); while (results.next()) { String name= results.getString( "name" ); names.add( name ); } } finally { if (results != null) results.close(); if (statement != null) statement.close(); if (connection != null) connection.close(); } } catch (SQLException e) { throw new ServletException( e ); } request.setAttribute( "names", names ); dispatcher.forward( request, response ); } @Override protected void doPost( HttpServletRequest request, HttpServletResponse response ) throws ServletException, IOException { String sql= "INSERT INTO students VALUES (" + request.getParameter( "id" ) + ", '" + request.getParameter( "name" ) + "')"; sql= "INSERT INTO students VALUES (?, ?, ?, ?)"; PreparedStatement statement= connection.prepareStatement( sql ); //error on this line statement.setString( 1, request.getParameter( "id" ) ); statement.setString( 2, request.getParameter( "name" ) ); } }

    Read the article

  • Write this java source in Clojure

    - by tikky
    Need to write this code in clojure.... package com.example.testvaadin; import javax.servlet.ServletException; import javax.servlet.http.HttpServletRequest; import clojure.lang.RT; import com.vaadin.Application; import com.vaadin.terminal.gwt.server.AbstractApplicationServlet; public class Clojure4Vaadin extends AbstractApplicationServlet { @Override protected Class getApplicationClass()throws ClassNotFoundException { return Application.class; } @Override protected Application getNewApplication(HttpServletRequest request) throws ServletException { try { RT.load(getServletConfig().getInitParameter("script-name"), true); return (Application)RT.var(getServletConfig().getInitParameter("package-name"),getServletConfig().getInitParameter("function-name")).invoke(new String[0]); } catch (Exception e) { throw new ServletException(e); } } }

    Read the article

  • Sending XML to Servlet from Action Script

    - by John Doe
    I am only getting empty arrays on output. Anyone know what Exactly I'm doing wrong? package myDungeonAccessor; /* * To change this template, choose Tools | Templates * and open the template in the editor. */ import java.io.IOException; import java.io.ObjectInputStream; import java.io.ObjectOutputStream; import java.io.PrintWriter; import javax.servlet.ServletException; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; public class myDungeonAccessorServlet extends HttpServlet { private myDungeonAccessor dataAccessor; /** * Processes requests for both HTTP <code>GET</code> and <code>POST</code> methods. * @param request servlet request * @param response servlet response * @throws ServletException if a servlet-specific error occurs * @throws IOException if an I/O error occurs */ protected void processRequest(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { response.setContentType("text/html;charset=UTF-8"); PrintWriter out = response.getWriter(); try { /* TODO output your page here out.println("<html>"); out.println("<head>"); out.println("<title>Servlet myDungeonAccessorServlet</title>"); out.println("</head>"); out.println("<body>"); out.println("<h1>Servlet myDungeonAccessorServlet at " + request.getContextPath () + "</h1>"); out.println("</body>"); out.println("</html>"); */ } finally { 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 * @throws ServletException if a servlet-specific error occurs * @throws IOException if an I/O error occurs */ @Override protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { processRequest(request, response); // PrintWriter out = response.getWriter(); System.out.println("yo mom"); } /** * Handles the HTTP <code>POST</code> method. * @param request servlet request * @param response servlet response * @throws ServletException if a servlet-specific error occurs * @throws IOException if an I/O error occurs */ @Override protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { //System.out.println("heppo"); //dataAccessor = new myDungeonAccessor(); System.out.println("Hello"); try { System.out.println("HEADERS: " + request.getHeaderNames()); ObjectInputStream in = new ObjectInputStream(request.getInputStream()); ObjectOutputStream out = new ObjectOutputStream(response.getOutputStream()); } catch(Exception e) { e.printStackTrace(); } System.out.println("WAZZUP"); byte [] buffer = new byte[4096]; //in.read(buffer); System.out.println("TEST!"); String s = new String(buffer); System.out.println("Update S:" + s); } /** * Returns a short description of the servlet. * @return a String containing servlet description */ @Override public String getServletInfo() { return "Short description"; } }

    Read the article

  • Embedded Tomcat Cluster

    - by ThreaT
    Can someone please explain with an example how an Embedded Tomcat Cluster works. Would a load balancer be necessary? Since we're using embedded tomcat, how would two separate jar files (each a standalone web application with their own embedded tomcat instance) know where eachother are and let eachother know their status, etc? Here is the code I have so far which is just a regular embedded tomcat without any clustering: import javax.servlet.ServletException; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import java.io.File; import java.io.IOException; import java.io.Writer; public class Main { public static void main(String[] args) throws LifecycleException, InterruptedException, ServletException { Tomcat tomcat = new Tomcat(); tomcat.setPort(8080); Context ctx = tomcat.addContext("/", new File(".").getAbsolutePath()); Tomcat.addServlet(ctx, "hello", new HttpServlet() { protected void service(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { Writer w = resp.getWriter(); w.write("Hello, World!"); w.flush(); } }); ctx.addServletMapping("/*", "hello"); tomcat.start(); tomcat.getServer().await(); } } Source: java dzone

    Read the article

  • Scope of Connection Object for a Website using Connection Pooling (Local or Instance)

    - by Danny
    For a web application with connection polling enabled, is it better to work with a locally scoped connection object or instance scoped connection object. I know there is probably not a big performance improvement between the two (because of the pooling) but would you say that one follows a better pattern than the other. Thanks ;) public class MyServlet extends HttpServlet { DataSource ds; public void init() throws ServletException { ds = (DataSource) getServletContext().getAttribute("DBCPool"); } protected void doGet(HttpServletRequest arg0, HttpServletResponse arg1) throws ServletException, IOException { SomeWork("SELECT * FROM A"); SomeWork("SELECT * FROM B"); } void SomeWork(String sql) { Connection conn = null; try { conn = ds.getConnection(); // execute some sql ..... } finally { if(conn != null) { conn.close(); // return to pool } } } } Or public class MyServlet extends HttpServlet { DataSource ds; Connection conn;* public void init() throws ServletException { ds = (DataSource) getServletContext().getAttribute("DBCPool"); } protected void doGet(HttpServletRequest arg0, HttpServletResponse arg1) throws ServletException, IOException { try { conn = ds.getConnection(); SomeWork("SELECT * FROM A"); SomeWork("SELECT * FROM B"); } finally { if(conn != null) { conn.close(); // return to pool } } } void SomeWork(String sql) { // execute some sql ..... } }

    Read the article

  • How to write this kind of java source in clojure. [closed]

    - by tikky
    I want to know how to write a clojure code by looking at a java code like this. import xxxxxx import com.vaadin.terminal.gwt.server.AbstractApplicationServlet; public class Clojure4Vaadin extends AbstractApplicationServlet { @Override protected Class <? extends Application > getApplicationClass() throws ClassNotFoundException { return Application.class; } @Override protected Application getNewApplication(HttpServletRequest request) throws ServletException { try { RT.load(getServletConfig().getInitParameter("script-name"), true); //run Lisp function return (Application)RT.var(getServletConfig().getInitParameter("package-name"),getServletConfig().getInitParameter("function-name")).invoke(new String[0]); } catch (Exception e) { throw new ServletException(e); } } } I need to write a code clojure code which can do the sane thing that this java code can do.

    Read the article

  • Why is this simple file upload not working? JSF

    - by Nitesh Panchal
    Hello, Why is this code not working? I always get size() = 0, whenever i upload file. xhtml file :- <?xml version='1.0' encoding='UTF-8' ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xmlns:h="http://java.sun.com/jsf/html"> <h:head> <title>Abc</title> </h:head> <h:body> <center> <form method="post" enctype="multipart/form-data" id="form" action="/upload/uploadFile"> <input type="file"/> <br/> <input type="Submit" value="upload"/> </form> </center> </h:body> </html> This is my servlet :- package servlets; import java.io.IOException; import java.util.List; import java.util.logging.Level; import java.util.logging.Logger; import javax.servlet.ServletException; import javax.servlet.annotation.WebServlet; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import org.apache.commons.fileupload.FileItem; import org.apache.commons.fileupload.FileUploadException; import org.apache.commons.fileupload.disk.DiskFileItemFactory; import org.apache.commons.fileupload.servlet.ServletFileUpload; @WebServlet(name="uploadFile", urlPatterns={"/uploadFile"}) public class uploadFile extends HttpServlet { protected void processRequest(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException, FileUploadException { System.out.println("executed!"); List<FileItem> items = new ServletFileUpload(new DiskFileItemFactory()).parseRequest(request); System.out.println(items.size()); for (FileItem item : items) { if (!item.isFormField()) { System.out.println("Name: " + item.getName()); System.out.println("Size: " + item.getSize()); System.out.println("Type: " + item.getContentType()); } } } @Override protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { try { processRequest(request, response); } catch (FileUploadException ex) { ex.printStackTrace(); } } @Override protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { try { processRequest(request, response); } catch (FileUploadException ex) { ex.printStackTrace(); } } @Override public String getServletInfo() { return "Short description"; } }

    Read the article

  • Java EE 6 and NoSQL/MongoDB on GlassFish using JPA and EclipseLink 2.4 (TOTD #175)

    - by arungupta
    TOTD #166 explained how to use MongoDB in your Java EE 6 applications. The code in that tip used the APIs exposed by the MongoDB Java driver and so requires you to learn a new API. However if you are building Java EE 6 applications then you are already familiar with Java Persistence API (JPA). Eclipse Link 2.4, scheduled to release as part of Eclipse Juno, provides support for NoSQL databases by mapping a JPA entity to a document. Their wiki provides complete explanation of how the mapping is done. This Tip Of The Day (TOTD) will show how you can leverage that support in your Java EE 6 applications deployed on GlassFish 3.1.2. Before we dig into the code, here are the key concepts ... A POJO is mapped to a NoSQL data source using @NoSQL or <no-sql> element in "persistence.xml". A subset of JPQL and Criteria query are supported, based upon the underlying data store Connection properties are defined in "persistence.xml" Now, lets lets take a look at the code ... Download the latest EclipseLink 2.4 Nightly Bundle. There is a Installer, Source, and Bundle - make sure to download the Bundle link (20120410) and unzip. Download GlassFish 3.1.2 zip and unzip. Install the Eclipse Link 2.4 JARs in GlassFish Remove the following JARs from "glassfish/modules": org.eclipse.persistence.antlr.jar org.eclipse.persistence.asm.jar org.eclipse.persistence.core.jar org.eclipse.persistence.jpa.jar org.eclipse.persistence.jpa.modelgen.jar org.eclipse.persistence.moxy.jar org.eclipse.persistence.oracle.jar Add the following JARs from Eclipse Link 2.4 nightly build to "glassfish/modules": org.eclipse.persistence.antlr_3.2.0.v201107111232.jar org.eclipse.persistence.asm_3.3.1.v201107111215.jar org.eclipse.persistence.core.jpql_2.4.0.v20120407-r11132.jar org.eclipse.persistence.core_2.4.0.v20120407-r11132.jar org.eclipse.persistence.jpa.jpql_2.0.0.v20120407-r11132.jar org.eclipse.persistence.jpa.modelgen_2.4.0.v20120407-r11132.jar org.eclipse.persistence.jpa_2.4.0.v20120407-r11132.jar org.eclipse.persistence.moxy_2.4.0.v20120407-r11132.jar org.eclipse.persistence.nosql_2.4.0.v20120407-r11132.jar org.eclipse.persistence.oracle_2.4.0.v20120407-r11132.jar Start MongoDB Download latest MongoDB from here (2.0.4 as of this writing). Create the default data directory for MongoDB as: sudo mkdir -p /data/db/sudo chown `id -u` /data/db Refer to Quickstart for more details. Start MongoDB as: arungup-mac:mongodb-osx-x86_64-2.0.4 <arungup> ->./bin/mongod./bin/mongod --help for help and startup optionsMon Apr  9 12:56:02 [initandlisten] MongoDB starting : pid=3124 port=27017 dbpath=/data/db/ 64-bit host=arungup-mac.localMon Apr  9 12:56:02 [initandlisten] db version v2.0.4, pdfile version 4.5Mon Apr  9 12:56:02 [initandlisten] git version: 329f3c47fe8136c03392c8f0e548506cb21f8ebfMon Apr  9 12:56:02 [initandlisten] build info: Darwin erh2.10gen.cc 9.8.0 Darwin Kernel Version 9.8.0: Wed Jul 15 16:55:01 PDT 2009; root:xnu-1228.15.4~1/RELEASE_I386 i386 BOOST_LIB_VERSION=1_40Mon Apr  9 12:56:02 [initandlisten] options: {}Mon Apr  9 12:56:02 [initandlisten] journal dir=/data/db/journalMon Apr  9 12:56:02 [initandlisten] recover : no journal files present, no recovery neededMon Apr  9 12:56:02 [websvr] admin web console waiting for connections on port 28017Mon Apr  9 12:56:02 [initandlisten] waiting for connections on port 27017 Check out the JPA/NoSQL sample from SVN repository. The complete source code built in this TOTD can be downloaded here. Create Java EE 6 web app Create a Java EE 6 Maven web app as: mvn archetype:generate -DarchetypeGroupId=org.codehaus.mojo.archetypes -DarchetypeArtifactId=webapp-javaee6 -DgroupId=model -DartifactId=javaee-nosql -DarchetypeVersion=1.5 -DinteractiveMode=false Copy the model files from the checked out workspace to the generated project as: cd javaee-nosqlcp -r ~/code/workspaces/org.eclipse.persistence.example.jpa.nosql.mongo/src/model src/main/java Copy "persistence.xml" mkdir src/main/resources cp -r ~/code/workspaces/org.eclipse.persistence.example.jpa.nosql.mongo/src/META-INF ./src/main/resources Add the following dependencies: <dependency> <groupId>org.eclipse.persistence</groupId> <artifactId>org.eclipse.persistence.jpa</artifactId> <version>2.4.0-SNAPSHOT</version> <scope>provided</scope></dependency><dependency> <groupId>org.eclipse.persistence</groupId> <artifactId>org.eclipse.persistence.nosql</artifactId> <version>2.4.0-SNAPSHOT</version></dependency><dependency> <groupId>org.mongodb</groupId> <artifactId>mongo-java-driver</artifactId> <version>2.7.3</version></dependency> The first one is for the EclipseLink latest APIs, the second one is for EclipseLink/NoSQL support, and the last one is the MongoDB Java driver. And the following repository: <repositories> <repository> <id>EclipseLink Repo</id> <url>http://www.eclipse.org/downloads/download.php?r=1&amp;nf=1&amp;file=/rt/eclipselink/maven.repo</url> <snapshots> <enabled>true</enabled> </snapshots> </repository>  </repositories> Copy the "Test.java" to the generated project: mkdir src/main/java/examplecp -r ~/code/workspaces/org.eclipse.persistence.example.jpa.nosql.mongo/src/example/Test.java ./src/main/java/example/ This file contains the source code to CRUD the JPA entity to MongoDB. This sample is explained in detail on EclipseLink wiki. Create a new Servlet in "example" directory as: package example;import java.io.IOException;import java.io.PrintWriter;import javax.servlet.ServletException;import javax.servlet.annotation.WebServlet;import javax.servlet.http.HttpServlet;import javax.servlet.http.HttpServletRequest;import javax.servlet.http.HttpServletResponse;/** * @author Arun Gupta */@WebServlet(name = "TestServlet", urlPatterns = {"/TestServlet"})public class TestServlet extends HttpServlet { 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 TestServlet</title>"); out.println("</head>"); out.println("<body>"); out.println("<h1>Servlet TestServlet at " + request.getContextPath() + "</h1>"); try { Test.main(null); } catch (Exception ex) { ex.printStackTrace(); } 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); }} Build the project and deploy it as: mvn clean packageglassfish3/bin/asadmin deploy --force=true target/javaee-nosql-1.0-SNAPSHOT.war Accessing http://localhost:8080/javaee-nosql/TestServlet shows the following messages in the server.log: connecting(EISLogin( platform=> MongoPlatform user name=> "" MongoConnectionSpec())) . . .Connected: User: Database: 2.7  Version: 2.7 . . .Executing MappedInteraction() spec => null properties => {mongo.collection=CUSTOMER, mongo.operation=INSERT} input => [DatabaseRecord( CUSTOMER._id => 4F848E2BDA0670307E2A8FA4 CUSTOMER.NAME => AMCE)]. . .Data access result: [{TOTALCOST=757.0, ORDERLINES=[{DESCRIPTION=table, LINENUMBER=1, COST=300.0}, {DESCRIPTION=balls, LINENUMBER=2, COST=5.0}, {DESCRIPTION=rackets, LINENUMBER=3, COST=15.0}, {DESCRIPTION=net, LINENUMBER=4, COST=2.0}, {DESCRIPTION=shipping, LINENUMBER=5, COST=80.0}, {DESCRIPTION=handling, LINENUMBER=6, COST=55.0},{DESCRIPTION=tax, LINENUMBER=7, COST=300.0}], SHIPPINGADDRESS=[{POSTALCODE=L5J1H7, PROVINCE=ON, COUNTRY=Canada, CITY=Ottawa,STREET=17 Jane St.}], VERSION=2, _id=4F848E2BDA0670307E2A8FA8,DESCRIPTION=Pingpong table, CUSTOMER__id=4F848E2BDA0670307E2A8FA7, BILLINGADDRESS=[{POSTALCODE=L5J1H8, PROVINCE=ON, COUNTRY=Canada, CITY=Ottawa, STREET=7 Bank St.}]}] You'll not see any output in the browser, just the output in the console. But the code can be easily modified to do so. Once again, the complete Maven project can be downloaded here. Do you want to try accessing relational and non-relational (aka NoSQL) databases in the same PU ?

    Read the article

  • How to use GWT when downloading Files with a Servlet?

    - by molleman
    Hello Guys I am creating a simple project that will allow me to upload and download files using gwt. i am having trouble with the downloading of files that are on my server. For the file upload i used http://code.google.com/p/gwtupload/ and followed the instructions there. My file is stored on the server outside of the website container(on the hard drive), Now when it comes to the downloading of a file, i want a user to press a download button and whatever item is currently selected will download. i dont really know how this will be done i know i need a download servlet public class DownloadAttachmentServlet extends HttpServlet { @Override protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { // TODO Auto-generated method stub super.doGet(req, resp); } @Override protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { String fileName = (String) req.getSession().getAttribute("fileName"); YFUser user = (YFUser) req.getSession().getAttribute(TestServiceImpl.SESSION_USER); if (user == null) throw new ServletException("Invalid Session"); InputStream in = null; OutputStream out = resp.getOutputStream(); FileInputStream fIn = new FileInputStream(fileName); byte[] buffer = new byte[4096]; int length; while ((length = in.read(buffer)) > 0){ out.write(buffer, 0, length); } in.close(); out.flush(); } } for the moment i will just pass a fileName string to retrieve the file for testing now i am lost at what to do on the client side, i have a simple public class DownloadFilePanel extends Composite { public DownloadFilePanel(final YFUser user , final String fileName){ final Element downloadIframe = RootPanel.get("__download").getElement(); VerticalPanel content = new VerticalPanel(); content.add(new Label("Download For this File : " + fileName)); Button button = new Button("Download"); button.addClickHandler(new ClickHandler(){ @Override public void onClick(ClickEvent event) { // i do not know what to do here }); content.add(button); initWidget(content); } } above is a simple widget that will supply a panel that will allow for the download of a file based on a fileName as you can see above, i do not know what to do to be able to download the file is there any one that can point me in the right direction?

    Read the article

  • How to use EJB 3.1 DI in Servlet ? (Could not inject session bean by @EJB from web application)

    - by kislo_metal
    I am tying to merging web application(gwt, jpa) to an separate 2 application(business login in ejb/jpa and web client in gwt). Currently i can`t inject my beans from web application (simple servlet) I am using glassfish v3. module limbo(ejb jar) is in dependency of module lust (war). If I use lust with compiler output of limbo everything work perfect (if ejb in web application and the are deploying together as one application). Have I messed some container configuration ? Here is my steps: I have some limbo.jar (ejb-jar) deployed to ejb container. I do not use any ejb-jar.xml, only annotations. package ua.co.inferno.limbo.persistence.beans; import javax.ejb.Remote; @Remote public interface IPersistentServiceRemote { ArrayList<String> getTerminalACPList(); ArrayList<String> getBoxACPList(); ArrayList<String> getCNPList(); ArrayList<String> getCNSList(); String getProductNamebyID(int boxid); ArrayList<String> getRegionsList(String lang); long getSequence(); void persistEntity (Object ent); } package ua.co.inferno.limbo.persistence.beans; import ua.co.inferno.limbo.persistence.entitis.EsetChSchemaEntity; import ua.co.inferno.limbo.persistence.entitis.EsetKeyActionsEntity; @Local public interface IPersistentService { ArrayList<String> getTerminalACPList(); ArrayList<String> getBoxACPList(); ArrayList<String> getCNPList(); ArrayList<String> getCNSList(); String getProductNamebyID(int boxid); ArrayList<String> getRegionsList(String lang); long getSequence(); long persistPurchaseBox(EsetRegPurchaserEntity rp); void removePurchaseTempBox(EsetRegPurchaserTempEntity rpt); EsetRegionsEntity getRegionsById(long rid); void persistEntity (Object ent); } package ua.co.inferno.limbo.persistence.beans; import ua.co.inferno.limbo.persistence.entitis.EsetChSchemaEntity; import ua.co.inferno.limbo.persistence.entitis.EsetKeyActionsEntity; import ua.co.inferno.limbo.persistence.entitis.EsetRegBoxesEntity; import javax.ejb.Stateless; import javax.persistence.EntityManager; import javax.persistence.PersistenceContext; @Stateless(name = "PersistentService") public class PersistentServiceEJB implements IPersistentService, IPersistentServiceRemote{ @PersistenceContext(unitName = "Limbo") EntityManager em; public PersistentServiceEJB() { } ......... } Than i trying to use PersistentService session bean(included in limbo.jar) from web application in lust.war (the limbo.jar & lust.war is not in ear) package ua.co.lust; import ua.co.inferno.limbo.persistence.beans.IPersistentService; import javax.ejb.EJB; import javax.servlet.ServletException; import javax.servlet.annotation.WebServlet; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import java.io.IOException; @WebServlet(name = "ServletTest", urlPatterns = {"/"}) public class ServletTest extends HttpServlet { protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { service(request, response); } protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { service(request, response); } @EJB private IPersistentService pService; public void service(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { String hi = pService.getCNPList().toString(); System.out.println("testBean.hello method returned: " + hi); System.out.println("In MyServlet::init()"); System.out.println("all regions" + pService.getRegionsList("ua")); System.out.println("all regions" + pService.getBoxACPList()); } } web.xm <?xml version="1.0" encoding="UTF-8"?> <web-app xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd" version="3.0"> <servlet> <servlet-name>ServletTest</servlet-name> <servlet-class>ua.co.lust.ServletTest</servlet-class> </servlet> </web-app> When servelt is loading i ge 404 eror (The requested resource () is not available.) And errors in logs : global Log Level SEVERE Logger global Name-Value Pairs {_ThreadName=Thread-1, _ThreadID=31} Record Number 1421 Message ID Complete Message Class [ Lua/co/inferno/limbo/persistence/beans/IPersistentService; ] not found. Error while loading [ class ua.co.lust.ServletTest ] javax.enterprise.system.tools.deployment.org.glassfish.deployment.common Log Level WARNING Logger javax.enterprise.system.tools.deployment.org.glassfish.deployment.common Name-Value Pairs {_ThreadName=Thread-1, _ThreadID=31} Record Number 1422 Message ID Error in annotation processing Complete Message java.lang.NoClassDefFoundError: Lua/co/inferno/limbo/persistence/beans/IPersistentService; ejb jar was deployed with this info log : Log Level INFO Logger javax.enterprise.system.container.ejb.com.sun.ejb.containers Name-Value Pairs {_ThreadName=Thread-1, _ThreadID=26} Record Number 1436 Message ID Glassfish-specific (Non-portable) JNDI names for EJB PersistentService Complete Message [ua.co.inferno.limbo.persistence.beans.IPersistentServiceRemote#ua.co.inferno.limbo.persistence.beans.IPersistentServiceRemote, ua.co.inferno.limbo.persistence.beans.IPersistentServiceRemote] Log Level INFO Logger javax.enterprise.system.tools.admin.org.glassfish.deployment.admin Name-Value Pairs {_ThreadName=Thread-1, _ThreadID=26} Record Number 1445 Message ID Complete Message limbo was successfully deployed in 610 milliseconds. Do i nee to add some additional configuration in a case of injections from others application? Some ideas?

    Read the article

  • How to get the action from the HttpServlet request to dispatch to multiple pages

    - by JFB
    I am using the Page Controller pattern. How could I use the same controller for two different pages by detecting the request action and then dispatching according to the result? Here is my code: account.jsp <form name="input" action="<%=request.getContextPath() %>/edit" method="get"> <input type="submit" value="Modifier" /> </form> Account Servlet public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { System.out.println("received HTTP GET"); String action = request.getParameter("action"); if (action == null) { // the account page dispatch(request, response, "/account"); } else if (action == "/edit") { // the popup edit page dispatch(request, response, "/edit"); } protected void dispatch(HttpServletRequest request, HttpServletResponse response, String page) throws javax.servlet.ServletException, java.io.IOException { RequestDispatcher dispatcher = getServletContext() .getRequestDispatcher(page); dispatcher.forward(request, response); } }

    Read the article

  • WebLogic Server internal server error [migrated]

    - by Abhinav Pandey
    When I deployed a project in Apache Tomcat 6.0 it is working fine. When I deployed a same project in WebLogic Server 10.3 it's showing an error: Error 500--Internal Server Error javax.servlet.ServletException: [HTTP:101249][weblogic.servlet.internal.WebAppServletContext@ae43b8 - appName: '_appsdir_ab_dir', name: 'ab', context-path: '/ab', spec-version: 'null']: Servlet class FirstServlet for servlet FirstServlet could not be loaded because the requested class was not found in the classpath . java.lang.UnsupportedClassVersionError: FirstServlet : Unsupported major.minor version 51.0.

    Read the article

  • Why Java servlet can't get Paypal IPN messages everytime ?

    - by Frank
    I have a Java servlet running on my notebook with Windows Vista, I set up a static IP, did port forwarding and registered for a free DDNS service, now my servlet is running, I gave the url to Paypal to send me IPN messages, I went on to it's sandbox site got to the test tools page, tried to send test messages by clicking the "Send IPN" button, most of the time it would fail, the error is : "IPN delivery failed. Unable to connect to the specified URL. Please verify the URL and try again." But maybe 1 in 10 times, it might be successful and my servlet would get the message, and I looked at the messages I got, they are in correct format. So I called Paypal asking why, he said I shouldn't run the servlet on my notebook, in stead I should run it on the web server, but I told him my ISP doesn't support Java on their server, and since I did all the above steps, shouldn't it be the same to run the servlet on my notebook ? He said his test showed he couldn't get to my servlet, but I asked why maybe 1 in 10 times it could get through ? If there is something wrong with running it on my notebook, then 100% times it should fail, am I correct on this point ? But anyway he said that's all he could do, and I should troubleshoot it myself. The servlet looks like this : import java.io.*; import java.net.*; import javax.servlet.*; import javax.servlet.http.*; import java.util.*; public class PayPal_Servlet extends HttpServlet { static boolean Debug=true; static String PayPal_Url="https://www.paypal.com/cgi-bin/webscr",Sandbox_Url="https://www.sandbox.paypal.com/cgi-bin/webscr", Dir_License_Messages="C:/Dir_License_Messages/"; static TransparencyExample Transparency_Example; static PayPal_Message_To_License_File_Worker PayPal_message_to_license_file_worker; // Initializes the servlet. public void init(ServletConfig config) throws ServletException { super.init(config); if (!new File(Dir_License_Messages).exists()) new File(Dir_License_Messages).mkdirs(); System.gc(); } /** 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 { // Read post from PayPal system and add 'cmd' Enumeration en=request.getParameterNames(); String str="cmd=_notify-validate"; while (en.hasMoreElements()) { String paramName=(String)en.nextElement(); String paramValue=request.getParameter(paramName); str=str+"&"+paramName+"="+URLEncoder.encode(paramValue); } // Post back to PayPal system to validate // NOTE: change http: to https: in the following URL to verify using SSL (for increased security). // using HTTPS requires either Java 1.4 or greater, or Java Secure Socket Extension (JSSE) and configured for older versions. URL u=new URL(Debug?Sandbox_Url:PayPal_Url); URLConnection uc=u.openConnection(); uc.setDoOutput(true); uc.setRequestProperty("Content-Type","application/x-www-form-urlencoded"); PrintWriter pw=new PrintWriter(uc.getOutputStream()); pw.println(str); pw.close(); BufferedReader in=new BufferedReader(new InputStreamReader(uc.getInputStream())); String res=in.readLine(); in.close(); // Assign posted variables to local variables String itemName=request.getParameter("item_name"); String itemNumber=request.getParameter("item_number"); String paymentStatus=request.getParameter("payment_status"); String paymentAmount=request.getParameter("mc_gross"); String paymentCurrency=request.getParameter("mc_currency"); String txnId=request.getParameter("txn_id"); String receiverEmail=request.getParameter("receiver_email"); String payerEmail=request.getParameter("payer_email"); if (res.equals("VERIFIED")) // Check notification validation { // check that paymentStatus=Completed // check that txnId has not been previously processed // check that receiverEmail is your Primary PayPal email // check that paymentAmount/paymentCurrency are correct // process payment } else if (res.equals("INVALID")) // Log for investigation { } else // Log for error { } // =========================================================================== if (txnId!=null) { Write_File_Safe_Fast(Dir_License_Messages+txnId+".txt",new StringBuffer(str.replace("&","\n")),false); } // =========================================================================== String Message_File_List[]=Tool_Lib.Get_File_List_From_Dir(Dir_License_Messages); response.setContentType("text/html"); PrintWriter out=response.getWriter(); String title="Reading All Request Parameters",Name="",Value; out.println("<Html><Head><Title>"+title+"</Title></Head>\n<Body Bgcolor=\"#FDF5E6\">\n<H1 Align=Center>"+title+"</H1>\n"+ "<Table Border=1 Align=Center>\n"+"<Tr Bgcolor=\"#FFAD00\"><Th>Parameter Name</Th><Th>Parameter Value(s) Messages = "+Message_File_List.length+"</Th></Tr>"); Enumeration paramNames=request.getParameterNames(); while(paramNames.hasMoreElements()) { String paramName=(String)paramNames.nextElement(); out.print("<Tr><Td>"+paramName+"</Td><Td>"); String[] paramValues=request.getParameterValues(paramName); if (paramValues.length == 1) { String paramValue=paramValues[0]; if (paramValue.length() == 0) out.print("<I>No Value</I>"); else { out.println(paramValue+"</Td></Tr>"); // Out("paramName = "+paramName+" paramValue = "+paramValue); // if (paramName.startsWith("Name")) Name=paramValue; // else if (paramName.startsWith("Value")) Write_File_Safe_Fast("C:/Dir_Data/"+Name,new StringBuffer(paramValue),false); } } else { out.println("<Ul>"); for (int i=0;i<paramValues.length;i++) out.println("<Li>"+paramValues[i]); out.println("</Ul></Td</Tr>"); } } out.println("</Table>\n</Body></Html>"); } /** 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"; } // Destroys the servlet. public void destroy() { System.gc(); } public static void Write_File_Safe_Fast(String File_Path,StringBuffer Str_Buf,boolean Append) { FileOutputStream fos=null; BufferedOutputStream bos=null; try { fos=new FileOutputStream(File_Path,Append); bos=new BufferedOutputStream(fos); for (int j=0;j<Str_Buf.length();j++) bos.write(Str_Buf.charAt(j)); } catch (Exception e) { e.printStackTrace(); } finally { try { if (bos!=null) { bos.close(); bos=null; } if (fos!=null) { fos.close(); fos=null; } } catch (Exception ex) { ex.printStackTrace(); } } System.gc(); } } I use Netbean6.7 to develop the servlet, and the code was from Paypal's JSP sample code, what can I do to debug the problem ?

    Read the article

  • HTTP status 405 - HTTP method POST is not supported by this URL

    - by Wont Say
    I am getting this "HTTP method POST is not supported by this URL" error when I run my project. The funny thing is, it was running perfectly fine two days ago. After I made a few changes to my code but then restored my original code and its giving me this error. Could you please help me? Here is my index.html: <form method="post" action="login.do"> <div> <table> <tr><td>Username: </td><td><input type="text" name="e_name"/> </td> </tr> <tr><td> Password: </td><td><input type="password" name="e_pass"/> </td> </tr> <tr><td></td><td><input type="submit" name ="e_submit" value="Submit"/> Here is my Login servlet: public class Login extends HttpServlet { /** * Processes requests for both HTTP * <code>GET</code> and * <code>POST</code> methods. * * @param request servlet request * @param response servlet response * @throws ServletException if a servlet-specific error occurs * @throws IOException if an I/O error occurs */ protected void processRequest(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException, SQLException { response.setContentType("text/html;charset=UTF-8"); PrintWriter out = response.getWriter(); try { /* * TODO output your page here. You may use following sample code. */ int status; String submit = request.getParameter("e_submit"); String submit2 = request.getParameter("a_submit"); out.println("Here1"); String e_name = request.getParameter("e_name"); String e_password = request.getParameter("e_pass"); String a_name = request.getParameter("a_name"); String a_password = request.getParameter("a_pass"); out.println(e_name+e_password+a_name+a_password); Author author = new Author(a_name,a_password); Editor editor = new Editor(e_name,e_password); // If it is an AUTHOR login: if(submit==null){ status = author.login(author); out.println("Author Login"); //Incorrect login details if(status==0) { out.println("Incorrect"); RequestDispatcher view = request.getRequestDispatcher("index_F.html"); view.forward(request, response); } //Correct login details --- AUTHOR else { out.println("Correct login details"); HttpSession session = request.getSession(); session.setAttribute(a_name, "a_name"); RequestDispatcher view = request.getRequestDispatcher("index_S.jsp"); view.forward(request, response); } } //If it is an EDITOR login else if (submit2==null){ status = editor.login(editor); //Incorrect login details if(status==0) { RequestDispatcher view = request.getRequestDispatcher("index_F.html"); view.forward(request, response); } //Correct login details --- EDITOR else { out.println("correct"); HttpSession session = request.getSession(); session.setAttribute(e_name, "e_name"); session.setAttribute(e_password, "e_pass"); RequestDispatcher view = request.getRequestDispatcher("index_S_1.html"); view.forward(request, response); } } out.println("</body>"); out.println("</html>"); } finally { out.close(); } } @Override protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { super.doPost(req, resp); } @Override protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { super.doGet(req, resp); }} And my web.xml looks like this: <?xml version="1.0" encoding="UTF-8"?> <servlet> <servlet-name>action</servlet-name> <servlet-class>org.apache.struts.action.ActionServlet</servlet-class> <init-param> <param-name>config</param-name> <param-value>/WEB-INF/struts-config.xml</param-value> </init-param> <init-param> <param-name>debug</param-name> <param-value>2</param-value> </init-param> <init-param> <param-name>detail</param-name> <param-value>2</param-value> </init-param> <load-on-startup>2</load-on-startup> </servlet> <servlet> <servlet-name>Login</servlet-name> <servlet-class>controller.Login</servlet-class> </servlet> <servlet-mapping> <servlet-name>action</servlet-name> <url-pattern>*.do</url-pattern> </servlet-mapping> <servlet-mapping> <servlet-name>Login</servlet-name> <url-pattern>/login.do</url-pattern> </servlet-mapping> <session-config> <session-timeout> 30 </session-timeout> </session-config> <welcome-file-list> <welcome-file>index.html</welcome-file> </welcome-file-list> I use Glassfish v3 server - let me know anything else you need to know

    Read the article

  • Generate JFreeChart in servlet

    - by San4o
    I'm trying to generate graphs using JFreeChart. I added record in web.xml, installed jfreechart library. Compiled servlet. Below code of servlet has shown: import java.io.IOException; import java.io.OutputStream; import java.io.File; import javax.servlet.*; import javax.servlet.http.*; import java.awt.Color; import org.jfree.chart.ChartFactory; import org.jfree.chart.ChartUtilities; import org.jfree.chart.JFreeChart; import org.jfree.data.general.DefaultPieDataset; public class diagram extends HttpServlet { public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { doTestPieChart(request,response); } protected void doTestPieChart(HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException { OutputStream out = response.getOutputStream(); try { DefaultPieDataset dataset = new DefaultPieDataset(); dataset.setValue("Graphic Novels", 192); dataset.setValue("History", 125); dataset.setValue("Military Fiction", 236); dataset.setValue("Mystery", 547); dataset.setValue("Performing Arts", 210); dataset.setValue("Science, Non-Fiction", 70); dataset.setValue("Science Fiction", 989); JFreeChart chart = ChartFactory.createPieChart( "Books by Type", dataset, true, false, false ); chart.setBackgroundPaint(Color.white); response.setContentType("image/png"); ChartUtilities.writeChartAsPNG(out, chart, 400, 300); /* ServletContext sc = getServletContext(); String filename = sc.getRealPath("pie.png"); File file = new File(filename); ChartUtilities.saveChartAsPNG(file,chart,400,300); */ } catch (Exception e) { System.out.println(e.toString()); } finally { out.close(); } } } When i launch the servlet, mistake has shown : HTTP Status 500 - type Exception report message description The server encountered an internal error () that prevented it from fulfilling this request. exception javax.servlet.ServletException: Error instantiating servlet class diagram org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102) org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:298) org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:852) org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:588) org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489) java.lang.Thread.run(Thread.java:619) root cause java.lang.NoClassDefFoundError: org/jfree/data/general/PieDataset java.lang.Class.getDeclaredConstructors0(Native Method) java.lang.Class.privateGetDeclaredConstructors(Class.java:2389) java.lang.Class.getConstructor0(Class.java:2699) java.lang.Class.newInstance0(Class.java:326) java.lang.Class.newInstance(Class.java:308) org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102) org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:298) org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:852) org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:588) org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489) java.lang.Thread.run(Thread.java:619) root cause java.lang.ClassNotFoundException: org.jfree.data.general.PieDataset org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1484) org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1329) java.lang.ClassLoader.loadClassInternal(ClassLoader.java:316) java.lang.Class.getDeclaredConstructors0(Native Method) java.lang.Class.privateGetDeclaredConstructors(Class.java:2389) java.lang.Class.getConstructor0(Class.java:2699) java.lang.Class.newInstance0(Class.java:326) java.lang.Class.newInstance(Class.java:308) org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102) org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:298) org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:852) org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:588) org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489) java.lang.Thread.run(Thread.java:619) note The full stack trace of the root cause is available in the Apache Tomcat/6.0.24 logs. Help me to solve a problem. and where is problem?

    Read the article

  • Path to background in servlet

    - by kapil chhattani
    //the below line is the element of my HTML form which renders the image sent by the servlet written further below. <img style="margin-left:91px; margin-top:-6px;" class="image" src="http://www.abcd.com/captchaServlet"> I generate a captcha code using the following code in java. public class captchaServlet extends HttpServlet { protected void processRequest(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { int width = 150; int height = 50; int charsToPrint = 6; String elegibleChars = "ABCDEFGHJKLMPQRSTUVWXYabcdefhjkmnpqrstuvwxy1234567890"; char[] chars = elegibleChars.toCharArray(); StringBuffer finalString = new StringBuffer(); for ( int i = 0; i < charsToPrint; i++ ) { double randomValue = Math.random(); int randomIndex = (int) Math.round(randomValue * (chars.length - 1)); char characterToShow = chars[randomIndex]; finalString.append(characterToShow); } System.out.println(finalString); BufferedImage bufferedImage = new BufferedImage(width, height, BufferedImage.TYPE_INT_RGB); Graphics2D g2d = bufferedImage.createGraphics(); Font font = new Font("Georgia", Font.BOLD, 18); g2d.setFont(font); RenderingHints rh = new RenderingHints( RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); rh.put(RenderingHints.KEY_RENDERING, RenderingHints.VALUE_RENDER_QUALITY); g2d.setRenderingHints(rh); GradientPaint gp = new GradientPaint(0, 0, Color.BLUE, 0, height/2, Color.black, true); g2d.setPaint(gp); g2d.fillRect(0, 0, width, height); g2d.setColor(new Color(255, 255, 0)); Random r = new Random(); int index = Math.abs(r.nextInt()) % 5; char[] data=new String(finalString).toCharArray(); String captcha = String.copyValueOf(data); int x = 0; int y = 0; for (int i=0; i<data.length; i++) { x += 10 + (Math.abs(r.nextInt()) % 15); y = 20 + Math.abs(r.nextInt()) % 20; g2d.drawChars(data, i, 1, x, y); } g2d.dispose(); response.setContentType("image/png"); OutputStream os = response.getOutputStream(); ImageIO.write(bufferedImage, "png", os); os.close(); } protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { processRequest(request, response); } protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { processRequest(request, response); } } But in the above code background is also generated using the setPaint menthod I am guessing. I want the background to be some image from my local machine whoz URL i should be able to mention like URL url=this.getClass().getResource("Desktop/images.jpg"); BufferedImage bufferedImage = ImageIO.read(url); I am just writing the above two lines for making the reader understand better what the issue is. Dont want to use the exact same commands. All I want is the the background of the captcha code generated should be an image of my choice.

    Read the article

1 2 3 4 5 6 7 8  | Next Page >