Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7693001
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T20:59:00+00:00 2026-05-31T20:59:00+00:00

Running JBoss 5.1, with Hibernate as the JPA provider. Backed with SQL Server 2008.

  • 0

Running JBoss 5.1, with Hibernate as the JPA provider. Backed with SQL Server 2008.

I’m receiving an error at server startup, which is java.lang.ClassCastException: org.hibernate.dialect.SQLServerDialect cannot be cast to org.hibernate.dialect.Dialect. Pretty clear message, but I’m baffled as to the underlying cause. I have hibernate-core-3.5.1-Final.jar on the classpath, and the necessary class files are present.

This dialect setting was giving no error in the project when it was being used as a property being passed to a Spring AnnotationSessionFactoryBean, but I’m trying to refactor a piece to straight EJB/JPA. For what it’s worth, here’s my persistence config:

<persistence xmlns="http://java.sun.com/xml/ns/persistence"
version="1.0">
<persistence-unit name="[my name here]">
    <jta-data-source>java:jdbc/[my name here]</jta-data-source>
    <properties>
        <property name="hibernate.show_sql" value="true" />
        <property name="hibernate.dialect" value="org.hibernate.dialect.SQLServerDialect"/>
        <property name="hibernate.cache.use_query_cache" value="true" />
        <property name="hibernate.cache.use_second_level_cache" value="true" />
        <property name="hibernate.cache.provider_class" value="net.sf.ehcache.hibernate.EhCacheProvider" />
    </properties>
</persistence-unit>

I hate these kind of “here’s my config and my stacktrace” questions, but I’ve been poking around on this for an hour and a half and am failing to come up with any new ideas.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-31T20:59:01+00:00Added an answer on May 31, 2026 at 8:59 pm

    The ClassCastException is caused by having two copies of the javax.persistence APIs in your system. When running on JBoss, you are just not supposed to package persistence jar in your application. Remove all the persistence related jar’s from your application and the exception should go away.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an Java application running in JBoss in which I have enabled JMX
I am using Hibernate (JPA) with Derby database - my app server is Jboss
We have an web application running under JBoss 5 which periodically launches a 'java'
I am running a JBoss Seam web application with Hibernate as the persistence provider.
Running JBoss 4.2.3.GA and trying to deploy a WAR that is using Spring/Hibernate/JPA. I'm
I am deploying to a unix box running Jboss. We are using SQL Server
I'm running JBoss 4.2.3, Java 1.5, and Ubuntu. Before you tell me to post
I am running a JBoss instance on a linux server I am using the
I've got a pretty ordinary Java EE application running on JBOSS. It uses the
Now we have a project with java 1.4 and ejb 2.1 running on jboss

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.