NoSuchFieldError: DIRECT2, when <clinit> on QXxx class

185 views
Skip to first unread message

ajs men

unread,
Jun 18, 2013, 11:18:45 AM6/18/13
to quer...@googlegroups.com
Hi,

When I reference QXxx class static property (entity field mapping), static class initialization begins, and I get NoSuchFieldError: DIRECT2 on line:
private static final PathInits INITS = PathInits.DIRECT2;
I use maven and I've included dependency com.mysema.querydsl:querydsl-jpa:3.2.0
querydsl-core (version 3.2.0) is included in war (after build) and thats where PathInits is located but when i deploy application, mentioned error occurs : (

Please help!

Timo Westkämper

unread,
Jun 18, 2013, 12:10:03 PM6/18/13
to Querydsl on behalf of ajs men
Hi.

Are you sure your Maven dependencies are consistent? All the Querydsl modules on your classpath are 3.2.0?

Br,
Timo

--
You received this message because you are subscribed to the Google Groups "Querydsl" group.
To unsubscribe from this group and stop receiving emails from it, send an email to querydsl+u...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
 
 



--
Timo Westkämper
Mysema Oy
+358 (0)40 591 2172
www.mysema.com


ajs men

unread,
Jun 19, 2013, 2:31:57 AM6/19/13
to quer...@googlegroups.com
Hi,

thank you for such quick response! I configured maven dependencies as shown in http://www.querydsl.com/static/querydsl/3.2.0/reference/html/ch02.html#d0e123

<dependency>
<groupId>com.mysema.querydsl</groupId>
<artifactId>querydsl-apt</artifactId>
<version>${querydsl.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.mysema.querydsl</groupId>
<artifactId>querydsl-jpa</artifactId>
<version>${querydsl.version}</version>
</dependency>

I even checked packed war to see if in the WEB-INF\lib directory, the core module is included, as I found out that PathInits.DIRECT2 is in that module.
It was there, in the same version as the jpa module. Inside of it i found PathInits class with field DIRECT2 visible in plain text when looking at bytecode.
Maybe it has something to do with the fact, that app is a portlet, deployed on lirefay?

On Tuesday, June 18, 2013 6:10:03 PM UTC+2, Timo Westkämper wrote:
Hi.

Are you sure your Maven dependencies are consistent? All the Querydsl modules on your classpath are 3.2.0?

Br,
Timo

ajs men

unread,
Jun 19, 2013, 2:55:46 AM6/19/13
to quer...@googlegroups.com
Hi,

I am sorry for wasting your time, this was obviously problem with library linking. I thought that maybe querydsl itself has some strange dependencies, but when i figured out, that it was including only core (and some harmless commons) beside jpa module it became clear, that I must've had more than one class com.mysema.query.types.path.PathInits on the classpath. And I found it, it's one of liferay's pitfalls always forgot about : (

Sorry again, and thank you for your time!

Phuong Vu

unread,
Aug 21, 2013, 8:17:06 AM8/21/13
to quer...@googlegroups.com
Hi, I am having the same problem like yours and basically I am having the same configuration (like your previous post) though I am not using Liferay. So would you mind elaborating more on how you solve this one? Thank you so much in advance!
Best regards,
Vu

Maciej Wojterski

unread,
Aug 21, 2013, 8:53:01 AM8/21/13
to Querydsl on behalf of Phuong Vu
Hi,

This is problem with linking, it means that either ClassLoader loaded none or more than one class com.mysema.query.types.path.PathInits. In Liferay it was because I changed querydsl version between deployments of my application and that resulted in more than one querydsl-core.jar in deployment's libs. My suggestion is: check application class-path, or libraries loaded at runtime. Either you haven't provided library in runtime environment or you provided it more than once. If its maven project, check what is dependency:scope of querydsl-core. I hope it helps. If you have any more questions, feel free to ask ; )

Regards.


--
You received this message because you are subscribed to a topic in the Google Groups "Querydsl" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/querydsl/DKPCe-4a9jk/unsubscribe.
To unsubscribe from this group and all its topics, send an email to querydsl+u...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages