6 Replies Latest reply on May 19, 2016 3:24 PM by caarlos0

    Migrating from jboss as to wildfly

    caarlos0

      Hi, I'm migrating from jboss as 6 to wildfly 9.0.2.

       

      I changed the standalone.xml to add our datasources, email configuration and security (jaas). The rest is basically the defaults.

       

      I changed my app to use the new naming for jaas (without java:jaas/).

       

      But, when I deploy my app, I get the following error:

       

      16:58:57,777 INFO  [org.jboss.weld.deployer] (MSC service thread 1-1) WFLYWELD0006: Starting Services for CDI deployment: foo-app.ear

      16:58:57,868 INFO  [org.jboss.weld.Version] (MSC service thread 1-1) WELD-000900: 2.2.16 (SP1)

      16:58:58,012 INFO  [org.jboss.weld.deployer] (MSC service thread 1-3) WFLYWELD0009: Starting weld service for deployment foo-app.ear

      16:58:58,221 INFO  [org.wildfly.extension.undertow] (MSC service thread 1-8) WFLYUT0018: Host default-host starting

      16:58:59,737 INFO  [org.jboss.as.jpa] (ServerService Thread Pool -- 60) WFLYJPA0010: Starting Persistence Unit (phase 2 of 2) Service 'foo-app.ear#Admin'

      16:58:59,737 INFO  [org.jboss.as.jpa] (ServerService Thread Pool -- 59) WFLYJPA0010: Starting Persistence Unit (phase 2 of 2) Service 'foo-app.ear#ReadOnly'

      16:58:59,915 INFO  [org.hibernate.annotations.common.Version] (ServerService Thread Pool -- 59) HCANN000001: Hibernate Commons Annotations {4.0.5.Final}

      16:59:01,847 INFO  [org.hibernate.dialect.Dialect] (ServerService Thread Pool -- 59) HHH000400: Using dialect: com.foo.dialect.CADialect

      16:59:01,865 INFO  [org.hibernate.engine.jdbc.internal.LobCreatorBuilder] (ServerService Thread Pool -- 59) HHH000424: Disabling contextual LOB creation as createClob() method threw error : java.lang.reflect.InvocationTargetException

      16:59:01,944 INFO  [org.hibernate.dialect.Dialect] (ServerService Thread Pool -- 60) HHH000400: Using dialect: com.foo.dialect.CADialect

      16:59:01,946 INFO  [org.hibernate.engine.jdbc.internal.LobCreatorBuilder] (ServerService Thread Pool -- 60) HHH000424: Disabling contextual LOB creation as createClob() method threw error : java.lang.reflect.InvocationTargetException

      16:59:03,752 INFO  [org.hibernate.hql.internal.ast.ASTQueryTranslatorFactory] (ServerService Thread Pool -- 60) HHH000397: Using ASTQueryTranslatorFactory

      16:59:03,758 INFO  [org.hibernate.hql.internal.ast.ASTQueryTranslatorFactory] (ServerService Thread Pool -- 59) HHH000397: Using ASTQueryTranslatorFactory

      16:59:03,762 WARN  [org.hibernate.cfg.SettingsFactory] (ServerService Thread Pool -- 60) Unrecognized value for "hibernate.hbm2ddl.auto": none

      16:59:03,763 WARN  [org.hibernate.cfg.SettingsFactory] (ServerService Thread Pool -- 59) Unrecognized value for "hibernate.hbm2ddl.auto": none

      16:59:09,658 INFO  [org.hibernate.tuple.PojoInstantiator] (ServerService Thread Pool -- 59) HHH000182: No default (no-argument) constructor for class: com.foo.entity.MotivoBaixa (class must be instantiated by Interceptor)

      16:59:09,659 INFO  [org.hibernate.tuple.PojoInstantiator] (ServerService Thread Pool -- 60) HHH000182: No default (no-argument) constructor for class: com.foo.entity.MotivoBaixa (class must be instantiated by Interceptor)

      16:59:10,639 INFO  [org.hibernate.tuple.PojoInstantiator] (ServerService Thread Pool -- 59) HHH000182: No default (no-argument) constructor for class: com.foo.invoice.ServiceInvoiceMessage (class must be instantiated by Interceptor)

      16:59:10,640 INFO  [org.hibernate.tuple.PojoInstantiator] (ServerService Thread Pool -- 60) HHH000182: No default (no-argument) constructor for class: com.foo.invoice.ServiceInvoiceMessage (class must be instantiated by Interceptor)

      16:59:18,224 WARN  [org.jboss.weld.Bootstrap] (weld-worker-1) WELD-001125: Illegal bean type com.foo.service.ListFilter<com.foo.negotiation.entity.Negotiation<?, ?>> ignored on [EnhancedAnnotatedTypeImpl] public  class com.foo.negotiation.NegotiationFilter

      16:59:18,236 WARN  [org.jboss.weld.Bootstrap] (weld-worker-1) WELD-001125: Illegal bean type com.foo.service.ListFilter<com.foo.negotiation.entity.Negotiation<?, ?>> ignored on [EnhancedAnnotatedTypeImpl] public  class com.foo.negotiation.statement.NegotiationStatementFilter

      16:59:23,125 ERROR [org.jboss.msc.service.fail] (MSC service thread 1-2) MSC000001: Failed to start service jboss.deployment.unit."foo-app.ear".WeldStartService: org.jboss.msc.service.StartException in service jboss.deployment.unit."foo-app.ear".WeldStartService: Failed to start service

        at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1904)

        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)

        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)

        at java.lang.Thread.run(Thread.java:745)

      Caused by: java.lang.IllegalArgumentException: object is not an instance of declaring class

        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)

        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)

        at java.lang.reflect.Method.invoke(Method.java:498)

        at org.jboss.weld.resolution.QualifierInstance.createValues(QualifierInstance.java:128)

        at org.jboss.weld.resolution.QualifierInstance.of(QualifierInstance.java:95)

        at org.jboss.weld.resolution.ResolvableBuilder.addQualifier(ResolvableBuilder.java:147)

        at org.jboss.weld.resolution.ResolvableBuilder.addQualifiers(ResolvableBuilder.java:197)

        at org.jboss.weld.resolution.ResolvableBuilder.addQualifiers(ResolvableBuilder.java:192)

        at org.jboss.weld.manager.BeanManagerImpl.resolveDecorators(BeanManagerImpl.java:904)

        at org.jboss.weld.injection.producer.BeanInjectionTarget.initializeAfterBeanDiscovery(BeanInjectionTarget.java:108)

        at org.jboss.weld.injection.producer.InjectionTargetInitializationContext.initialize(InjectionTargetInitializationContext.java:42)

        at org.jboss.weld.injection.producer.InjectionTargetService.initialize(InjectionTargetService.java:63)

        at org.jboss.weld.bootstrap.WeldStartup.deployBeans(WeldStartup.java:431)

        at org.jboss.weld.bootstrap.WeldBootstrap.deployBeans(WeldBootstrap.java:83)

        at org.jboss.as.weld.WeldStartService.start(WeldStartService.java:93)

        at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1948)

        at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1881)

        ... 3 more

       

       

      16:59:23,240 ERROR [org.jboss.as.controller.management-operation] (Controller Boot Thread) WFLYCTL0013: Operation ("deploy") failed - address: ([("deployment" => "foo-app.ear")]) - failure description: {"WFLYCTL0080: Failed services" => {"jboss.deployment.unit.\"foo-app.ear\".WeldStartService" => "org.jboss.msc.service.StartException in service jboss.deployment.unit.\"foo-app.ear\".WeldStartService: Failed to start service

          Caused by: java.lang.IllegalArgumentException: object is not an instance of declaring class"}}

      16:59:23,342 INFO  [org.jboss.as.server] (ServerService Thread Pool -- 34) WFLYSRV0010: Deployed "foo-app.ear" (runtime-name : "foo-app.ear")

      16:59:23,347 INFO  [org.jboss.as.controller] (Controller Boot Thread) WFLYCTL0183: Service status report

      WFLYCTL0186:   Services which failed to start:      service jboss.deployment.unit."foo-app.ear".WeldStartService: org.jboss.msc.service.StartException in service jboss.deployment.unit."foo-app.ear".WeldStartService: Failed to start service

       

       

      16:59:23,668 INFO  [org.jboss.as] (Controller Boot Thread) WFLYSRV0060: Http management interface listening on http://127.0.0.1:9990/management

      16:59:23,669 INFO  [org.jboss.as] (Controller Boot Thread) WFLYSRV0051: Admin console listening on http://127.0.0.1:9990

      16:59:23,669 ERROR [org.jboss.as] (Controller Boot Thread) WFLYSRV0026: WildFly Full 9.0.2.Final (WildFly Core 1.0.2.Final) started (with errors) in 44463ms - Started 18381 of 21165 services (2571 services failed or missing dependencies, 283 services are lazy, passive or on-demand)

       

       

      I don't understand why this error is happening and I also don't know how to find out. Any tips?

        • 1. Re: Migrating from jboss as to wildfly
          ctomc

          Any reason why not go directly to WildFly 10, it is newer and has more bugs fixed...

           

          problem that is reported has to do with CDI beans, do you use CDI in your application?

          If not you might need to disable CDI for your deployment as it is by default enabled as part of EE7 requirement.

          see Weld: Documentation how to do that

          • 2. Re: Migrating from jboss as to wildfly
            caarlos0

            The app is still in Java 7, I understand that Wildfly 10 drops support for java7, so, until we update that too, I'll had to stick with wildfly 9.

             

            BTW: Java EE 6 still works on this version, right?

            • 3. Re: Migrating from jboss as to wildfly
              ctomc

              Carlos Alexandro Becker wrote:

               

              The app is still in Java 7, I understand that Wildfly 10 drops support for java7, so, until we update that too, I'll had to stick with wildfly 9.

               

              BTW: Java EE 6 still works on this version, right?

              Just keep in mind that JDK7 is already one year after end of life, http://www.oracle.com/technetwork/java/eol-135779.html

               

              Java EE versions are generally backward compatible.

              You should be able to deploy your EE6 application to EE7 server and it should work fine, depending on your app you might need to change some default configuration that server provide to make it "ignore" new features, but that is all.

              • 4. Re: Migrating from jboss as to wildfly
                caarlos0

                Yes, I'm aware, but.. one step at a time.

                 

                My plan is to migrate to wildfly 9, then from java 7 to 8, then to wildfly 10 (we have MANY clients, so, doing thing step by step feels safer and easier to test - since, in theory, less things are changed).

                 

                Anyways, yes, the app uses CDI,.. I enabled the weld debug on standalone.xml, didn't help...

                 

                The only thing that could indicate something seems to be this WARN:

                17:57:43,798 WARN  [org.jboss.weld.Bootstrap] (weld-worker-4) WELD-001125: Illegal bean type com.contaazul.service.ListFilter<com.contaazul.negotiation.entity.Negotiation<?, ?>> ignored on [EnhancedAnnotatedTypeImpl] public  class com.contaazul.negotiation.NegotiationFilter

                17:57:43,798 WARN  [org.jboss.weld.Bootstrap] (weld-worker-1) WELD-001125: Illegal bean type com.contaazul.service.ListFilter<com.contaazul.negotiation.entity.Negotiation<?, ?>> ignored on [EnhancedAnnotatedTypeImpl] public  class com.contaazul.negotiation.statement.NegotiationStatementFilter

                 

                But, since it's a warn, it couldn't be causing this issue... or could?

                • 5. Re: Migrating from jboss as to wildfly
                  caarlos0

                  I pached weld 2.2 (QualifierInstance - improve failure description by caarlos0 · Pull Request #1359 · weld/core · GitHub) and replaced it inside jboss, found the cause of trouble:

                   

                  We have a structure like this:

                  @PlanQualifier(PlanCode.MICRO_ANUAL)

                  public class PlanMicroYearly extends PlanMicro {

                    // ...

                  }

                   

                  public abstract class PlanMicro extends Plan {

                    // ...

                  }

                   

                  @AllArgsConstructor

                  public abstract class Plan {

                    // ..

                  }

                   

                  With several plan specializations.

                   

                  The injection is made by this class:

                  @Stateless

                  @NoArgsConstructor

                  @AllArgsConstructor

                  public class PlanFactory {

                      @Inject

                      @Any

                      Instance<Plan> plan;

                   

                      public Plan getPlan(PlanCode planCode) {

                          return plan.select( new PlanQualifierLiteral( planCode ) ).get();

                      }

                  }

                  For some reason, weld is complaining. I guess it is because of the `PlanMicro` specialization. Is this right? And is that suppose to happen? Any tips to avoid this error?

                  • 6. Re: Migrating from jboss as to wildfly
                    caarlos0

                    It was a jar replicated in /lib and 2 other wars inside the ear. I leave it only in /lib and the problem went away.