1 2 Previous Next 24 Replies Latest reply on Oct 3, 2012 5:47 AM by ctomc

    No class definition Error.

    sudhabalu

      Dear All,

       

           We are using a class to compress/decompress data and we put it in a seperate jar. From the ejb class we'll access that class. Using jboss 7.1.1 i have loaded the compress class jar as global module. But from bean class am getting the below error.

       

      11:04:20,638 INFO  [stdout] (http-127.0.0.1-127.0.0.1-8080-1) Exception raised in decompress() :java.lang.ClassNotFoundException: lrp.documentation.booking.shared.vo.Booking from [Module "solverminds.compress.compressapi:main" from local module loader @94884d (roots: E:\jboss-as-7.1.1.Final\modules)]

       

      11:04:20,643 ERROR [stderr] (http-127.0.0.1-127.0.0.1-8080-1) java.lang.ClassNotFoundException: lrp.documentation.booking.shared.vo.Booking from [Module "solverminds.compress.compressapi:main" from local module loader @94884d (roots: E:\jboss-as-7.1.1.Final\modules)]

       

      Is it possible to access bean class from modules?

       

      THanks

        • 1. Re: No class definition Error.
          sfcoy

          Accessing application classes from a module is tricky if they are not passed into the module as arguments.

           

          It would be simpler to bundle your EJB jar in an EAR file and add your compression library as a jar to the EAR/lib directory.

          1 of 1 people found this helpful
          • 2. Re: No class definition Error.
            sudhabalu

            Thanks for your reply. I have already tried to add compression library to the EAR/lib. But that doesn't work Still getting same exception

            • 3. Re: No class definition Error.
              sfcoy

              You need to add a classpath manifest entry in the compression lib with the name of the ejb jar, or configure the EAR classloading as described in Class Loading in AS7.

              • 4. Re: No class definition Error.
                sudhabalu

                I did the followings.

                 

                1.Added the ejb jar name in the classpath manifest entry of compression lib

                2.Set ear-subdeployments-isolated to false

                 

                 

                But no luck. Still couldn't solve the problem.

                • 5. Re: No class definition Error.
                  nickarls

                  What is the error message with all stuff in ear/lib and isolation=false? Is it jar -> jar reference within the ear or is there any jar -> war access?

                  • 6. Re: No class definition Error.
                    sudhabalu

                    Compression stuff is defined as module and loaded the same in standalone-full.xml as shown below.

                     

                                 <global-modules>              

                                    <module name="solverminds.compress.compressapi" slot="main"/>

                                </global-modules>

                     

                    From my bean/servlet used to call compress api to compress/decompress data. 

                    lrp.documentation.booking.shared.vo.Booking object = (lrp.documentation.booking.shared.vo.Booking)cmp.decompress(compressedData);

                     

                    Its showing the mentioned error in the above line.

                    • 7. Re: No class definition Error.
                      nickarls

                      Can you raise log levels so you can see that the module is actually is well-defined and picked up?

                      • 8. Re: No class definition Error.
                        sudhabalu

                        ok. But its my error.

                         

                        11:04:20,638 INFO  [stdout] (http-127.0.0.1-127.0.0.1-8080-1) Exception raised in decompress() :java.lang.ClassNotFoundException: lrp.documentation.booking.shared.vo.Booking from [Module "solverminds.compress.compressapi:main" from local module loader @94884d (roots: E:\jboss-as-7.1.1.Final\modules)]

                         

                         

                        Its showing lrp.documentation.booking.shared.vo.Booking class is not found in compress API.

                        • 9. Re: No class definition Error.
                          sfcoy

                          I think Sudha is directly referencing a class defined in his application from his module. I don't think you can do that without passing a classloader to the module.

                           

                          Which is why I suggested the EAR solution.

                           

                          Sudha, What did your manifest classpath entry look like? I would expect to see something like:

                           

                          Class-Path: ../your-ejb.jar

                          • 10. Re: No class definition Error.
                            sudhabalu

                            i Just added like this.

                             

                            Class-Path: ejbjarname.jar

                             

                            I added this manifest entry in the compress library jar's which is loaded as module.

                            • 11. Re: No class definition Error.
                              sfcoy

                              If you have code like:

                               

                              {code:java}lrp.documentation.booking.shared.vo.Booking object = (lrp.documentation.booking.shared.vo.Booking)cmp.decompress(compressedData);{code}

                              in your module and the class lrp.documentation.booking.shared.vo.Booking is defined in your ejb jar then you will have classloading problems.

                               

                              Put everything together in an EAR file.

                              • 12. Re: No class definition Error.
                                nickarls

                                Why would the compression module (as in AS module in the modules dir) need to reference the code in the EAR/EJB?

                                One would think that you either would have the compression lib and the code using it in the same EAR or the compression stuff in a module and then just referenced from the applications.

                                Or am I missing something here?

                                • 13. Re: No class definition Error.
                                  sudhabalu

                                  No am not having that code in my module. In compress API all operations done as object.

                                   

                                  That code i have used in my servlet.

                                   

                                   

                                  I am just passing some object to compress API to decompress the same.

                                  • 14. Re: No class definition Error.
                                    nickarls

                                    So you now have have an EAR. In that EAR you have a WAR. In that WAR you have a servlet class which references a class that is packed in a JAR and placed in the lib folder of the beforementioned EAR?

                                    1 2 Previous Next