6 Replies Latest reply on Apr 26, 2005 8:52 PM by Bruce

    application deployment question on Jboss4.0

    Bruce Newbie

      I write a stateless session bean and a jsp page
      the jsp page will call methods in the session bean
      I also write the application.xml,web.xml,jboss-web.xml,ejb-jar.xml,jboss.xml deployment descriptor
      I copy my application to default/deploy folder.
      Jboss server monitor displayed the deployment is successfull
      But when I call the jsp page from web browser, I was told that the home and remote interface of ejb can not be reserved.
      what's wrong? Need I copy the remote and home interface which have been compiled to web-inf/classes folder or somewhere else of my war?
      Could you please give me some example codes about jsp page calling ejb? Thanks in advance.

        • 1. Re: application deployment question on Jboss4.0
          Darryl Miles Novice

          From my (limited) understanding of these things.

          The WAR (Web Archive) contains HTML, JSP pages and Servlets, and its acompanying descriptor files web.xml and jboss-web.xml link it into the system and setup Tomcat. This file is deployed as a $JBOSS_HOME/server/default/deploy/myfile.war.

          The JAR containts EJB (incld statelss session beans) and its acompanying descriptor files applicataion.xml, ejb-jar.xml, jboss.wml to link it into the system and setup the bean containers. This file is deployed as a $JBOSS_HOME/server/default/deploy/myfile.jar.

          If you want to combine both WAR and JAR then this is done into an EAR, but this would be recommened for your production version.

          So you if you have put your stateless session EJB inside your WAR file, my limited understanding tells me it will not be deployed as you want. Since the TomcatDeployer will pick it up and not the EJBDeployer.

          Each of your beans when deployed should emit a line, this is a redeploy :

          04:09:06,587 INFO [TomcatDeployer] undeploy, ctxPath=/myManager, warUrl=file:/opt/jboss-4.0.2RC1/server/default/tmp/deploy/tmp1253myManager.war/
          04:09:06,897 INFO [TomcatDeployer] deploy, ctxPath=/myManager, warUrl=file:/opt/jboss-4.0.2RC1/server/default/tmp/deploy/tmp1255myManager.war/
          04:16:33,439 INFO [EJBDeployer] Undeploying: file:/opt/jboss-4.0.2RC1/server/default/deploy/myState.jar
          04:16:33,530 INFO [EjbModule] Undeployed myState
          04:16:33,535 INFO [EjbModule] Undeployed myTest
          04:16:34,024 INFO [EjbModule] Deploying myTest
          04:16:34,071 INFO [EjbModule] Deploying myState
          04:16:34,529 INFO [EJBDeployer] Deployed: file:/opt/jboss-4.0.2RC1/server/default/deploy/myState.jar
          


          The insides of my MyManager.war:

          0 Mon Apr 25 04:16:14 BST 2005 META-INF/
           268 Mon Apr 25 04:16:12 BST 2005 META-INF/MANIFEST.MF
           0 Mon Apr 25 04:16:14 BST 2005 WEB-INF/
           0 Mon Apr 25 04:16:14 BST 2005 WEB-INF/classes/
           0 Mon Apr 25 04:16:14 BST 2005 WEB-INF/classes/co/
           0 Mon Apr 25 04:16:14 BST 2005 WEB-INF/classes/co/uk/
           0 Mon Apr 25 04:16:14 BST 2005 WEB-INF/classes/co/uk/mydomain/
           0 Mon Apr 25 04:16:14 BST 2005 WEB-INF/classes/co/uk/mydomain/test/
           238 Mon Apr 25 04:16:14 BST 2005 WEB-INF/classes/co/uk/mydomain/test/myTest.class
           456 Mon Apr 25 04:16:14 BST 2005 WEB-INF/classes/co/uk/mydomain/test/myTestHome.class
           170 Mon Apr 25 04:16:14 BST 2005 WEB-INF/classes/co/uk/mydomain/test/myTestLocal.class
           451 Mon Apr 25 04:16:14 BST 2005 WEB-INF/classes/co/uk/mydomain/test/myTestLocalHome.class
           948 Mon Apr 25 04:16:14 BST 2005 WEB-INF/classes/co/uk/mydomain/test/myTestSession.class
           4814 Mon Apr 25 04:16:14 BST 2005 WEB-INF/classes/co/uk/mydomain/test/myTestUtil.class
           334 Mon Apr 25 04:16:14 BST 2005 WEB-INF/classes/log4j.properties
           0 Mon Apr 25 04:16:14 BST 2005 WEB-INF/classes/uk/
           0 Mon Apr 25 04:16:14 BST 2005 WEB-INF/classes/uk/co/
           0 Mon Apr 25 04:16:14 BST 2005 WEB-INF/classes/uk/co/dlmc/
           0 Mon Apr 25 04:16:14 BST 2005 WEB-INF/classes/uk/co/dlmc/util/
           345 Mon Apr 25 04:16:14 BST 2005 WEB-INF/classes/uk/co/dlmc/util/DateTime.class
           0 Mon Apr 25 04:16:14 BST 2005 WEB-INF/classes/uk/co/mydomain/
           875 Mon Apr 25 04:16:14 BST 2005 WEB-INF/classes/uk/co/mydomain/SearchRecordDump.class
           1342 Mon Apr 25 04:16:14 BST 2005 WEB-INF/classes/uk/co/mydomain/SearchRecordStatus.class
           570 Mon Apr 25 04:16:14 BST 2005 WEB-INF/classes/uk/co/mydomain/SearchRecordStatusBadValueException.class
           546 Mon Apr 25 04:16:14 BST 2005 WEB-INF/classes/uk/co/mydomain/SearchRecordStatusException.class
           780 Mon Apr 25 04:16:14 BST 2005 WEB-INF/classes/uk/co/mydomain/SearchResultRecord.class
           538 Mon Apr 25 04:16:14 BST 2005 WEB-INF/classes/uk/co/mydomain/SearchResultRecordId.class
           881 Mon Apr 25 04:16:14 BST 2005 WEB-INF/classes/uk/co/mydomain/SearchSubmitRecord.class
           538 Mon Apr 25 04:16:14 BST 2005 WEB-INF/classes/uk/co/mydomain/SearchSubmitRecordId.class
           525 Mon Apr 25 04:16:14 BST 2005 WEB-INF/classes/uk/co/mydomain/myState.class
           2666 Mon Apr 25 04:16:14 BST 2005 WEB-INF/classes/uk/co/mydomain/myStateBean.class
           451 Mon Apr 25 04:16:14 BST 2005 WEB-INF/classes/uk/co/mydomain/myStateHome.class
           167 Mon Apr 25 04:16:14 BST 2005 WEB-INF/classes/uk/co/mydomain/myStateLocal.class
           446 Mon Apr 25 04:16:14 BST 2005 WEB-INF/classes/uk/co/mydomain/myStateLocalHome.class
           937 Mon Apr 25 04:16:14 BST 2005 WEB-INF/classes/uk/co/mydomain/myStateSession.class
           4774 Mon Apr 25 04:16:14 BST 2005 WEB-INF/classes/uk/co/mydomain/myStateUtil.class
           0 Mon Apr 25 04:16:14 BST 2005 WEB-INF/classes/uk/co/mydomain/dao/
           523 Mon Apr 25 04:16:14 BST 2005 WEB-INF/classes/uk/co/mydomain/dao/DAOHandle.class
           2234 Mon Apr 25 04:16:14 BST 2005 WEB-INF/classes/uk/co/mydomain/dao/MysqlHandle.class
           536 Mon Apr 25 04:16:14 BST 2005 WEB-INF/classes/uk/co/mydomain/dao/SearchResult.class
           5834 Mon Apr 25 04:16:14 BST 2005 WEB-INF/classes/uk/co/mydomain/dao/SearchResultBase.class
           2350 Mon Apr 25 04:16:14 BST 2005 WEB-INF/classes/uk/co/mydomain/dao/SearchResultMaster.class
           2350 Mon Apr 25 04:16:14 BST 2005 WEB-INF/classes/uk/co/mydomain/dao/SearchResultWorker.class
           536 Mon Apr 25 04:16:14 BST 2005 WEB-INF/classes/uk/co/mydomain/dao/SearchSubmit.class
           6292 Mon Apr 25 04:16:14 BST 2005 WEB-INF/classes/uk/co/mydomain/dao/SearchSubmitBase.class
           2354 Mon Apr 25 04:16:14 BST 2005 WEB-INF/classes/uk/co/mydomain/dao/SearchSubmitMaster.class
           2354 Mon Apr 25 04:16:14 BST 2005 WEB-INF/classes/uk/co/mydomain/dao/SearchSubmitWorker.class
           0 Mon Apr 25 04:16:14 BST 2005 WEB-INF/classes/uk/co/mydomain/test/
           2710 Mon Apr 25 04:16:14 BST 2005 WEB-INF/classes/uk/co/mydomain/test/myStateClient.class
           238 Mon Apr 25 04:16:14 BST 2005 WEB-INF/classes/uk/co/mydomain/test/myTest.class
           601 Mon Apr 25 04:16:14 BST 2005 WEB-INF/classes/uk/co/mydomain/test/myTestBean.class
           2315 Mon Apr 25 04:16:14 BST 2005 WEB-INF/classes/uk/co/mydomain/test/myTestClient.class
           49 Mon Apr 25 04:16:14 BST 2005 WEB-INF/classes/uk/co/mydomain/test/myTestClient.properties
           456 Mon Apr 25 04:16:14 BST 2005 WEB-INF/classes/uk/co/mydomain/test/myTestHome.class
           170 Mon Apr 25 04:16:14 BST 2005 WEB-INF/classes/uk/co/mydomain/test/myTestLocal.class
           451 Mon Apr 25 04:16:14 BST 2005 WEB-INF/classes/uk/co/mydomain/test/myTestLocalHome.class
           948 Mon Apr 25 04:16:14 BST 2005 WEB-INF/classes/uk/co/mydomain/test/myTestSession.class
           4814 Mon Apr 25 04:16:14 BST 2005 WEB-INF/classes/uk/co/mydomain/test/myTestUtil.class
           286 Mon Apr 25 04:16:14 BST 2005 WEB-INF/resin-web.xml
           243 Mon Apr 25 04:16:14 BST 2005 WEB-INF/undeploy.xml
           1539 Mon Apr 25 04:16:14 BST 2005 WEB-INF/web.xml
           765 Mon Apr 25 04:16:14 BST 2005 WEB-INF/weblogic.xml
           347 Mon Apr 25 04:16:14 BST 2005 error.jsp
           167 Mon Apr 25 04:16:14 BST 2005 index.jsp
          


          The insides of my myState.jar :

          0 Mon Apr 25 04:16:30 BST 2005 META-INF/
           268 Mon Apr 25 04:16:28 BST 2005 META-INF/MANIFEST.MF
           0 Mon Apr 25 04:16:30 BST 2005 co/
           0 Mon Apr 25 04:16:30 BST 2005 co/uk/
           0 Mon Apr 25 04:16:30 BST 2005 co/uk/mydomain/
           0 Mon Apr 25 04:16:30 BST 2005 co/uk/mydomain/test/
           238 Mon Apr 25 04:16:30 BST 2005 co/uk/mydomain/test/myTest.class
           456 Mon Apr 25 04:16:30 BST 2005 co/uk/mydomain/test/myTestHome.class
           170 Mon Apr 25 04:16:30 BST 2005 co/uk/mydomain/test/myTestLocal.class
           451 Mon Apr 25 04:16:30 BST 2005 co/uk/mydomain/test/myTestLocalHome.class
           948 Mon Apr 25 04:16:30 BST 2005 co/uk/mydomain/test/myTestSession.class
           4814 Mon Apr 25 04:16:30 BST 2005 co/uk/mydomain/test/myTestUtil.class
           0 Mon Apr 25 04:16:30 BST 2005 uk/
           0 Mon Apr 25 04:16:30 BST 2005 uk/co/
           0 Mon Apr 25 04:16:30 BST 2005 uk/co/dlmc/
           0 Mon Apr 25 04:16:30 BST 2005 uk/co/dlmc/util/
           345 Mon Apr 25 04:16:30 BST 2005 uk/co/dlmc/util/DateTime.class
           0 Mon Apr 25 04:16:30 BST 2005 uk/co/mydomain/
           875 Mon Apr 25 04:16:30 BST 2005 uk/co/mydomain/SearchRecordDump.class
           1342 Mon Apr 25 04:16:30 BST 2005 uk/co/mydomain/SearchRecordStatus.class
           570 Mon Apr 25 04:16:30 BST 2005 uk/co/mydomain/SearchRecordStatusBadValueException.class
           546 Mon Apr 25 04:16:30 BST 2005 uk/co/mydomain/SearchRecordStatusException.class
           780 Mon Apr 25 04:16:30 BST 2005 uk/co/mydomain/SearchResultRecord.class
           538 Mon Apr 25 04:16:30 BST 2005 uk/co/mydomain/SearchResultRecordId.class
           881 Mon Apr 25 04:16:30 BST 2005 uk/co/mydomain/SearchSubmitRecord.class
           538 Mon Apr 25 04:16:30 BST 2005 uk/co/mydomain/SearchSubmitRecordId.class
           525 Mon Apr 25 04:16:30 BST 2005 uk/co/mydomain/myState.class
           2666 Mon Apr 25 04:16:30 BST 2005 uk/co/mydomain/myStateBean.class
           451 Mon Apr 25 04:16:30 BST 2005 uk/co/mydomain/myStateHome.class
           167 Mon Apr 25 04:16:30 BST 2005 uk/co/mydomain/myStateLocal.class
           446 Mon Apr 25 04:16:30 BST 2005 uk/co/mydomain/myStateLocalHome.class
           937 Mon Apr 25 04:16:30 BST 2005 uk/co/mydomain/myStateSession.class
           4774 Mon Apr 25 04:16:30 BST 2005 uk/co/mydomain/myStateUtil.class
           0 Mon Apr 25 04:16:30 BST 2005 uk/co/mydomain/dao/
           523 Mon Apr 25 04:16:30 BST 2005 uk/co/mydomain/dao/DAOHandle.class
           2234 Mon Apr 25 04:16:30 BST 2005 uk/co/mydomain/dao/MysqlHandle.class
           536 Mon Apr 25 04:16:30 BST 2005 uk/co/mydomain/dao/SearchResult.class
           5834 Mon Apr 25 04:16:30 BST 2005 uk/co/mydomain/dao/SearchResultBase.class
           2350 Mon Apr 25 04:16:30 BST 2005 uk/co/mydomain/dao/SearchResultMaster.class
           2350 Mon Apr 25 04:16:30 BST 2005 uk/co/mydomain/dao/SearchResultWorker.class
           536 Mon Apr 25 04:16:30 BST 2005 uk/co/mydomain/dao/SearchSubmit.class
           6292 Mon Apr 25 04:16:30 BST 2005 uk/co/mydomain/dao/SearchSubmitBase.class
           2354 Mon Apr 25 04:16:30 BST 2005 uk/co/mydomain/dao/SearchSubmitMaster.class
           2354 Mon Apr 25 04:16:30 BST 2005 uk/co/mydomain/dao/SearchSubmitWorker.class
           0 Mon Apr 25 04:16:30 BST 2005 uk/co/mydomain/test/
           2710 Mon Apr 25 04:16:30 BST 2005 uk/co/mydomain/test/myStateClient.class
           238 Mon Apr 25 04:16:30 BST 2005 uk/co/mydomain/test/myTest.class
           601 Mon Apr 25 04:16:30 BST 2005 uk/co/mydomain/test/myTestBean.class
           2315 Mon Apr 25 04:16:30 BST 2005 uk/co/mydomain/test/myTestClient.class
           49 Mon Apr 25 04:16:30 BST 2005 uk/co/mydomain/test/myTestClient.properties
           456 Mon Apr 25 04:16:30 BST 2005 uk/co/mydomain/test/myTestHome.class
           170 Mon Apr 25 04:16:30 BST 2005 uk/co/mydomain/test/myTestLocal.class
           451 Mon Apr 25 04:16:30 BST 2005 uk/co/mydomain/test/myTestLocalHome.class
           948 Mon Apr 25 04:16:30 BST 2005 uk/co/mydomain/test/myTestSession.class
           4814 Mon Apr 25 04:16:30 BST 2005 uk/co/mydomain/test/myTestUtil.class
           4685 Mon Apr 25 03:54:38 BST 2005 META-INF/ejb-jar.xml
           1139 Mon Apr 25 03:54:38 BST 2005 META-INF/ibm-ejb-jar-bnd.xmi
           225 Mon Apr 25 03:54:38 BST 2005 META-INF/ibm-ejb-jar-ext.xmi
           1025 Fri Apr 22 23:45:56 BST 2005 META-INF/jboss-jdbc-mysql-ds.xml
           1261 Mon Apr 25 03:54:38 BST 2005 META-INF/jboss.xml
           1786 Sat Apr 23 00:34:52 BST 2005 META-INF/jbosscmp-jdbc-default.xml
           634 Mon Apr 25 03:54:38 BST 2005 META-INF/jonas-ejb-jar.xml
           725 Mon Apr 25 03:54:38 BST 2005 META-INF/jrun-ejb-jar.xml
           387 Mon Apr 25 03:54:38 BST 2005 META-INF/mapping.xml
           809 Mon Apr 25 03:54:38 BST 2005 META-INF/orion-ejb-jar.xml
           1230 Mon Apr 25 03:54:38 BST 2005 META-INF/weblogic-ejb-jar.xml
          



          • 2. Re: application deployment question on Jboss4.0
            Bruce Newbie

            Thank dlmiles's reply.
            My application is an EAR file. The EAR file contains a JAR file which contains my session bean and a WAR file which contains a jsp page. I also write application.xml, web.xml,jboss-web.xml, ejb-jar.xml,jboss.xml. After deployment, the Jboss server told me the deployment is successful. But when I call the jsp page from web browser(the jsp page call the stateless session bean's methods), I was told the bean's remote interface and home interface can not be resolved. It seems that when compiling the jsp page to servlet class, the container can not find the bean's remote and home interface. what's the problem. I think I only need to provide necessary xml descriptors to tell the container my EAR, JAR and WAR information,right?

            • 3. Re: application deployment question on Jboss4.0
              Bruce Newbie

              let's make the question simple
              I write a jsp page, and a helper class named test.class, I put the class into the web-inf/classes folder
              In the jsp page, I want use the test.class.
              but when I import the class in the jsp page: <@ page import="test" %>, I was told the import test can not be resolved.
              How can I invoke my helper class in my jsp page?Why Jboss told me the helper class can not be resolved?

              • 4. Re: application deployment question on Jboss4.0
                Darryl Miles Novice

                 

                "xgj6688" wrote:
                But when I call the jsp page from web browser(the jsp page call the stateless session bean's methods), I was told the bean's remote interface and home interface can not be resolved. It seems that when compiling the jsp page to servlet class, the container can not find the bean's remote and home interface. what's the problem. I think I only need to provide necessary xml descriptors to tell the container my EAR, JAR and WAR information,right?
                Maybe you could post the top of your stack trace?

                Again all from my limited understanding.

                I've only ever heard Home and Remote interfaces being talked about in respect to "EJBs" this means your bean "implements javax.ejb.SessionBean' or another class in the javax.ejb.* family.

                But it looks like you are trying to access them directly from JSP, maybe I've not gotten onto understanding that yet but the Beans my JSP access are regular Plain Old Java Classes ("public class myJspBean'). Inside this class I have code that resolves the JNDI and then executes the EJB Business Method. Just like a test client does.

                My understanding is that JSP beans are contained within the Servlet container (tomcat), this is not the same container as the EJB container (JBoss). JSP naturally wants to call methods within its own container.

                If you can execute EJB business methods directly from inside JSP I would be interested to understand that myself.


                Maybe your problem is due to lack of the supporting classes for EJB ?

                I generate Home and Remote interfaces with XDoclet from a base Bean, so around 6 classes are generated from my EJB. I wrote SiteLookStateBean all the other classes are generated, both my JAR and WAR have these classes:

                611 Mon Apr 25 22:52:50 BST 2005 WEB-INF/classes/uk/co/mydomain/SiteLookState.class
                 3145 Mon Apr 25 22:52:50 BST 2005 WEB-INF/classes/uk/co/mydomain/SiteLookStateBean.class
                 451 Mon Apr 25 22:52:50 BST 2005 WEB-INF/classes/uk/co/mydomain/SiteLookStateHome.class
                 167 Mon Apr 25 22:52:50 BST 2005 WEB-INF/classes/uk/co/mydomain/SiteLookStateLocal.class
                 446 Mon Apr 25 22:52:50 BST 2005 WEB-INF/classes/uk/co/mydomain/SiteLookStateLocalHome.class
                 937 Mon Apr 25 22:52:50 BST 2005 WEB-INF/classes/uk/co/mydomain/SiteLookStateSession.class
                 4774 Mon Apr 25 22:52:50 BST 2005 WEB-INF/classes/uk/co/mydomain/SiteLookStateUtil.class
                


                • 5. Re: application deployment question on Jboss4.0
                  Peter Johnson Master

                   

                  "xgj6688" wrote:
                  let's make the question simple
                  I write a jsp page, and a helper class named test.class, I put the class into the web-inf/classes folder
                  In the jsp page, I want use the test.class.
                  but when I import the class in the jsp page: <@ page import="test" %>, I was told the import test can not be resolved.
                  How can I invoke my helper class in my jsp page?Why Jboss told me the helper class can not be resolved?


                  Here is a simple class and JSP that works (at least on JBoss 3.2.7):

                  Hello.java:
                  package peter;
                  public class Hello {
                   public String toString() {
                   return "hello to JBoss";
                   }
                  }
                  


                  index.jsp:
                  <html>
                  <body>
                  <%@ page import="peter.Hello" %>
                  <%
                   Hello h = new Hello();
                  %>
                  <h1><%= h.toString() %></h1>
                  </body>
                  </html>
                  


                  Note that I placed my class within a package. When it was in the default package, the compiler complained that it did not know how to import Hello (it expected a dot). Perhaps you should try placing your test class into a package and thus changing your import statement.

                  Hope this helps.



                  • 6. Re: application deployment question on Jboss4.0
                    Bruce Newbie

                    cheers! When I package the EJBs or helper classes, and put them in the corresponding package folder, JBoss works. Without package,directly put them in the 'default' package, JBoss can not resolve them. But in sun ONE application server, no such porblem. Thank you for all your help.