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 9012611
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T03:02:48+00:00 2026-06-16T03:02:48+00:00

This is 2nd day that I am struggling with this issue. We have a

  • 0

This is 2nd day that I am struggling with this issue.
We have a web app that uses spring and hibernate. Now We are trying to expose some functionality to command line. So We should be able to run a class from command line(without web app) so it should have access to spring and hibernate.

<context:annotation-config/>

<context:component-scan base-package="com.x.y.z"/>

<jpa:repositories base-package="com.x.y" />


<bean id="entityManagerFactory" class="org.springframework.orm.jpa.LocalEntityManagerFactoryBean">
    <property name="jpaProperties">
        <props>
            <prop key="javax.persistence.validation.mode">NONE</prop>
            <prop key="hibernate.validator.apply_to_ddl">false</prop>
            <prop key="hibernate.validator.autoregister_listeners">false</prop>
            <prop key="hibernate.format_sql">false</prop>
        </props>
    </property>
    <property name="jpaVendorAdapter">
        <bean class="org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter">
            <property name="generateDdl" value="false" />
            <property name="database" value="SQL_SERVER" />
            <property name="showSql" value="false" />
        </bean>
    </property>
</bean>

Here I am using LocalEntityManagerFactoryBean but it seems there is no way to set datasource to it. It gets from persistance.xml

If I use LocalContainerEntityManagerFactoryBean I can set datasource(it has datasource property)

persistance.xml:

<persistence version="1.0" xmlns="http://java.sun.com/xml/ns/persistence"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd">
<persistence-unit name="oms-jpa">
    <class>com.domain.User</class>
</persistence-unit>

In persistance.xml I am not defining any database informaton for datasource, so LocalEntityManagerFactoryBean does not work for this.

what I am getting:

Error creating bean with name 'entityManagerFactory' defined in file [C:\Users\ekamoliddinov\IdeaProjects\web\conf\spring-config.xml]: Invocation of init method failed; nested exception is java.lang.ClassFormatError: Absent Code attribute in method that is not native or abstract in class file javax/validation/Validation

googled then some says:

  • Jar versions messed up
  • jee-api.jar is missing

But I have jee-api.jar.

My questions:

  • What is causing the above exception?
  • Can I use LocalContainerEntityManagerFactoryBean without having web
    container? Spec does not say anything about this.
  • If i can not use LocalContainerEntityManagerFactoryBean then how can I set up
    LocalEntityManagerFactoryBean so it should use my datasource not from
    persistance.xml(I can not define anything in persistance.xml).

I am using spring version 3.1.3 with hibernate 4.1.8.Final and i am in command line(I do no have jee environment)

Sorry about more than one questions, but all questions are arising from the same root I think.

Any help will be appreciated.
Thanks.

  • 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-06-16T03:02:50+00:00Added an answer on June 16, 2026 at 3:02 am

    After trying 3 days I fixed the issue. The jars where messed up 🙂
    It was because I have jee-api.jar in my classpath and I was running the code from command line, I had not web env. So there was not any impl of jee-api.jar in my env. That is why it was giving the above exception. I removed jee-api.jar and disappeared.

    Another thing That I can tell: we can use LocalContainerEntityManagerFactoryBean from command line. I am using it.

    The last thing: We can not set datasource to LocalEntityManagerFactoryBean

    This my help to someone.

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

Sidebar

Related Questions

I've been trying to solve this issue all day without success. I have an
I'm trying to remove the 2nd commit to a repo. At this point I
I have 1st popup, and this 1st popup opens 2nd popup Code: <view-state id=paneMaintenance
I am on my 2nd day(16th hour) of trying to get my delete button
From Day One I was told that each third-party iOS app was perfectly sand-boxed
I have a table called activity that uses the following columns: LoginDate, LoginID, Department,
I have this piece of code in my application. I suspect that it is
I am a beginner struggling with Python every day. I have a large data
First let me tell you that i have searched at least a day long
I have a sortable like the 2nd example on this page: http://jqueryui.com/demos/sortable/items.html The sortable

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.