Menu

XML-RPC problem with jetty9

Help
Nasser
2013-02-19
2013-04-25
  • Nasser

    Nasser - 2013-02-19

    Welcome

    i have servlet and web.xml (show below) and i use jetty container to run it . but when i run jetty server dont read my project.

    how can i solve this problem ?

    servlet is ExampleService.java

    //package example;

    import java.util.Random;
    import java.util.HashMap;
    import javax.servlet.ServletConfig;
    import javax.servlet.ServletException;
    import redstone.xmlrpc.XmlRpcServlet;

    public class ExampleService extends XmlRpcServlet
    {
    public void init( ServletConfig servletConfig ) throws ServletException
    {
    super.init( servletConfig );

    getXmlRpcServer().addInvocationHandler( "SimpleDatabase", new HashMap() );
    getXmlRpcServer().addInvocationHandler( "RandomNumberGenerator", new Random() );
    }
    }

    and the web.xml file :

    <?xml version="1.0" encoding="ISO-8859-1"?>
    <web-app>

    <!- To save as "hello\WEB-INF\web.xml" ->
    <servlet>
    <servlet-name>ExampleService</servlet-name>
    <servlet-class>ExampleService</servlet-class>
    <init-param>
    <param-name>streamMessages</param-name>
    <param-value>1</param-value>
    </init-param>
    <init-param> <!- Optional! Defaults to text/xml and ISO-8859-1 ->
    <param-name>contentType</param-name>
    <param-value>text/xml; charset=ISO-8859-1</param-value>
    </init-param>
    <load-on-startup>1</load-on-startup>
    </servlet>
    <servlet-mapping>
    <servlet-name>ExampleService</servlet-name>
    <url-pattern>/redstone</url-pattern>
    </servlet-mapping>

    </web-app>

    The final application like this in jetty:
    /WEB-INF
    web.xml
    classes/
    example/ExampleService.class
    lib/
    xmlrpc.jar
    i wait to help queckly please . thanks

     
  • Greger Olsson

    Greger Olsson - 2013-02-19

    Do you have any error logs during starup of your Jetty instance? There should be a log somewhere showing its startup sequence.

    And regarding your ExampleService, did you move the server out of its package, directly under classes? In your Java-code you've commented away the package name and load it as <servlet-class>ExampleService</servlet-class>, but your application JAR dump lists it under the example-directory.

    Without any kind of error from Jetty it is hard to know what the problem is.

     
  • Nasser

    Nasser - 2013-02-23

    when i start jetty i get this error

    2013-02-23 08:56:15.122:INFO:oejd.DeploymentManager:main: Deployable added: C:\Users\Nasser\jetty-distribution-9.0.0.RC0\webapps\redstone
    2013-02-23 08:56:15.122:WARN:oejd.DeploymentManager:main: Unable to reach node goal: started
    java.lang.NoClassDefFoundError: javax/servlet/HttpConstraintElement
    at org.eclipse.jetty.deploy.providers.WebAppProvider.createContextHandler(WebAppProvider.java:298)
    at org.eclipse.jetty.deploy.App.getContextHandler(App.java:100)
    at org.eclipse.jetty.deploy.bindings.StandardDeployer.processBinding(StandardDeployer.java:36)
    at org.eclipse.jetty.deploy.AppLifeCycle.runBindings(AppLifeCycle.java:186)
    at org.eclipse.jetty.deploy.DeploymentManager.requestAppGoal(DeploymentManager.java:495)
    at org.eclipse.jetty.deploy.DeploymentManager.addApp(DeploymentManager.java:146)
    at org.eclipse.jetty.deploy.providers.ScanningAppProvider.fileAdded(ScanningAppProvider.java:175)
    at org.eclipse.jetty.deploy.providers.ScanningAppProvider$1.fileAdded(ScanningAppProvider.java:64)
    at org.eclipse.jetty.util.Scanner.reportAddition(Scanner.java:600)
    at org.eclipse.jetty.util.Scanner.reportDifferences(Scanner.java:528)
    at org.eclipse.jetty.util.Scanner.scan(Scanner.java:391)
    at org.eclipse.jetty.util.Scanner.doStart(Scanner.java:313)
    at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:69)
    at org.eclipse.jetty.deploy.providers.ScanningAppProvider.doStart(ScanningAppProvider.java:145)
    at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:69)
    at org.eclipse.jetty.deploy.DeploymentManager.startAppProvider(DeploymentManager.java:557)
    at org.eclipse.jetty.deploy.DeploymentManager.doStart(DeploymentManager.java:232)
    at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:69)
    at org.eclipse.jetty.util.component.ContainerLifeCycle.start(ContainerLifeCycle.java:108)
    at org.eclipse.jetty.server.Server.start(Server.java:346)
    at org.eclipse.jetty.util.component.ContainerLifeCycle.doStart(ContainerLifeCycle.java:90)
    at org.eclipse.jetty.server.handler.AbstractHandler.doStart(AbstractHandler.java:58)
    at org.eclipse.jetty.server.Server.doStart(Server.java:294)
    at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:69)
    at org.eclipse.jetty.xml.XmlConfiguration$1.run(XmlConfiguration.java:1233)
    at java.security.AccessController.doPrivileged(Native Method)
    at org.eclipse.jetty.xml.XmlConfiguration.main(XmlConfiguration.java:1160)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:601)
    at org.eclipse.jetty.start.Main.invokeMain(Main.java:453)
    at org.eclipse.jetty.start.Main.start(Main.java:595)
    at org.eclipse.jetty.start.Main.main(Main.java:96)

     
  • Greger Olsson

    Greger Olsson - 2013-02-23

    This sounds unrelated to the XML-RPC library. Partly because Redstone XML-RPC does not refer to the javax.servlet.HttpConstraintElement class in any way, and does not include any javax.servlet code in its JAR that might override the one on your classpath, and thirdly; the stack trace does not mention any of the XML-RPC library classes.

    From what I can tell, there is something wrong with your environment or classpath or something. The HttpConstraintElement class was introduced in the 3.0 version of the servlet API. Perhaps there is some older version of the API somewhere on your classpath.

     

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.