1 2 Previous Next 18 Replies Latest reply on Jun 28, 2008 1:26 PM by skajotde

    ClassNotFound / Trying to use Embedded JBoss in mvn environ

    davisford

      Hi, it seems some other people have gotten this to work in a maven environment.

      I have tried the following. Downloaded embedded-jboss-beta3.zip

      Unzipped, added everything under lib to eclipse project. Copied everything under bootstrap/* to my maven project's src/main/resources/*

      Wrote the following class to try bootstrap:

      import org.jboss.embedded.Bootstrap;

      public class MyApp
      {
       public static void main(String[] args) throws Exception
       {
       Bootstrap.getInstance().bootstrap();
       Bootstrap.getInstance().shutdown();
       }
      }


      This results in a flurry of exceptions. the full stack trace is long, so I'll post what I think is relevant. For example, it complains about ClassNotFound for
      KernelDeploymentDeployer.class
      . I expand the libs in the project, and find this class does exist at
      org.jboss.deployers.vfs.deployer.kernel
      in the jar file jboss-embedded-all.jar

      Any idea what I'm doing wrong?

      Exception in thread "main" org.jboss.deployers.client.spi.IncompleteDeploymentException: Summary of incomplete deployments (SEE PREVIOUS ERRORS FOR DETAILS):

      *** CONTEXTS MISSING DEPENDENCIES: Name -> Dependency{Required State:Actual State}

      UserTransactionBinding
      -> UserTransaction{Configured:**ERROR**}

      UserTransactionBinding2
      -> UserTransaction{Configured:**ERROR**}


      *** CONTEXTS IN ERROR: Name -> Error

      SARDeployer -> java.lang.ClassNotFoundException: [Ljava.lang.Class;

      ServiceDeploymentDeployer -> java.lang.ClassNotFoundException: [Ljava.lang.Class;

      ServiceClassLoaderDeployer -> java.lang.ClassNotFoundException: [Ljava.lang.Class;

      BeanDeployer -> java.lang.ClassNotFoundException: [Ljava.lang.Class;

      ServiceDeployer -> java.lang.ClassNotFoundException: [Ljava.lang.Class;

      BeanMetaDataDeployer -> java.lang.ClassNotFoundException: [Ljava.lang.Class;

      UserTransaction -> java.lang.RuntimeException: Unable to locate the transaction manager

      KernelDeploymentDeployer -> java.lang.ClassNotFoundException: [Ljava.lang.Class;


      at org.jboss.deployers.plugins.deployers.DeployersImpl.checkComplete(DeployersImpl.java:576)
      at org.jboss.deployers.plugins.main.MainDeployerImpl.checkComplete(MainDeployerImpl.java:559)
      at org.jboss.embedded.Bootstrap.bootstrapURL(Bootstrap.java:149)
      at org.jboss.embedded.Bootstrap.bootstrap(Bootstrap.java:183)
      at org.jboss.embedded.Bootstrap.bootstrap(Bootstrap.java:195)
      at MyApp.main(MyApp.java:19)




        • 1. Re: ClassNotFound / Trying to use Embedded JBoss in mvn envi
          alecnmk

          davisford, why did you downloaded manually any jars if your topic subj says "Trying ... in mvn environment"? You should just configure your maven to use jboss repo.

          But anyway, it's seems like you using JDK6. Am I right? I so, try to add "-Dsun.lang.ClassLoader.allowArraySyntax=true". For more details, search this forum

          • 2. Re: ClassNotFound / Trying to use Embedded JBoss in mvn envi
            davisford

            I d/l jars, b/c the latest revision of embedded JBoss is not available in any repository I could find. Therefore...if I could actually get the software to work, then I'd just deploy the jars locally, which is fine and easy to do.

            I found the alpha release in the jboss mvn repo, but apparently that is quite old.

            Anyway, y, I found the -D fix for JDK 6, and that got me a little further. Then I hit the JAXB 2.0 vs. JDK 6 JAXB 2.1 API problem. This requires one to put jaxb jar in JDK /endorsed directory. This is not acceptable for us, b/c we use mvn to auto-deploy and manage our distributed dev. environments, so I'm not comfortable with doing this, and plus we do use JAXB heavily, and have not yet tested our stuff with 2.1.

            Beyond that, I did create the /endorsed dir just to see how far I could get in my own local project, and I ended up hitting several other exceptions. I did not pursue resolving them, and decided to wait to try the next release of embedded JBoss.

            I'm excited about the concept. I'm writing EJB 3.0 using persistence API and right now managing EntityManager, etc. myself. I'd like to use embedded JBoss to get manage this and take advantage of the full features of JPA, but I'll wait a bit, I guess.

            • 3. Re: ClassNotFound / Trying to use Embedded JBoss in mvn envi
              alecnmk

              davisford, I'm using latest beta3 from the jboss repo (check this out: http://repository.jboss.com/maven2/org/jboss/embedded/).

              But there are broken dependency, that isn't present in jboss repo (from jboss-embedded-all:beta3 to jboss-embedded:beta3-SNAPSHOT). I've solved this by removing this dependency manually from jboss-embedded-all.pom, and created dependency from my project to jboss-embedded:beta3 directly. (it's also already been discussed in this forum category)

              offtop: Now, I'm try to utilize EJ for testing purposes, but I wouldn't suggest anyone to use it for production yet. Community is small and project being developed not really fast. Probably some contribution from us (users) could help.

              With best regards ;)

              • 4. Re: ClassNotFound / Trying to use Embedded JBoss in mvn envi
                alecnmk

                2davisford, you can still build latest version from source, and installing it to your local/central repository. Probably I'll do the same if won't have success with latest repository version

                • 5. Re: ClassNotFound / Trying to use Embedded JBoss in mvn envi
                  davisford

                  alec, thx for showing me that. I was actually d/l from here:

                  http://repository.jboss.com/maven2/jboss/jboss-embeddable-ejb3/

                  which is the old alpha release. didn't realize they fixed the m2 repo to follow proper naming with org/jboss/ etc. good to know.

                  i also was going for using embedded jboss for testing. i did get the alpha release to work up to a point. i could fire it up and saw it was doing dependency injection ok with the entity manager. unfortunately, i hit some exception (don't remember), and when i looked it up on hibernate forum, it indicated that it was an issue with the alpha release.

                  that's why i tried downloading the jars manually and setting them up in my mvn project manually and tried to just get the bootstrap to work. did not know they were in the repo where you indicated.

                  anyway, i'm still stuck with the JAXB problem. i'm not going to mess with endorsed dir, and we haven't yet made the move to the next JDK release which is supposed to contain JAXB 2.1.

                  in the meantime, i built a testing framework around DbUnit, and this seems simple and easy to do for testing JPA. plus, i found the initial setup of embedded JBoss to be quite time consuming. i'm happy now with how i can test. will want to come back to embedded Jboss later possibly, when we decide we want to have session beans managed in a container and don't want to use full blown AS.

                  • 6. Re: ClassNotFound / Trying to use Embedded JBoss in mvn envi
                    alecnmk

                    davisford, I'm on the same way like you are with JAXB.
                    And even when I've started with "endorsed dir" set, I'm still can't boot up my jboss. I'm using latest builds (beta 3) from jboss maven repo, but configuration stuff I took from distribution downloaded from sourceforge. I just thought that they could be non-compliant some way. Now I'm going to build up from source all jboss-embedded stuff and try again :)

                    Concerning DbUnit.. yeah, that's good way if you need to test only your mappings and queries.
                    Now we have integration tests running on close to production environment, but the idea with EJ was to make development cycle little easier and do not wait every time for integration tests to run.

                    • 7. Re: ClassNotFound / Trying to use Embedded JBoss in mvn envi
                      skajotde

                       

                      "alecnmk" wrote:
                      2davisford, you can still build latest version from source, and installing it to your local/central repository. Probably I'll do the same if won't have success with latest repository version


                      Are tried this with success ?

                      • 8. Re: ClassNotFound / Trying to use Embedded JBoss in mvn envi
                        alecnmk

                         

                        "skajotde" wrote:
                        "alecnmk" wrote:
                        2davisford, you can still build latest version from source, and installing it to your local/central repository. Probably I'll do the same if won't have success with latest repository version


                        Are tried this with success ?


                        It was long-long time ago, but I just gave it up. I'm using standalone Hibernate for persistence-related tests and I just extracted most of logic out of EJB, so I'm not dependent from jboss container anymore. But if you're looking for solution not for testing purposes, I could just wish you a lot of luck ;) Probably it's already working now

                        • 9. Re: ClassNotFound / Trying to use Embedded JBoss in mvn envi
                          davisford

                          Yeah, I gave up too. Embedded JBoss seemed to be very "alpha" at the time, and the Sun JDK was also having issues with JAXB.

                          I just moved straight to DBUnit, it is so much more consistent, lighter-weight, and easier to understand and control tests.

                          Before every test method, I have hibernate do drop-create, and then have DBunit insert test rows from XML files. This ended up being far better / easier to use than embedded JBoss.

                          This was many months ago, though. I haven't tracked the latest status -- perhaps there has been active work here that makes this much more robust today. Good luck! If you do try it and have any luck, please let us know here. I for one, would be interested...

                          I like the idea very much of having the capability of an App Server without having to stand one up -- both for production and for tests.

                          • 10. Re: ClassNotFound / Trying to use Embedded JBoss in mvn envi
                            skajotde

                             

                            "alecnmk" wrote:

                            It was long-long time ago, but I just gave it up. I'm using standalone Hibernate for persistence-related tests and I just extracted most of logic out of EJB, so I'm not dependent from jboss container anymore. But if you're looking for solution not for testing purposes, I could just wish you a lot of luck ;) Probably it's already working now


                            I dont have this choice ;) System is writing by a few people for months and I'm writing integration testing, production in on Jboss 4.2. I consider fiew solutions:

                            1) Embedded Jboss
                            2 )Deploy ears (4 in our case) and test remote.
                            3) Spring (understand annotations @Ejb and @Resource but requires tricks for atribute mappedName used in our project
                            4) OpenEjb and embedded testing (only consideration, not tested)
                            5) Glassfish Embedded (only consideration, not tested)

                            Now My example project passed my tests with Jboss Embedded ;) and I'm trying run our projects with maven and Jboss embedded (strongly modular: about 80 projects with 6 with entities;)). Simplest solution is to order classpath and put jboss-emebedded libraries in first, but I'm not sure maven support this evident case ;/

                            • 11. Re: ClassNotFound / Trying to use Embedded JBoss in mvn envi
                              alecnmk

                               

                              "skajotde" wrote:
                              "alecnmk" wrote:

                              ...
                              Now My example project passed my tests with Jboss Embedded ;) and I'm trying run our projects with maven and Jboss embedded (strongly modular: about 80 projects with 6 with entities;)). Simplest solution is to order classpath and put jboss-emebedded libraries in first, but I'm not sure maven support this evident case ;/


                              Congratulations! You're on the right way! I think I should give another one try to embedded JBoss container. Considering your case with maven (we using it too), i think it includes dependencies in order they been declared. I'm sure you'll deal with maven anyway if you got so far ;)


                              • 12. Re: ClassNotFound / Trying to use Embedded JBoss in mvn envi
                                skajotde

                                 

                                "alecnmk" wrote:
                                i think it includes dependencies in order they been declared.


                                Not quite ;/ We are using parent pom. This and transitivies dependiencies break classpath order (I'm cheking generated .classpath).

                                Here I found yet another example jboss embedded with seam and maven: http://jira.jboss.org/jira/browse/JBSEAM-2371#action_12410515.

                                • 13. Re: ClassNotFound / Trying to use Embedded JBoss in mvn envi
                                  skajotde

                                  Goal "mvn test" order classpath corect among declaration. Only I dont know how to put in first direct dependencies from jboss-embedded before parent pom dependencies. Mayby I will have to remove parent pom.

                                  Big misunderstanding is with "mvn eclipse:eclipse" ;/ which generate .classpath entries in alphabetic order ! Java Language strong depend on order of classpath and author of this plugin prepare such bad egg ;)

                                  • 14. Re: ClassNotFound / Trying to use Embedded JBoss in mvn envi
                                    skajotde

                                     

                                    "skajotde" wrote:
                                    Goal "mvn test" order classpath corect among declaration. Only I dont know how to put in first direct dependencies from jboss-embedded before parent pom dependencies. Mayby I will have to remove parent pom.


                                    In maven 2.0.9 is OK, I was running in M2Eclipse which used 2.1-SNAPTHOT and with this were problems. Direct dependencies are first.

                                    1 2 Previous Next