Showing posts with label error. Show all posts
Showing posts with label error. Show all posts

Monday, May 9, 2016

Error instantiating the Persistence Provider class org.hibernate.ejb.HibernatePersistence of the PersistenceUnit XXX: java.lang.ClassNotFoundException: org.hibernate.ejb.HibernatePersistence

I got this exception while trying to deploy an EJB ear that was created with maven to weblogic 12g :

Error instantiating the Persistence Provider class org.hibernate.ejb.HibernatePersistence of the PersistenceUnit XXX : java.lang.ClassNotFoundException: org.hibernate.ejb.HibernatePersistence

Note : I am having a certain problem preventing me from putting shared libraries in the lib folder in weblogic

I searched a lot and tried the following :

1- make sure that hibernate-entitymanager jar is included in the ear while deployment
2- put these entries in the persistence.xml file :
        <property name="hibernate.dialect" value="org.hibernate.dialect.MySQLDialect" />
        <property name="hibernate.transaction.manager_lookup_class"
       value="org.hibernate.transaction.WeblogicTransactionManagerLookup" />
        <property name="hibernate.show_sql" value="true" />
3- put this in weblogic.xml :
         <prefer-application-packages>
            <package-name>antlr.*</package-name>
        </prefer-application-packages>
        <prefer-application-packages>
            <package-name>org.hibernate.*</package-name>
        </prefer-application-packages>

all these trials didn't solve the problem, I got another EJB ear that is working on weblogic and started the normal process of comparison between working and non-working ears and found the following :

4- the jar inside the ear that holds all the code has MANIFEST.MF inside its META-INF folder that has a Class-Path entry that points to the hibernate jars ..... I tried hard coding this entry and it worked.

5- Next I wanted to generate this entry automatically using maven, so I added the following entry to the pom.xml of the included jar's project :
           
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-jar-plugin</artifactId>
                <version>2.4</version>
                <configuration>
                    <archive>
                        <manifest>
                            <addClasspath>true</addClasspath>
                        </manifest>

                        <manifestFile>src/main/resources/META-INF/MANIFEST.MF</manifestFile>
                    </archive>
                </configuration>
            </plugin>


 Now it's deploying fine







Thursday, March 17, 2016

SOLR : Internal Server Error on calling deleteById()

Shifting from local environment to integration environment, my code suddenly started to throw Internal Server Error while calling SolrServer.deleteById(List<String>) , I googled it, found some solutions talking about locking mechanism and thread pool size and similar stuff, but It didn't work, I made a small test case that deletes one part with no threads... It gave the same exception.
I looked at the schema and realized that some one commented out the <uniqueKey>id</uniqueKey> tag ... and that's it :( ....... I just uncommented it again, restarted the solr application and all was ok

Wednesday, November 20, 2013

Eclipse WTP neither auto completing nor compiling jsps

<An issue that was resolved>

Hello All,

While using Eclipse juno, I imported an existing project to the workspace, started editing it, but unfortunately the auto complete wasn't working with  jsp files.Further worse, I tried building the project, It didn't do any thing, not giving a compiler error nor warning nor success nor any thing. just the console remained empty.


It seemed unable to understand anything

I tried the following :
1- make sure that jre7 library was included in the libraries of the project. <right click on the project folder - properties - java build path>  ... Didn't work
2-downloaded a new version of eclipse wtp and open the project with. ....Didn't work - gave the same behavior.
3- Created a new web project and started comparing the old with it
4- First I realized that the old one doesn't have 'src' folder -as it was composed of only jsps- so I created it
 ..... since then the auto completing started working !!!! -don't ask  me why, good anyways-  BUT for J2EE classes (request for example) I didn't work (I tried typing request.addMe() ... I didn't complain !! ... No need to mention that the compilation issue persisted)
5- Comparing the libraries of both projects, I found a missing library in the old jar which is 'Apache Tomcat server 7' .... I explored this jar and found that it contained the servlet-api.jar -that's IT- ..... I added the library through : project properties>java build path> libraries >add Library > server runtime > apache tomcat server 7.

Now Working fine ... Full Auto completion, compiles , Compilation errors appearing ... WOW


Update 26/11/2015 :

Don't include servlet-api.jar in the project lib, but instead include a Server(tomcat for example) in your Servers view in eclipse .... and then in the project's properties, choose runtime environment, choose the server you added and then  the project will compile since it refers to the server's servlet-api.jar.

Hope It helps.