4 Replies Latest reply on Jan 8, 2013 1:29 PM by fabiovc27 Branched from an earlier discussion.

    ClassCastException: SingleOption cannot be cast to Option

    fabiovc27

      Hello Sebastian, did you ever figure out how to fix this issue?
      I'm also seeing the SingleOption cannot be cast into Option error when attempting EJB calls from JBoss 7 to JBoss 7.

       

      All other EJB Calls seem to work fine.

        • 1. Re: ClassCastException: SingleOption cannot be cast to Option
          jaikiran

          (Branched to a separate topic)

           

          Please provide more details including the entire excpetion stacktrace, the exact JBoss AS7 versions, the relevant configuration details and the application details.

          • 2. Re: ClassCastException: SingleOption cannot be cast to Option
            sebbay

            Hello Valentino,

             

            I added the following dependencies in deployment-structure.xml:

            <dependencies>

              <module name="org.jboss.xnio" />

              <module name="org.jboss.remote-naming" />

              <module name="org.jboss.ejb-client" />

            </dependencies>

             

            Have a look at this: https://docs.jboss.org/author/display/AS71/EJB+invocations+from+a+remote+server+instance to see the correct handling.

             

            @Jaikirian:

            I still have the problem, that I can not make remote EJB lookup's from different EAR's on the same JBoss instance (as descriped in this discussion: https://community.jboss.org/message/743386).

            Is there a solution for this 'problem' or will it not be solved?

             

            Regards,

            Sebastian

            • 3. Re: ClassCastException: SingleOption cannot be cast to Option
              ctomc

              Hi,

               

              how does structure of your application look like?

               

              can just post output of jar tf <name-of-your-deployment>

               

               

               

              --

              tomaz

              • 4. Re: ClassCastException: SingleOption cannot be cast to Option
                fabiovc27

                Hello Sebastian, thanx for replying!

                 

                I actually got passed my issue.   I also have 2 JB7 standalone servers running in the same JB7 distribution...  and I used to have this :

                              

                             Properties clientProp = new Properties();

                             clientProp.put("remote.connectionprovider.create.options.org.xnio.Options.SSL_ENABLED", "false");

                                  clientProp.put("remote.connections", "default");

                                  clientProp.put("remote.connection.default.port", JbossConfigurator.getJmxRmiPort()+"");

                                  clientProp.put("remote.connection.default.host", "localhost");

                                  clientProp.put("remote.connection.default.connect.options.org.xnio.Options.SASL_POLICY_NOANONYMOUS", "false");

                 

                                  EJBClientConfiguration cc = new PropertiesBasedEJBClientConfiguration(clientProp);

                                  ContextSelector<EJBClientContext> selector = new ConfigBasedEJBClientContextSelector(cc);

                                  EJBClientContext.setSelector(selector);

                 

                                  Properties props = new Properties();

                                  props.put(Context.URL_PKG_PREFIXES, "org.jboss.ejb.client.naming");

                                  Context ctx = new InitialContext(props);

                 

                and it would give me the "SingleOption cannot be cast into Option error" when I would attempt EJB calls to the destination from within another EJB in the other JB7.

                 

                I went back to this instead :

                 

                        Properties props = new Properties();

                                  props.put(Context.URL_PKG_PREFIXES, "org.jboss.ejb.client.naming");

                                  Context ctx = new InitialContext(props);

                 

                and it works.   However, this broke my other type of EJB calls which come from python and uses a java wrapper (ie. purely external client non Jboss 7).   The way I was able to fix that was by adding the jboss-ejb-client.properties file.     Both paths now go through the single property context setup (immediately above).  But the first scenario (ie EJB - EJB b/w 2 JBoss 7 standalones in the same distro) complements its information from the standalone.xmls and the jboss-ejb-client.xml.    While the 2nd scenario (external client non JBoss 7) uses the properties file and the same context.

                 

                PS: I did not have to use a deployment-structure.xml.

                 

                Hope that helps.

                -Valentino