Class not found: Deploying on Glassfish

2019-08-01 08:17发布

问题:

Below is the error message:

SEVERE: Class [ org/apache/lucene/queryparser/classic/ParseException ] not found. Error while loading [ class test.com.creatop.ateam.facade.TestFacade ]
SEVERE: Class [ org/apache/lucene/queryparser/classic/ParseException ] not found. Error while loading [ class com.creatop.ateam.facade.implementation.PropertyFacade ]
SEVERE: Class [ org/apache/lucene/queryparser/classic/ParseException ] not found. Error while loading [ class com.creatop.ateam.facade.implementation.ProjectFacade ]
SEVERE: Class [ Lorg/hibernate/validator/ClassValidator; ] not found. Error while loading [ class importprocess.meridien.ContactImport ]
SEVERE: Class [ org/apache/lucene/queryparser/classic/ParseException ] not found. Error while loading [ class com.creatop.ateam.facade.implementation.BuildingManagementFacade ]
SEVERE: Class [ org/apache/lucene/queryparser/classic/ParseException ] not found. Error while loading [ class com.creatop.ateam.facade.implementation.DefectFacade ]
SEVERE: Class [ org/apache/lucene/queryparser/classic/ParseException ] not found. Error while loading [ class com.creatop.ateam.facade.implementation.ClaimFacade ]
SEVERE: org/apache/lucene/search/FieldComparatorSource
SEVERE: Exception while deploying the app [eSystem]
SEVERE: org/apache/lucene/search/FieldComparatorSourceat org.glassfish.apf.AnnotationInfo@6bf2c7

The error occurs while trying to deploy on Glassfish 3.1 from my Oracle Eclipse Pack. I have added all the lucene jar files to classpath. Please suggest.

回答1:

If you added your JARs manually, export your project to WAR file using Eclipse (File->Export->WAR->...) and open it like a folder (it's actually a ZIP file, Linux will do, Windows may need renaming the extension), now check if the JAR file is placed in WEB-INF/lib directory. If so try deploying this WAR to Glassfish manually (using console, or Admin web interface). This will tell you if Eclipse project settings are wrong, or Glassfish is for some reason not seeing your lib directory contents.

One more tip for you, there is directory in your Glassfish installation under glassfish_installdir/domains/domain1/lib/ext, which is accessible to all your apps deployed in domain1. But I don't recommend using this as a solution, just sometimes it can point your debugging to the cause of the problem.



回答2:

If you have separate projects, package it into an EAR so that the server can find classes