facebook

Unable to deploy on TomCat 6

  1. MyEclipse Archived
  2.  > 
  3. Application Servers and Deployment
Viewing 10 posts - 1 through 10 (of 10 total)
  • Author
    Posts
  • #271264 Reply

    azahur
    Member

    Configuration:

    Tomcat 6
    Jdk 1.6 or 1.5
    Hibernate 3.2

    I had created an application project on eclipse3.2 and was working fine. Then I decided to go myeclipse route so created a webproject with struts and hibernate capabilities. Imported the project files from the other project.
    If I run it as an appliction it runs file.
    If I deploy it using myeclipse to tomcat I get the following error

    avax.servlet.ServletException: org.hibernate.HibernateException: Could not parse configuration:
    org.apache.struts.action.RequestProcessor.processException(RequestProcessor.java:545)
    org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:486)
    org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:274)
    org.apache.struts.action.ActionServlet.process(ActionServlet.java:1482)
    org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:525)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:710)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:803)

    root cause

    org.hibernate.HibernateException: Could not parse configuration:
    org.hibernate.cfg.Configuration.doConfigure(Configuration.java:1494)
    org.hibernate.cfg.Configuration.configure(Configuration.java:1428)
    com.slb.ess.otp.base._BaseRootDAO.initialize(_BaseRootDAO.java:108)
    com.slb.ess.otp.base._BaseRootDAO.initialize(_BaseRootDAO.java:92)
    com.slb.ess.otp.base._BaseRootDAO.getSessionFactory(_BaseRootDAO.java:149)
    com.slb.ess.otp.base._BaseRootDAO.getSession(_BaseRootDAO.java:64)
    com.slb.ess.otp.base._BaseRootDAO.getSession(_BaseRootDAO.java:42)
    com.slb.ess.otp.base._BaseRootDAO.findAll(_BaseRootDAO.java:263)
    com.slb.ess.otp.base.BaseTokenUserDAO.findAll(BaseTokenUserDAO.java:82)
    com.slb.ess.otp.bl.api.ServerManager.getAllTokenUsers(ServerManager.java:624)
    com.slb.ess.otp.struts.action.SearchUserAction.execute(SearchUserAction.java:49)
    org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:484)
    org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:274)
    org.apache.struts.action.ActionServlet.process(ActionServlet.java:1482)
    org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:525)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:710)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:803)

    root cause

    org.dom4j.DocumentException: Error on line 1 of document : Content is not allowed in prolog. Nested exception: Content is not allowed in prolog.
    org.dom4j.io.SAXReader.read(SAXReader.java:482)
    org.hibernate.cfg.Configuration.doConfigure(Configuration.java:1484)
    org.hibernate.cfg.Configuration.configure(Configuration.java:1428)
    com.slb.ess.otp.base._BaseRootDAO.initialize(_BaseRootDAO.java:108)
    com.slb.ess.otp.base._BaseRootDAO.initialize(_BaseRootDAO.java:92)
    com.slb.ess.otp.base._BaseRootDAO.getSessionFactory(_BaseRootDAO.java:149)
    com.slb.ess.otp.base._BaseRootDAO.getSession(_BaseRootDAO.java:64)
    com.slb.ess.otp.base._BaseRootDAO.getSession(_BaseRootDAO.java:42)
    com.slb.ess.otp.base._BaseRootDAO.findAll(_BaseRootDAO.java:263)
    com.slb.ess.otp.base.BaseTokenUserDAO.findAll(BaseTokenUserDAO.java:82)
    com.slb.ess.otp.bl.api.ServerManager.getAllTokenUsers(ServerManager.java:624)
    com.slb.ess.otp.struts.action.SearchUserAction.execute(SearchUserAction.java:49)
    org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:484)
    org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:274)
    org.apache.struts.action.ActionServlet.process(ActionServlet.java:1482)
    org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:525)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:710)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:803)

    Please help

    #271275 Reply

    Loyal Water
    Member

    Hi azahur,
    Can you create a new webproject and add struts and hibernate capabilities to it. Without importing your project files into this project, try and see if you can successfully deploy this project.

    If you are able to deploy it successfully, then I guess something is breaking when you try to import your Eclipse project. I suggest your try dropping piece from your old project into a newly created MyEclipse project.

    Let me know if that helps.

    #271297 Reply

    azahur
    Member

    Sorry,
    Maybe I was not clear in the message Title or in the first Message.
    I am able to deploy the project and I can also reach the jsp pages through the browser. But Hibernate starts causing issues and gives the error.
    I believe its a classpath issue, where the hibernate.cfg.xml cannot be found and it is giving the weird error of

    Error on line 1 of document : Content is not allowed in prolog. Nested exception: Content is not allowed in prolog.
    org.dom4j.io.SAXReader.read(SAXReader.java:482)

    #271305 Reply

    Loyal Water
    Member

    You need to check the following:-
    1) Do you have multiple copies of hibernate.jar in your build path. It’s possible that you had libraries under WEB-INF/lib, and when you added Hibernate libraries you *also* added the MyEclipse libraries to your build path, now you have two sets.

    2) Also, can you paste the hibernate.cfg.xml file contents here for me please.

    #271309 Reply

    azahur
    Member

    Here is the hihbernate.cfg.xml file

    <!DOCTYPE hibernate-configuration PUBLIC
    “-//Hibernate/Hibernate Configuration DTD 3.0//EN”
    http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd”&gt;
    <hibernate-configuration>
    <session-factory>
    <!– local connection properties –>
    <property name=”hibernate.connection.url”>
    jdbc:microsoft:sqlserver://localhost:1433;databasename=otp
    </property>
    <property name=”hibernate.connection.driver_class”>
    com.microsoft.jdbc.sqlserver.SQLServerDriver
    </property>
    <property name=”hibernate.connection.username”>sa</property>
    <property name=”hibernate.connection.password”>sa</property>
    <!– property name=”hibernate.connection.pool_size”></property –>
    <!– dialect for Microsoft SQL Server –>
    <property name=”dialect”>
    org.hibernate.dialect.SQLServerDialect
    </property>
    <property name=”hibernate.show_sql”>true</property>
    <property name=”hibernate.transaction.factory_class”>
    org.hibernate.transaction.JDBCTransactionFactory
    </property>
    <mapping resource=”AuthenticationPolicy.hbm.xml” />
    <mapping resource=”KeyManager.hbm.xml” />
    <mapping resource=”SecurityApplication.hbm.xml” />
    <mapping resource=”Role.hbm.xml” />
    <mapping resource=”Token.hbm.xml” />
    <mapping resource=”TokenUser.hbm.xml” />
    <mapping resource=”TokenUserRoleLink.hbm.xml” />
    <mapping resource=”TokenUserActions.hbm.xml” />
    </session-factory>
    </hibernate-configuration>

    I have a question..
    could it be that the version of hibernate, that comes with myeclipse is clashing with the version I have… I have hibernate 3.2

    #271314 Reply

    Loyal Water
    Member

    Hmmm .. there could be a confilicting issue since you were using 3.2 and later you added hibernate capabilities as well. If you want to use 3.2, I suugest you drop those libraries in manually and then DONT add hibernate capabilities. Only add the Struts capabilities to your project

    Just to let you know, MyEclipse has not been tested with hibernate 3.2 yet.

    #271315 Reply

    azahur
    Member

    how can I take the hibernate cababilities out. or should I just manually delete them in the project path.

    I dont see an option on how to delete it with myeclispe

    #271319 Reply

    Loyal Water
    Member

    I suggest you create a brand new project instead of removing hibernate capabilities from the existing project. That would be easier for you. Then you can import your project and add struts capabilities to in. Make sure Struts JARs dont conflict when you add Struts capabilities.

    #271328 Reply

    azahur
    Member

    Still the same

    this is what I did as suggested…

    1) Created a new Project
    2) Added struts capability
    3) added original backend code
    4)Pointed to the Hibernate 3.2 jar files through the project options
    5) created a test jsp page to connect to the code

    got the same exception

    org.dom4j.DocumentException: Error on line 1 of document : Content is not allowed in prolog. Nested exception: Content is not allowed in prolog.
    at org.dom4j.io.SAXReader.read(SAXReader.java:482)
    at org.hibernate.cfg.Configuration.doConfigure(Configuration.java:1484)
    at org.hibernate.cfg.Configuration.configure(Configuration.java:1428)
    at com.slb.ess.otp.base._BaseRootDAO.initialize(_BaseRootDAO.java:108)

    #271339 Reply

    azahur
    Member

    Finally got it fixed by following the instructions in the following linkhttp://www.hibernate.org/114.html

    But still would like to know why hibernate.cfg.xml file cannot be read in the tomcat/webapp/myapp/webinf/classes folder if the class file accessing it is a jar file

    Well its a better question for the Tomcat forum… but just wanted to post the solution here as it has taken me a full day to resolve this issue

Viewing 10 posts - 1 through 10 (of 10 total)
Reply To: Unable to deploy on TomCat 6

You must be logged in to post in the forum log in