Page 3 of 5 FirstFirst 12345 LastLast
Results 21 to 30 of 43

Thread: HttpInvoker without web container?

  1. #21
    Join Date
    Aug 2004
    Location
    San Francisco
    Posts
    423

    Default

    One thing I notice in your config, you've not specified a contextPath name. Is that what you want? Have you tried with an explicit context name and changing the client urls to match?

    I typically use Jetty as Jetty-Plus to get JNDI support. I've not had much experience with Jetty6 so I can't really be of specific help there.

    But, I have got Jetty6 working with HttpInvoker. Here's an example config I've had working while testing. I know there's other ways of doing this, but I don't know the details. This is in my jetty-plus.xml:

    Code:
    <Configure id="Server" class="org.mortbay.jetty.Server">
    <Array id="plusConfig" type="java.lang.String">
        <Item>org.mortbay.jetty.webapp.WebInfConfiguration</Item>
        <Item>org.mortbay.jetty.plus.webapp.EnvConfiguration</Item>
        <Item>org.mortbay.jetty.plus.webapp.Configuration</Item>
        <Item>org.mortbay.jetty.webapp.JettyWebXmlConfiguration</Item>
        <Item>org.mortbay.jetty.webapp.TagLibConfiguration</Item>
      </Array>
     <New id="DataAccessServicesContext" class="org.mortbay.jetty.webapp.WebAppContext">
          <Arg><Ref id="contexts"/></Arg>
          <Arg>path to war</Arg>
          <Arg>/dataaccess</Arg>
          <Set name="ConfigurationClasses"><Ref id="plusConfig"/></Set>
          <Set name="defaultsDescriptor"><SystemProperty name="jetty.home" default="."/>/etc/webdefault.xml</Set>
          <Get name="SessionHandler">
            <Set name="SessionManager">
              <New class="org.mortbay.jetty.servlet.HashSessionManager">
                <Set name="maxInactiveInterval">600</Set>
              </New>
            </Set>
          </Get>
        </New>
    </Configure>
    Jonny

  2. #22
    Join Date
    Jan 2007
    Posts
    139

    Default

    Quote Originally Posted by jwray View Post
    One thing I notice in your config, you've not specified a contextPath name. Is that what you want? Have you tried with an explicit context name and changing the client urls to match?

    I typically use Jetty as Jetty-Plus to get JNDI support. I've not had much experience with Jetty6 so I can't really be of specific help there.

    But, I have got Jetty6 working with HttpInvoker. Here's an example config I've had working while testing. I know there's other ways of doing this, but I don't know the details. This is in my jetty-plus.xml:

    Code:
    <Configure id="Server" class="org.mortbay.jetty.Server">
    <Array id="plusConfig" type="java.lang.String">
        <Item>org.mortbay.jetty.webapp.WebInfConfiguration</Item>
        <Item>org.mortbay.jetty.plus.webapp.EnvConfiguration</Item>
        <Item>org.mortbay.jetty.plus.webapp.Configuration</Item>
        <Item>org.mortbay.jetty.webapp.JettyWebXmlConfiguration</Item>
        <Item>org.mortbay.jetty.webapp.TagLibConfiguration</Item>
      </Array>
     <New id="DataAccessServicesContext" class="org.mortbay.jetty.webapp.WebAppContext">
          <Arg><Ref id="contexts"/></Arg>
          <Arg>path to war</Arg>
          <Arg>/dataaccess</Arg>
          <Set name="ConfigurationClasses"><Ref id="plusConfig"/></Set>
          <Set name="defaultsDescriptor"><SystemProperty name="jetty.home" default="."/>/etc/webdefault.xml</Set>
          <Get name="SessionHandler">
            <Set name="SessionManager">
              <New class="org.mortbay.jetty.servlet.HashSessionManager">
                <Set name="maxInactiveInterval">600</Set>
              </New>
            </Set>
          </Get>
        </New>
    </Configure>
    Jonny
    Jonny:

    Yes, I have tried applying different contexts and then updating the URLs on the client spring config side to match, and still get the 404.

    I guess I am really confused now as to how to get this to work based on my needs; currently, we have a java application set up in Netbeans which has several subprojects. One of the subprojects is the data access layer which I am trying to connect to via Spring Remoting, HttpInvoker specifically.

    The problem is, I don't know if you can have a sub-project defined as a web app and then apply that sub-project as a dependency to the main project in Netbeans.

    I guess I can figure all that stuff out later, but the real trick is; can I access the context objects if they are NOT packaged in a WAR file(I should be able to).

  3. #23
    Join Date
    Aug 2004
    Location
    San Francisco
    Posts
    423

    Default

    Just did some testing with my install of Jetty6 (using jetty-plus.xml). The basic answer is yes, you can use '/' as your context name (not too surprising) and yes, you can use an exploded war file directory structure rather than a war file (directory should be the one with the WEB-INF directory in it).

    I've never used netbeans so can't help you there, but that seems like it's the source of your problems. Jetty and Tomcat appear to work the same way. Try taking Netbeans out of the equation.

    Jonny

  4. #24
    Join Date
    Jan 2007
    Posts
    139

    Default

    Quote Originally Posted by jwray View Post
    Just did some testing with my install of Jetty6 (using jetty-plus.xml). The basic answer is yes, you can use '/' as your context name (not too surprising) and yes, you can use an exploded war file directory structure rather than a war file (directory should be the one with the WEB-INF directory in it).

    I've never used netbeans so can't help you there, but that seems like it's the source of your problems. Jetty and Tomcat appear to work the same way. Try taking Netbeans out of the equation.

    Jonny
    Well, thanks, that is good to know. I assumed it worked that way. I am going to try making the DAO/Service layer totally independent of the rest of the Netbeans project(s), add the dependencies that the classes need, build the DAO/Services withing a true Netbeans Web-app and let you know what happens.

    Thanks!

  5. #25
    Join Date
    Jan 2007
    Posts
    139

    Default

    Quote Originally Posted by karldmoore View Post
    OK, heres the working example I promised........ I would zip it up an attach it, but my computer isn't playing ball. The project in this example is called timeService.

    Sooooo
    Code:
    tomcat
        webapps
            timeService
                applicationContext.xml
                invoker-servlet.xml
                web.xml
    
                classes
                    com/test/TimeService.class
                    com/test/TimeServiceImpl.class
                lib
                    spring.jar
                    commons-logging-1.0.4.jar
    How do you load the applicationContext.xml into Spring? I am trying to link jetty.xml, applicationContext.xml and web.xml. But it's tricky when you have to consider either starting Jetty from either the client when running standalone/single user or multi-user/distributed mode.

  6. #26
    Join Date
    Sep 2006
    Location
    UK
    Posts
    8,425

    Default

    ContextLoaderListener loads the applicationContext.xml. DispatcherServlet loads invoker-servlet.xml. Both of these are defined in the web.xml

  7. #27
    Join Date
    Jan 2007
    Posts
    139

    Default

    Quote Originally Posted by karldmoore View Post
    ContextLoaderListener loads the applicationContext.xml. DispatcherServlet loads invoker-servlet.xml. Both of these are defined in the web.xml
    I understand that part but as far as the relationship between jetty.xml, web.xml and applicationContext.xml . . . in the case of an embedded server, i.e. Jetty in this case, how do I start the Jetty Server(org.mortbay.jetty.Server) in the following two cases:

    1) Running in standalone mode, i.e., local database access
    2) Running in true web service/distributed app mode, i.e. network database.

    To start the Jetty server, I do the following:
    Code:
    beanFactory = new ClassPathXmlApplicationContext("jetty.xml");
    But I am not sure the proper place to call this. It can't really be done from the client code, because the jetty.xml, web.xml and applicationContext.xml files need to be kept in the web app directory structure(i.e. WEB-INF/).

  8. #28
    Join Date
    Sep 2006
    Location
    UK
    Posts
    8,425

    Default

    I'm afraid, I'm not much of a Jetty expert. I can ask one of the guys here and see if anyone else knows more about it...........

  9. #29
    Join Date
    Jan 2007
    Posts
    139

    Default

    Thanks. Again, the process seems fairly straightforward if I want to execute this on the same box as my client code is running on(i.e. standalone mode). Following the example found here, it makes perfect sense:

    http://jroller.com/page/sjivan?entry...ty_in_a_spring

    However, when I have multiple client apps hitting a network servlet container(jetty based), I need a process which handles the startup of the Jetty intance on that network box and that process is going to need access to jetty.xml, applicationContext.xml and web.xml. This could be done when the box boots up I suppose, but how would I structure that and make the necessary resources available seeing that I have a traditional web app directory structure(WEB-INF/classes . . ./lib, web.xml, etc.)?

  10. #30
    Join Date
    Jan 2007
    Posts
    139

    Default

    Quote Originally Posted by jwray View Post
    I'm developing and deploying applications using HttpInvoker using Jetty as the servlet container. I've looked through the above files and I can't see a difference in how I configure things.

    Basically, we have a bean '/Service' exposed via a servlet with mapping url pattern '/remote/*' under a context 'dataaccess' on server odin. The serviceUrl we use is

    http://odin:80/dataaccess/remote/Service

    That seems to agree with the other configuration and my web.xml is basically the same. My jetty (v5) configuration is:

    Code:
    <Call name="addWebApplication">
    	<Arg>/dataaccess/*</Arg>
    	<Arg>path to war file</Arg>
    	<Set name="extractWAR">true</Set>
      </Call>
    Jonny
    How do you load the jetty.xml config shown above? Do you do it vi a call to FileSystemXmlApplicationContext ctx = new FileSystemXmlApplicationContext(path/to/jetty.xml); or something similar? If so, it would have to be from a java class outside of the scope of the web app classes, correct, seeing the app server isn't started yet. If so, do you just set path/to/jetty.xml equal to something comparable towebapps/context/jetty.xml where the directory structure would be as follows?

    webapps
    context
    applicationContext.xml
    jetty.xml
    web.xml
    classes
    com/co/ind/Class1.class
    com/co/ind/Class2.class
    com/co/ind/Class3.class
    lib
    JavaDependency1.jar
    JavaDependency2.jar

Similar Threads

  1. Replies: 1
    Last Post: May 15th, 2005, 12:51 AM
  2. Container standard?
    By jbetancourt in forum Architecture
    Replies: 3
    Last Post: Apr 11th, 2005, 01:01 PM
  3. Replies: 2
    Last Post: Mar 27th, 2005, 10:50 PM
  4. AOP and pattern design
    By moo in forum AOP
    Replies: 12
    Last Post: Oct 19th, 2004, 01:17 PM
  5. Container Hierarchy
    By fbeauregard in forum Container
    Replies: 1
    Last Post: Sep 14th, 2004, 09:38 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •