11 Replies Latest reply on Apr 22, 2007 1:07 PM by sheilalety

    Jboss install

    jgayathri

      I have downloaded ant1.6, and tried to build Jbossas from the source jboss-4.0.5.GA-src.tar.gz, i am using RHEL4, Jdk path in etc/profile
      #java
      JAVA_HOME= /usr/java/jdk1.5.0_11
      PATH=/usr/java/jdk1.5.0_11/bin:$PATH
      CLASSPATH=/usr/java/jdk1.5.0_11/lib:$CLASSPATH
      #ANT1.6
      ANT_HOME=/home/servers/java/apache-ant-1.6.0
      PATH=/home/servers/java/apache-ant-1.6.0/bin:$PATH


      i run this command ant -buildfile build.xml
      when i am building i got this problem


      init:

      compile-idl:
      [jacidl] scan file: /home/servers/java/jboss-4.0.5.GA-src/iiop/src/idl/SASCurrent.idl
      [jacidl] scan file: /home/servers/java/jboss-4.0.5.GA-src/iiop/src/idl/TransactionService.idl
      [jacidl] processing idl file: /home/servers/java/jboss-4.0.5.GA-src/iiop/src/idl/SASCurrent.idl
      [jacidl] processing idl file: /home/servers/java/jboss-4.0.5.GA-src/iiop/src/idl/TransactionService.idl

      compile-classes:

      compile-rmi:
      [rmic] RMI Compiling 1 class to /home/servers/java/jboss-4.0.5.GA-src/iiop/output/classes
      [rmic] IIOP has been turned on.
      java.lang.UnsatisfiedLinkError: hasStaticInitializer
      at com.sun.corba.ee.internal.io.ObjectStreamClass.hasStaticInitializer(Native Method)
      at com.sun.corba.ee.internal.io.ObjectStreamClass._computeSerialVersionUID(ObjectStreamClass.java:943)
      at com.sun.corba.ee.internal.io.ObjectStreamClass.(ObjectStreamClass.java:459)
      at com.sun.corba.ee.internal.io.ObjectStreamClass.lookupInternal(ObjectStreamClass.java:139)
      at com.sun.corba.ee.internal.io.ObjectStreamClass.lookup(ObjectStreamClass.java:96)
      at com.sun.corba.ee.internal.io.ObjectStreamClass.lookupInternal(ObjectStreamClass.java:133)
      at com.sun.corba.ee.internal.io.ObjectStreamClass.lookup(ObjectStreamClass.java:96)
      at com.sun.corba.ee.internal.io.ObjectStreamClass.getSerialVersionUID(ObjectStreamClass.java:159)
      at com.sun.corba.ee.internal.util.RepositoryId.(RepositoryId.java:150)
      at sun.rmi.rmic.iiop.IDLNames.convertToISOLatin1(IDLNames.java:139)
      at sun.rmi.rmic.iiop.IDLNames.getClassOrInterfaceName(IDLNames.java:233) at sun.rmi.rmic.iiop.CompoundType.(CompoundType.java:644)
      at sun.rmi.rmic.iiop.InterfaceType.(InterfaceType.java:104)
      at sun.rmi.rmic.iiop.RemoteType.(RemoteType.java:115)
      at sun.rmi.rmic.iiop.RemoteType.forRemote(RemoteType.java:79)
      at sun.rmi.rmic.iiop.StubGenerator.getTopType(StubGenerator.java:119)
      at sun.rmi.rmic.iiop.Generator.generate(Generator.java:262)
      at sun.rmi.rmic.Main.doCompile(Main.java:526)
      at sun.rmi.rmic.Main.compile(Main.java:133)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      at java.lang.reflect.Method.invoke(Method.java:585)
      at org.apache.tools.ant.taskdefs.rmic.SunRmic.execute(SunRmic.java:91)
      at org.apache.tools.ant.taskdefs.Rmic.execute(Rmic.java:520)
      at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:306)
      at org.apache.tools.ant.Task.perform(Task.java:401)
      at org.apache.tools.ant.Target.execute(Target.java:338)
      at org.apache.tools.ant.Target.performTasks(Target.java:365)
      at org.apache.tools.ant.Project.executeTarget(Project.java:1237)
      at org.jboss.tools.buildmagic.task.CallTarget.execute(CallTarget.java:141)
      at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:306)
      at org.apache.tools.ant.Task.perform(Task.java:401)
      at org.apache.tools.ant.Target.execute(Target.java:338)
      at org.apache.tools.ant.Target.performTasks(Target.java:365)
      at org.apache.tools.ant.Project.executeTarget(Project.java:1237)
      at org.jboss.tools.buildmagic.task.Ant.execute(Ant.java:261)
      at org.jboss.tools.buildmagic.task.module.ExecuteModules$1.run(ExecuteModules.java:361)
      at org.jboss.tools.buildmagic.task.module.ExecuteModules.executeModule(ExecuteModules.java:376)
      at org.jboss.tools.buildmagic.task.module.ExecuteModules.execute(ExecuteModules.java:241)
      at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:306)
      at org.apache.tools.ant.Task.perform(Task.java:401)
      at org.apache.tools.ant.Target.execute(Target.java:338)
      at org.apache.tools.ant.Target.performTasks(Target.java:365)
      at org.apache.tools.ant.Project.executeTarget(Project.java:1237)
      at org.apache.tools.ant.Project.executeTargets(Project.java:1094)
      at org.apache.tools.ant.Main.runBuild(Main.java:669)
      at org.apache.tools.ant.Main.startAnt(Main.java:220)
      at org.apache.tools.ant.launch.Launcher.run(Launcher.java:215)
      at org.apache.tools.ant.launch.Launcher.main(Launcher.java:90)
      [rmic] error: An error has occurred in the compiler; please file a bug report (http://java.sun.com/cgi-bin/bugreport.cgi).



      [rmic] 1 error




      BUILD FAILED
      /home/servers/java/jboss-4.0.5.GA-src/iiop/build.xml:237: Rmic failed; see the compiler error output for details.

      Total time: 53 seconds
      [root@gayathri build]#

      I wnt to know the reason and understand the compilation (build) from source)

        • 1. Re: Jboss install
          peterj

          Instead of running ant manually, try this: "cd" to the build directory and run "./build.sh". This will use the built-in Ant utility. (I have successfully built 4.0.5.GA using JDK 1.5.0_11 on FC6 following those steps.)

          • 2. Re: Jboss install
            jgayathri

            i tried as method given by u. But it was giving exception in default loader repositry class

            • 3. Re: Jboss install
              peterj

              What was the exception?

              Are there any stray jar files in the endorsed directory?

              You could try adding -verbose:class to the Java command that starts Ant, this should point out if stray jars are being picked up.

              I once spent days debugging a issue where suddenly the JBossAS build would stop working on a certain computer, giving a missing method error when I could see that method in the .java source file. Apparently someone in some other department was too lazy to properly set up the classpath for his build, so his build script copied an older version of a JBoss jar file into the endorsed directory. The first time he did his build on that common build machine, my build stopped working. Eventually, I ran out of common build machines and I was forced to solve the problem; -verbose:class pointed out the culprit.

              • 4. Re: Jboss install
                jgayathri

                Thanks, today it build successfully . The path iin etc/profile i made change, i set it yesterday like this
                #java
                JAVA_HOME= /usr/java/jdk1.5.0_11
                PATH=/usr/java/jdk1.5.0_11/bin:$PATH
                CLASSPATH=/usr/java/jdk1.5.0_11/lib:$CLASSPATH


                #ANT1.6
                ANT_HOME=/home/servers/java/apache-ant-1.6.0
                PATH=/home/servers/java/apache-ant-1.6.0/bin:$PATH


                earlier th e order was different. it build successful today.

                I downloaded example3.ear from roseindia.net, this i copied to jboss deploy , iimmediately it gave error like this classcast exception . This is happening for both the downloaded bin jboss and in the built jboss also .

                my profile setting now is:
                #java
                JAVA_HOME= /usr/java/jdk1.5.0_11
                PATH=/usr/java/jdk1.5.0_11/bin:$PATH
                CLASSPATH=/usr/java/jdk1.5.0_11/lib:$CLASSPATH
                #JBoss
                #JBOSS_HOME=/home/servers/java/jboss-4.0.5.GA
                JBOSS_HOME=/home/servers/java/jboss-4.0.5.GA-src/build/output/jboss-4.0.5.GA
                #ANT1.6
                ANT_HOME=/home/servers/java/apache-ant-1.6.0
                PATH=/home/servers/java/apache-ant-1.6.0/bin:$PATH
                #ANT
                #ANT_HOME=/home/servers/java/apache-ant-1.7.0
                #PATH=/home/servers/java/apache-ant-1.7.0/bin:$PATH
                #J2EE
                #CLASSPATH=/home/servers/java/j2ee.jar:$CLASSPATH
                export PATH USER LOGNAME MAIL HOSTNAME HISTSIZE INPUTRC PGPORT LD_LIBRARY_PATH PATH MANPATH CLASSPATH JAVA_HOME JBOSS_HOME ANT_HOME

                i need help to resolve this error: is:
                09:08:23,438 INFO [ProxyFactory] Bound EJB Home 'test/MyTestSession' to jndi 'ejb/test/MyTestSessionBean'
                09:08:23,482 INFO [EJBDeployer] Deployed: file:/home/servers/java/jboss-4.0.5.GA-src/build/output/jboss-4.0.5.GA/server/default/tmp/deploy/tmp2627example3.ear-contents/example3.jar
                09:08:23,900 INFO [TomcatDeployer] deploy, ctxPath=/example3, warUrl=.../tmp/deploy/tmp2627example3.ear-contents/example3-exp.war/
                09:08:24,708 ERROR [STDERR] java.lang.ClassCastException
                09:08:24,746 ERROR [STDERR] at com.sun.corba.se.impl.javax.rmi.PortableRemoteObject.narrow(PortableRemoteObject.java:229)
                09:08:24,747 ERROR [STDERR] at javax.rmi.PortableRemoteObject.narrow(PortableRemoteObject.java:137)
                09:08:24,748 ERROR [STDERR] at test.session.SessionTestServlet.init(SessionTestServlet.java:29)
                09:08:24,789 ERROR [STDERR] at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1105)
                09:08:24,790 ERROR [STDERR] at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:932)
                09:08:24,827 ERROR [STDERR] at org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:3951)
                09:08:24,828 ERROR [STDERR] at org.apache.catalina.core.StandardContext.start(StandardContext.java:4225)
                09:08:24,865 ERROR [STDERR] at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:759)

                • 5. Re: Jboss install
                  peterj

                  Please post test.session.SessionTestServlet.init() and highlight line 29.

                  • 6. Re: Jboss install
                    jgayathri

                    /*

                    * SessionTestServlet.java

                    *

                    */



                    package test.session;



                    import javax.servlet.*;

                    import javax.servlet.http.*;

                    import java.io.*;

                    import javax.naming.*;

                    import javax.rmi.PortableRemoteObject;





                    /**

                    * @author Deepak Kumar

                    * @Web http://www.roseindia.net

                    * @Email deepak@roseindia.net

                    */



                    public class SessionTestServlet extends HttpServlet {

                    MyTestSessionHome testSessionBean;



                    public void init(ServletConfig config) throws ServletException{

                    //Look up home interface

                    try {

                    InitialContext ctx = new InitialContext();

                    Object objref = ctx.lookup("ejb/test/MyTestSessionBean");

                    testSessionBean = (MyTestSessionHome)PortableRemoteObject.narrow(objref, MyTestSessionHome.class);

                    } catch (Exception NamingException) {

                    NamingException.printStackTrace();

                    }





                    }



                    public void doGet (HttpServletRequest request,

                    HttpServletResponse response)

                    throws ServletException, IOException

                    {



                    PrintWriter out;

                    response.setContentType("text/html");

                    String title = "EJB Example";

                    out = response.getWriter();



                    out.println("");

                    out.println("");

                    out.println("Hello World Servlet!");

                    out.println("");

                    out.println("");

                    out.println("<p align=\"center\"><font size=\"4\" color=\"#000080\">Servlet Calling Session Bean");





                    try{

                    MyTestSession beanRemote;

                    beanRemote = testSessionBean.create();

                    out.println("<p align=\"center\"> Message from Session Bean is: " + beanRemote.SayHello() + "");

                    beanRemote.remove();

                    }catch(Exception CreateException){

                    CreateException.printStackTrace();

                    }

                    out.println("<p align=\"center\"><a href=\"javascript:history.back()\">Go to Home");

                    out.println("");

                    out.println("");





                    out.close();

                    }



                    public void destroy() {

                    System.out.println("Destroy");

                    }

                    }





                    deployment des:
                    <ejb-jar>



                    Example 3

                    <display-name>Example 3</display-name>



                    <enterprise-beans>



                    <!-- Session Beans -->



                    <display-name>My Test Session Bean</display-name>

                    <ejb-name>test/MyTestSession</ejb-name>

                    test.session.MyTestSessionHome

                    test.session.MyTestSession

                    <ejb-class>test.session.MyTestSessionBean</ejb-class>

                    <session-type>Stateless</session-type>

                    <transaction-type>Container</transaction-type>





                    </enterprise-beans>



                    <assembly-descriptor>



                    </assembly-descriptor>



                    </ejb-jar>

                    jboss.xml:


                    <enterprise-beans>


                    <ejb-name>test/MyTestSession</ejb-name>
                    <jndi-name>ejb/test/MyTestSessionBean</jndi-name>


                    </enterprise-beans>

                    <resource-managers>
                    </resource-managers>



                    • 7. Re: Jboss install
                      jgayathri

                      I have found the problem. i don't know how to resolve it.

                      The JDK which i have installed is jdk1.0.5_11
                      In this rt.jar has 2 Portable object classes at
                      1.at com.sun.corba.se.impl.javax.rmi.PortableRemot eobject.narrow(PortableRemoteObject.java:229)
                      2.at javax.rmi.PortableRemoteObject.narrow(Portabl eRemoteObject.java:137)

                      That is y when i copy the bean it was giving this exception. i need soln for this

                      • 8. Re: Jboss install
                        peterj

                        That is not the problem. You are using the second PortableRemoteObject class, look at the import statement.

                        First, a suggestion. When posting code, bracket it with the [ code ] [ /code ] tags (without the spaces). You can do this easily by selecting the code and clicking the Code button.

                        Is MyTestSessionHome an interface or a class? It should be the interface if it is not.

                        The other thing to do is use the jmx-console to list the JNDI names. Use the list() method on the jboss:service=JNDIView mbean. This will list out all of the names, look up the name you are interested in.

                        Are you using EJB3? If so, you might want to try the name "ejb/test/MyTestSessionBean/remote".

                        Finally, if the EJB is running in the same app server you could always look up the local interface, in which case you don't need the PortableRemoteObject call.

                        • 9. classcast exception
                          jgayathri

                          When i deploy a session bean in JBoss, while deploying i got classcast exception . When i am looking thro ctxlook up, it is always returing the object ref as JNDI name+Home. why this error is coming? i need help.
                          servlet code

                          code:
                          
                          try {
                          
                           InitialContext ctx = new InitialContext();
                          System.out.println("aaaaaaaaaa");
                          
                           Object objref = ctx.lookup("ejb/test/MyTestSessionBean/remote");
                          //testSessionBean = (MyTestSessionHome)ctx.lookup("test.session.MyTestSessionBean.class.getName());
                          //testSessionBean = (MyTestSessionHome)ctx.lookup("test/session/MyTestSessionBean");
                          System.out.println("bbbbbbbbb"+objref);
                          
                           testSessionBean = (MyTestSessionHome)PortableRemoteObject.narrow(objref, MyTestSessionHome.class);
                          System.out.println("ccccccccc");
                          
                           } catch (Exception NamingException) {
                          
                           NamingException.printStackTrace();




                          THis is the output in Jboss:

                          393 INFO [STDOUT] bbbbbbbbbejb/test/MyTestSessionBean/remoteHome
                          11:43:38,408 ERROR [STDERR] java.lang.ClassCastException
                          11:43:38,413 ERROR [STDERR] at com.sun.corba.se.internal.javax.rmi.PortableRemoteObject.narrow(PortableRemoteObject.java:293)


                          If the code is like this in the lookup:
                          Object objref = ctx.lookup("ejb/test/MyTestSessionBean");


                          It returns objref like this:MyTestSessionBeanHome - This class does not exist.
                          I need help.

                          • 10. Re: classcast exception
                            fushion

                            You don't need the narrowing anymore. use this code instead:

                             InitialContext ctx = new InitialContext();
                             MyTestSession testSession = (MyTestSession)ctx.lookup("ejb/test/MyTestSessionBean/remote");
                            


                            That's all!!!


                            • 11. Re: Jboss install
                              sheilalety

                              This is for windows, how can i install on redhat entreprise edition?