Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

kundera.client property is missing for persistence unit, version 2.10 #536

Closed
gmatej opened this issue Feb 25, 2014 · 15 comments
Closed

kundera.client property is missing for persistence unit, version 2.10 #536

gmatej opened this issue Feb 25, 2014 · 15 comments
Milestone

Comments

@gmatej
Copy link

gmatej commented Feb 25, 2014

When testing kundera 2.10 with tomee 1.6 I get an exception like this:
java.lang.IllegalArgumentException: kundera.client property is missing for persistence

Similliar to this SO post. Alzough I am not using spring.
http://stackoverflow.com/questions/21700915/error-kundera-client-property-is-missing-for-persistence

When changing to 2.9.1, everything works.

@mevivs
Copy link
Collaborator

mevivs commented Feb 25, 2014

Defining persistence properties as part of persistence.xml or as an external property map?

-Vivek

@gmatej
Copy link
Author

gmatej commented Feb 25, 2014

Yes, as persistence.xml file

Matej

@mevivs
Copy link
Collaborator

mevivs commented Feb 26, 2014

Please share crud code snippet and persistence.xml

-Vivek

@gmatej
Copy link
Author

gmatej commented Feb 26, 2014

It's very simple setup. Altough I have 2 PU units. Today I reproduced the problem, only cganging version number from 2.9.1 to 2.10. Produces me the kundera.client property error.

@get
public Response getResources() {

    KunderaUser kunderaUser = new KunderaUser();
    kunderaUser.setUserId("1");
    kunderaUser.setFirstName("Name");
    em.persist(kunderaUser);

    return Response.ok().build();
}

<persistence-unit name="bookPersistenceUnit" transaction-type="JTA">
    <provider>org.apache.openjpa.persistence.PersistenceProviderImpl</provider>
    <jta-data-source>jdbc/book</jta-data-source>
    <class>com.book.model.AppUser</class>
    <exclude-unlisted-classes>true</exclude-unlisted-classes>
    <properties>
    </properties>
</persistence-unit>
<persistence-unit name="bookCassandraPersistenceUnit">
    <provider>com.impetus.kundera.KunderaPersistence</provider>
    <class>com.book.model.KunderaUser</class>
    <exclude-unlisted-classes>true</exclude-unlisted-classes>
    <properties>
        <property name="kundera.nodes" value="localhost" />
        <property name="kundera.port" value="9160" />
        <property name="kundera.keyspace" value="book" />
        <property name="kundera.dialect" value="cassandra" />
        <property name="kundera.ddl.auto.prepare" value="update" />
        <property name="kundera.client" value="thrift" />
        <property name="kundera.client.lookup.class" value="com.impetus.client.cassandra.thrift.ThriftClientFactory" />
    </properties>
</persistence-unit>

@mevivs
Copy link
Collaborator

mevivs commented Feb 26, 2014

Thanks. Could you please email me sample project at [email protected] for quick resolution?

-Vivek

@janinko
Copy link
Contributor

janinko commented Feb 26, 2014

@mevivs
Copy link
Collaborator

mevivs commented Feb 26, 2014

Duplicate of #526?

-Vivek

@tsbatista
Copy link

I have the same use case as this. If i set the property, i get the exception mentioned by janinko. If i unset it from my persistence.xml, i get the message from https://github.com/impetus-opensource/Kundera/blob/kundera-2.10/src/jpa-engine/core/src/main/java/com/impetus/kundera/metadata/model/PersistenceUnitMetadata.java#L532

Looking at both conditions, I would say that even if this is related to #526, the if condition on the PersistenceUnitConfiguration still needs to be checked as i think there is a contradiction there.

@mevivs
Copy link
Collaborator

mevivs commented Feb 26, 2014

With fix provided for #526, i guess, additional check on
https://github.com/impetus-opensource/Kundera/blob/kundera-2.10/src/jpa-engine/core/src/main/java/com/impetus/kundera/metadata/model/PersistenceUnitMetadata.java#L532

https://github.com/impetus-opensource/Kundera/blob/kundera-2.10/src/jpa-engine/core/src/main/java/com/impetus/kundera/configure/PersistenceUnitConfiguration.java#L133

not required.As it is implicitly handled before invocation of getClient(). PersistenceUnitMetadata and PersistenceUnitConfiguration are meant for properties specific for persistence.xml.

Please verify with latest trunk. It should work.

-Vivek

@tsbatista
Copy link

I think this particular issue is now solved. That was fast!!!

Thank you

@gmatej
Copy link
Author

gmatej commented Feb 27, 2014

Vivek.

Is this issue closed or would you need the small project still?
Btw, this is sure OK?
if (puInfo.getProperties().getProperty(PersistenceProperties.KUNDERA_CLIENT_FACTORY) != null)

Best regards

Matej

@mevivs
Copy link
Collaborator

mevivs commented Feb 27, 2014

Yes, i guess it should work. Could you please verify it with latest trunk?

-Vivek

@pires
Copy link
Contributor

pires commented Feb 27, 2014

I said this before, but here I come again. It would be great if commits would reference issues in the commit logs. That way, people could know what changes have been made to fix an issue, and eventually participate in reviewing it.

@mevivs
Copy link
Collaborator

mevivs commented Feb 27, 2014

As mentioned above, duplicate of #526. Indirectly fixed with #526. Commit history is available over there.

-Vivek

@gmatej
Copy link
Author

gmatej commented Feb 28, 2014

I ahve tried it. It works.

Altough had to disable units tests:)

Thanks!

Matej

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants