9 Replies Latest reply on Jan 3, 2007 5:15 PM by Norman Richards

    Packaging question

    Vince Tux Newbie

      Hello,

      I have a question regarding the packaging (not very sure if I am on the right forum ;-))

      I have a EAR with severals EJB's (Sessions and Entities) + WebApplication. On the other hand, I have a brand new seam application that need to access EJB contained in the first EAR.

      How can I package my seam application to access the ejb's contained in the other ear ? (I want to avoid changing the existing EAR).

      Thanks for your advices.

        • 1. Re: Packaging question
          Norman Richards Master

          Seam doesn't have a notion of an external component yet. You'll have to rely on normal lookup methods (JNDI or EJB3 injection) to grab them.

          • 2. Re: Packaging question
            John Blackmore Newbie

            I need to do the same thing, but I'm having problems doing the latter, i.e. JNDI lookup method.

            I have an EJB3 app in one ear, and a new Seam app in the second. I need to access an EJB in the first ear, but I'm getting ClassCastExceptions. Here are the EAR structures:

            app1.ear
             +-- META-INF/application.xml
             +-- lib
             - app1-client.jar
             - app1-lib.jar
             - app1-persistence.jar
             - app1-util.jar
             - app1-ejb3.jar
            


            app2.ear
             +-- META-INF
             - application.xml
             - jboss-app.xml
             +-- app2.war
             - META-INF/Manifest.mf
             +-- WEB-INF
             +-- lib
             - app1-lib.jar
             - icefaces*.jar
             - jboss-seam-ui.jar
             - jboss-seam-debug.jar
             - jsf-facelets.jar
             - oscache-2.3.2.jar
             - components.xml
             - faces-config.xml
             - navigation.xml
             - pages.xml
             - web.xml
             - app2.jar
             - app1-client.jar
             - app1-lib.jar
             - app1-util.jar
             - el-api.jar
             - el-ri.jar
             - jboss-seam.jar
            


            I'm trying to do what I think is a simple JNDI lookup of an EJB in app1.ear.
            private Project getProjectBean() throws Exception
            {
             Project p;
             Context ctx = new InitialContext();
             ctx.addToEnvironment("java.naming.factory.initial","org.jnp.interfaces.NamingContextFactory");
             ctx.addToEnvironment("java.naming.factory.url.pkgs","org.jboss.naming:org.jnp.interfaces");
             ctx.addToEnvironment(Context.PROVIDER_URL, "jnp://localhost:1099");
             Project proj=null;
             String jndiName = ClientStub.EJB_JNDI_PREFIX_PROJECT+"local";
             try {
             logger.info("Looking up "+jndiName+".");
             proj = (Project) ctx.lookup(jndiName);
             } catch (NamingException e) {
             e.printStackTrace();
             }
             return proj;
            }
            


            I'm getting the following ClassCastException, but I can't figure out where $Proxy1357 is coming from. It doesn't show up in my JNDI list() through the JMX console.

            16:07:16,375 ERROR [STDERR] java.lang.ClassCastException: $Proxy1357
            16:07:16,375 ERROR [STDERR] at org.ets.crater.alchemist.ejb.RepositoryBean.getProjectBean(Unknown Source)
            16:07:16,375 ERROR [STDERR] at org.ets.crater.alchemist.ejb.RepositoryBean.findItemDisplayRecords(Unknown Source)
            16:07:16,375 ERROR [STDERR] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
            16:07:16,375 ERROR [STDERR] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
            16:07:16,375 ERROR [STDERR] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
            16:07:16,375 ERROR [STDERR] at java.lang.reflect.Method.invoke(Method.java:585)
            16:07:16,375 ERROR [STDERR] at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:112)
            16:07:16,375 ERROR [STDERR] at org.jboss.ejb3.interceptor.InvocationContextImpl.proceed(InvocationContextImpl.java:166)
            16:07:16,375 ERROR [STDERR] at org.jboss.seam.intercept.EJBInvocationContext.proceed(EJBInvocationContext.java:37)
            16:07:16,375 ERROR [STDERR] at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:55)
            16:07:16,375 ERROR [STDERR] at org.jboss.seam.interceptors.BijectionInterceptor.bijectTargetComponent(BijectionInterceptor.java:51)
            16:07:16,375 ERROR [STDERR] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
            16:07:16,375 ERROR [STDERR] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
            16:07:16,375 ERROR [STDERR] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
            16:07:16,375 ERROR [STDERR] at java.lang.reflect.Method.invoke(Method.java:585)
            16:07:16,375 ERROR [STDERR] at org.jboss.seam.util.Reflections.invoke(Reflections.java:18)
            16:07:16,375 ERROR [STDERR] at org.jboss.seam.intercept.Interceptor.aroundInvoke(Interceptor.java:171)
            16:07:16,375 ERROR [STDERR] at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:64)
            16:07:16,375 ERROR [STDERR] at org.jboss.seam.interceptors.OutcomeInterceptor.interceptOutcome(OutcomeInterceptor.java:23)
            16:07:16,375 ERROR [STDERR] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
            16:07:16,375 ERROR [STDERR] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
            16:07:16,375 ERROR [STDERR] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
            16:07:16,375 ERROR [STDERR] at java.lang.reflect.Method.invoke(Method.java:585)
            16:07:16,375 ERROR [STDERR] at org.jboss.seam.util.Reflections.invoke(Reflections.java:18)
            16:07:16,375 ERROR [STDERR] at org.jboss.seam.intercept.Interceptor.aroundInvoke(Interceptor.java:171)
            16:07:16,375 ERROR [STDERR] at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:64)
            16:07:16,375 ERROR [STDERR] at org.jboss.seam.interceptors.ConversationInterceptor.endOrBeginLongRunningConversation(ConversationInterceptor.java:51)
            16:07:16,375 ERROR [STDERR] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
            16:07:16,375 ERROR [STDERR] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
            16:07:16,375 ERROR [STDERR] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
            16:07:16,375 ERROR [STDERR] at java.lang.reflect.Method.invoke(Method.java:585)
            16:07:16,375 ERROR [STDERR] at org.jboss.seam.util.Reflections.invoke(Reflections.java:18)
            16:07:16,375 ERROR [STDERR] at org.jboss.seam.intercept.Interceptor.aroundInvoke(Interceptor.java:171)
            16:07:16,375 ERROR [STDERR] at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:64)
            16:07:16,375 ERROR [STDERR] at org.ets.crater.alchemist.interceptors.LoggedInInterceptor.checkLoggedIn(Unknown Source)
            16:07:16,375 ERROR [STDERR] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
            16:07:16,375 ERROR [STDERR] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
            16:07:16,375 ERROR [STDERR] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
            16:07:16,375 ERROR [STDERR] at java.lang.reflect.Method.invoke(Method.java:585)
            16:07:16,375 ERROR [STDERR] at org.jboss.seam.util.Reflections.invoke(Reflections.java:18)
            16:07:16,375 ERROR [STDERR] at org.jboss.seam.intercept.Interceptor.aroundInvoke(Interceptor.java:171)
            16:07:16,375 ERROR [STDERR] at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:64)
            16:07:16,375 ERROR [STDERR] at org.jboss.seam.interceptors.ManagedEntityIdentityInterceptor.aroundInvoke(ManagedEntityIdentityInterceptor.java:39)
            16:07:16,375 ERROR [STDERR] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
            16:07:16,375 ERROR [STDERR] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
            16:07:16,375 ERROR [STDERR] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
            16:07:16,375 ERROR [STDERR] at java.lang.reflect.Method.invoke(Method.java:585)
            16:07:16,375 ERROR [STDERR] at org.jboss.seam.util.Reflections.invoke(Reflections.java:18)
            16:07:16,375 ERROR [STDERR] at org.jboss.seam.intercept.Interceptor.aroundInvoke(Interceptor.java:171)
            16:07:16,375 ERROR [STDERR] at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:64)
            16:07:16,375 ERROR [STDERR] at org.jboss.seam.intercept.RootInterceptor.createSeamInvocationContext(RootInterceptor.java:144)
            16:07:16,375 ERROR [STDERR] at org.jboss.seam.intercept.RootInterceptor.invokeInContexts(RootInterceptor.java:129)
            16:07:16,375 ERROR [STDERR] at org.jboss.seam.intercept.RootInterceptor.invoke(RootInterceptor.java:102)
            16:07:16,375 ERROR [STDERR] at org.jboss.seam.intercept.SessionBeanInterceptor.aroundInvoke(SessionBeanInterceptor.java:49)
            16:07:16,375 ERROR [STDERR] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
            16:07:16,375 ERROR [STDERR] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
            16:07:16,375 ERROR [STDERR] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
            16:07:16,375 ERROR [STDERR] at java.lang.reflect.Method.invoke(Method.java:585)
            16:07:16,375 ERROR [STDERR] at org.jboss.ejb3.interceptor.InvocationContextImpl.proceed(InvocationContextImpl.java:118)
            16:07:16,375 ERROR [STDERR] at org.jboss.ejb3.interceptor.EJB3InterceptorsInterceptor.invoke(EJB3InterceptorsInterceptor.java:63)
            16:07:16,375 ERROR [STDERR] at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
            16:07:16,375 ERROR [STDERR] at org.jboss.ejb3.entity.ExtendedPersistenceContextPropagationInterceptor.invoke(ExtendedPersistenceContextPropagationInterceptor.java:57)
            16:07:16,375 ERROR [STDERR] at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
            16:07:16,375 ERROR [STDERR] at org.jboss.ejb3.entity.TransactionScopedEntityManagerInterceptor.invoke(TransactionScopedEntityManagerInterceptor.java:54)
            16:07:16,375 ERROR [STDERR] at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
            16:07:16,375 ERROR [STDERR] at org.jboss.ejb3.AllowedOperationsInterceptor.invoke(AllowedOperationsInterceptor.java:47)
            16:07:16,375 ERROR [STDERR] at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
            16:07:16,375 ERROR [STDERR] at org.jboss.aspects.tx.TxPolicy.invokeInOurTx(TxPolicy.java:79)
            16:07:16,375 ERROR [STDERR] at org.jboss.aspects.tx.TxInterceptor$Required.invoke(TxInterceptor.java:197)
            16:07:16,375 ERROR [STDERR] at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
            16:07:16,375 ERROR [STDERR] at org.jboss.aspects.tx.TxPropagationInterceptor.invoke(TxPropagationInterceptor.java:76)
            16:07:16,375 ERROR [STDERR] at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
            16:07:16,375 ERROR [STDERR] at org.jboss.ejb3.stateful.StatefulInstanceInterceptor.invoke(StatefulInstanceInterceptor.java:83)
            16:07:16,375 ERROR [STDERR] at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
            16:07:16,375 ERROR [STDERR] at org.jboss.aspects.security.AuthenticationInterceptor.invoke(AuthenticationInterceptor.java:77)
            16:07:16,375 ERROR [STDERR] at org.jboss.ejb3.security.Ejb3AuthenticationInterceptor.invoke(Ejb3AuthenticationInterceptor.java:131)
            16:07:16,375 ERROR [STDERR] at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
            16:07:16,375 ERROR [STDERR] at org.jboss.ejb3.ENCPropagationInterceptor.invoke(ENCPropagationInterceptor.java:47)
            16:07:16,375 ERROR [STDERR] at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
            16:07:16,375 ERROR [STDERR] at org.jboss.ejb3.asynchronous.AsynchronousInterceptor.invoke(AsynchronousInterceptor.java:106)
            16:07:16,375 ERROR [STDERR] at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
            16:07:16,375 ERROR [STDERR] at org.jboss.ejb3.stateful.StatefulContainer.localInvoke(StatefulContainer.java:203)
            16:07:16,375 ERROR [STDERR] at org.jboss.ejb3.stateful.StatefulLocalProxy.invoke(StatefulLocalProxy.java:98)
            16:07:16,375 ERROR [STDERR] at $Proxy1342.findItemDisplayRecords(Unknown Source)
            16:07:16,375 ERROR [STDERR] at org.ets.crater.alchemist.interfaces.Repository$$FastClassByCGLIB$$f156d997.invoke(<generated>)
            16:07:16,375 ERROR [STDERR] at net.sf.cglib.proxy.MethodProxy.invoke(MethodProxy.java:149)
            16:07:16,375 ERROR [STDERR] at org.jboss.seam.intercept.RootInvocationContext.proceed(RootInvocationContext.java:45)
            16:07:16,375 ERROR [STDERR] at org.jboss.seam.intercept.ClientSideInterceptor$1.proceed(ClientSideInterceptor.java:73)
            16:07:16,375 ERROR [STDERR] at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:55)
            16:07:16,375 ERROR [STDERR] at org.jboss.seam.interceptors.RemoveInterceptor.removeIfNecessary(RemoveInterceptor.java:39)
            16:07:16,375 ERROR [STDERR] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
            16:07:16,375 ERROR [STDERR] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
            16:07:16,375 ERROR [STDERR] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
            16:07:16,375 ERROR [STDERR] at java.lang.reflect.Method.invoke(Method.java:585)
            16:07:16,375 ERROR [STDERR] at org.jboss.seam.util.Reflections.invoke(Reflections.java:18)
            16:07:16,375 ERROR [STDERR] at org.jboss.seam.intercept.Interceptor.aroundInvoke(Interceptor.java:171)
            16:07:16,375 ERROR [STDERR] at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:64)
            16:07:16,375 ERROR [STDERR] at org.jboss.seam.interceptors.ExceptionInterceptor.handleExceptions(ExceptionInterceptor.java:38)
            16:07:16,375 ERROR [STDERR] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
            16:07:16,375 ERROR [STDERR] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
            16:07:16,375 ERROR [STDERR] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
            16:07:16,375 ERROR [STDERR] at java.lang.reflect.Method.invoke(Method.java:585)
            16:07:16,375 ERROR [STDERR] at org.jboss.seam.util.Reflections.invoke(Reflections.java:18)
            16:07:16,375 ERROR [STDERR] at org.jboss.seam.intercept.Interceptor.aroundInvoke(Interceptor.java:171)
            16:07:16,375 ERROR [STDERR] at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:64)
            16:07:16,375 ERROR [STDERR] at org.jboss.seam.intercept.RootInterceptor.createSeamInvocationContext(RootInterceptor.java:144)
            16:07:16,375 ERROR [STDERR] at org.jboss.seam.intercept.RootInterceptor.invokeInContexts(RootInterceptor.java:129)
            16:07:16,375 ERROR [STDERR] at org.jboss.seam.intercept.RootInterceptor.invoke(RootInterceptor.java:102)
            16:07:16,375 ERROR [STDERR] at org.jboss.seam.intercept.ClientSideInterceptor.interceptInvocation(ClientSideInterceptor.java:82)
            16:07:16,375 ERROR [STDERR] at org.jboss.seam.intercept.ClientSideInterceptor.intercept(ClientSideInterceptor.java:51)
            16:07:16,375 ERROR [STDERR] at org.jboss.seam.intercept.Proxy$$EnhancerByCGLIB$$6c6a0ca1.findItemDisplayRecords(<generated>)
            16:07:16,375 ERROR [STDERR] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
            16:07:16,375 ERROR [STDERR] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
            16:07:16,375 ERROR [STDERR] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
            16:07:16,375 ERROR [STDERR] at java.lang.reflect.Method.invoke(Method.java:585)
            16:07:16,375 ERROR [STDERR] at org.apache.myfaces.el.MethodBindingImpl.invoke(MethodBindingImpl.java:129)
            16:07:16,375 ERROR [STDERR] at org.jboss.seam.actionparam.ActionParamBindingHelper.invokeTheExpression(ActionParamBindingHelper.java:59)
            16:07:16,375 ERROR [STDERR] at org.jboss.seam.actionparam.ActionParamMethodBinding.invoke(ActionParamMethodBinding.java:71)
            16:07:16,375 ERROR [STDERR] at org.jboss.seam.actionparam.ActionParamBindingHelper.invokeTheExpression(ActionParamBindingHelper.java:59)
            16:07:16,375 ERROR [STDERR] at org.jboss.seam.actionparam.ActionParamMethodBinding.invoke(ActionParamMethodBinding.java:71)
            16:07:16,375 ERROR [STDERR] at org.jboss.seam.core.Expressions$2.invoke(Expressions.java:98)
            16:07:16,375 ERROR [STDERR] at org.jboss.seam.core.Pages.callAction(Pages.java:343)
            16:07:16,375 ERROR [STDERR] at org.jboss.seam.core.Pages.callActions(Pages.java:322)
            16:07:16,375 ERROR [STDERR] at org.jboss.seam.jsf.AbstractSeamPhaseListener.callPageActions(AbstractSeamPhaseListener.java:254)
            16:07:16,375 ERROR [STDERR] at org.jboss.seam.jsf.AbstractSeamPhaseListener.beforeRender(AbstractSeamPhaseListener.java:201)
            16:07:16,375 ERROR [STDERR] at org.jboss.seam.jsf.SeamPhaseListener.beforePhase(SeamPhaseListener.java:51)
            16:07:16,375 ERROR [STDERR] at org.apache.myfaces.lifecycle.PhaseListenerManager.informPhaseListenersBefore(PhaseListenerManager.java:70)
            16:07:16,375 ERROR [STDERR] at org.apache.myfaces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:373)
            16:07:16,375 ERROR [STDERR] at com.icesoft.faces.webapp.xmlhttp.PersistentFacesServlet.service(PersistentFacesServlet.java:394)
            16:07:16,375 ERROR [STDERR] at javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
            16:07:16,375 ERROR [STDERR] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
            16:07:16,375 ERROR [STDERR] at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
            16:07:16,375 ERROR [STDERR] at org.jboss.seam.servlet.SeamExceptionFilter.doFilter(SeamExceptionFilter.java:46)
            16:07:16,375 ERROR [STDERR] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
            16:07:16,375 ERROR [STDERR] at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
            16:07:16,375 ERROR [STDERR] at org.jboss.seam.servlet.SeamRedirectFilter.doFilter(SeamRedirectFilter.java:32)
            16:07:16,375 ERROR [STDERR] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
            16:07:16,375 ERROR [STDERR] at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
            16:07:16,375 ERROR [STDERR] at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
            16:07:16,375 ERROR [STDERR] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
            16:07:16,375 ERROR [STDERR] at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
            16:07:16,375 ERROR [STDERR] at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
            16:07:16,375 ERROR [STDERR] at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
            16:07:16,375 ERROR [STDERR] at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:175)
            16:07:16,375 ERROR [STDERR] at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:74)
            16:07:16,375 ERROR [STDERR] at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
            16:07:16,375 ERROR [STDERR] at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
            16:07:16,375 ERROR [STDERR] at org.jboss.web.tomcat.tc5.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:156)
            16:07:16,375 ERROR [STDERR] at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
            16:07:16,375 ERROR [STDERR] at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
            16:07:16,375 ERROR [STDERR] at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:869)
            16:07:16,375 ERROR [STDERR] at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:664)
            16:07:16,375 ERROR [STDERR] at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
            16:07:16,375 ERROR [STDERR] at org.apache.tomcat.util.net.MasterSlaveWorkerThread.run(MasterSlaveWorkerThread.java:112)
            16:07:16,375 ERROR [STDERR] at java.lang.Thread.run(Thread.java:595)
            


            Am I doing something wrong?

            Thanks,

            • 3. Re: Packaging question
              John Blackmore Newbie

              Couple details I forgot...

              1) JBoss seam 1.1 GA
              2) JBoss AS 4.0.5 GA (ejb3 config)
              3) ICEFaces (as shipped w/ Seam)
              4) JBoss Cache 1.3
              5) Windoze XP

              I also tried EJB injection, with similar results.

              • 4. Re: Packaging question
                Norman Richards Master

                It looks to me like you have the Project.class in both EAR files. JBoss is giving you an instance of Project that has a class definition loaded from a different classloader than the Project you are trying to cast to. My first suggestion for fixing that would be to not bundle any of the app1-*.*ar archives in app2. (be careful to make sure app1 deploys before app2)

                That *should* solve the problem. Assuming it does, then we can talk about other ways to package your apps if you want to do something different.

                • 5. Re: Packaging question
                  John Blackmore Newbie

                  I could swear I started that way! Alas, it works like a charm, even with EJB injection.

                  I'm very happy with this method of packaging. I'm even able to add Seam annotations to the entities in app1.ear in the component.xml of app2.war, so app1.ear still has no dependencies on Seam. Perfect!

                  Many thanks,

                  • 6. Re: Packaging question
                    John Blackmore Newbie

                     

                    (be careful to make sure app1 deploys before app2)


                    The best/only way I found to enforce the specific EAR deployment order upon JBoss AS startup was to implement my own DeploymentSorter, similar to PrefixDeploymentSorter:

                    public class MyDeploymentSorter extends DeploymentSorter implements Comparator
                    {
                     ...
                     public int compare(Object o1, Object o2) {
                    
                     URL url1=(URL) o1;
                     URL url2=(URL) o2;
                    
                     if( (url1.toString()).contains("app1.ear") && (url2.toString()).contains("app2.ear") ) {
                     return -1;
                     }
                     if( (url2.toString()).contains("app1.ear") && (url1.toString()).contains("app2.ear") ) {
                     return 1;
                     }
                     return super.compare(url1, url2);
                     }
                    }
                    


                    Then, obviously, I configure conf/jboss-service.xml to use my deployment sorter:
                    <attribute name="URLComparator">org.fqn.MyDeploymentSorter</attribute>
                    


                    Is there another way to do this? I burned up some hours on this, mainly because I couldn't let go of the expectation that deployment ordering should be automatic if there are dependencies (e.g., app2.ear contains an EJB that depends on an EJB in app1.ear), OR that there must be some way to specify deployment ordering in a deployment descriptor. Unless I've missed something, there isn't, but MyDeploymentSorter does what I want. Sorry if I'm getting off-topic.

                    Cheers,

                    • 7. Re: Packaging question
                      Norman Richards Master

                      If you are flexible with your naming, PrefixDeploymentSorter (see http://www.jboss.org/wiki/Wiki.jsp?page=URLComparator) seems to work pretty well. Did it not work well for you?

                      • 8. Re: Packaging question
                        John Blackmore Newbie

                        I'm sure it would work as expected, I just don't want to be flexible with naming. :-) Sorry, I should have said that from the start.

                        Is there anything wrong with MyDeploymentSorter approach?

                        Thanks,

                        • 9. Re: Packaging question
                          Norman Richards Master

                          Nope - other than being kind of inflexible when you want to deploy app3.ear.