Announcement Announcement Module
Collapse
No announcement yet.
HttpInvoker without web container? Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • #16
    That right, I didn't create a WAR file. I don't think thats anything to do with it however.

    Comment


    • #17
      I don't either. I believe it has something to do w/the relationship between jetty.xml, web.xml and the applicationcontext.xml.

      Comment


      • #18
        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

        Comment


        • #19
          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
          A couple of questions; I don't have the addWebApplication in my jetty.xml. Do I need this? Second, can I do this if the app is not packaged as a WAR file, like a normal web app?

          Comment


          • #20
            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
            I believe that the following in a Jetty 6 jetty.xml should accomplish the same thing as the addWebApplication above, correct?

            Code:
            <property name="handler">
                        <bean id="handlers"
                              class="org.mortbay.jetty.handler.HandlerCollection">
                            <property name="handlers">
                                <list>
                                    <bean id="contexts"
                                          class="org.mortbay.jetty.handler.ContextHandlerCollection">
                                        <property name="handlers">
                                            <list>
                                                <bean class="org.mortbay.jetty.webapp.WebAppContext">
                                                    <property name="contextPath" value="/"/>
                                                    <!--<property name="war" value="../web">-->
                                                        <property name="resourceBase" value="../backcheck">
                                                    </property>
                                                </bean>
                                            </list>
                                        </property>

            Comment


            • #21
              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

              Comment


              • #22
                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).

                Comment


                • #23
                  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

                  Comment


                  • #24
                    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!

                    Comment


                    • #25
                      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.

                      Comment


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

                        Comment


                        • #27
                          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/).

                          Comment


                          • #28
                            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...........

                            Comment


                            • #29
                              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.)?

                              Comment


                              • #30
                                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

                                Comment

                                Working...
                                X