JavaEE 6: Can't compile #Resource(lookup="") - java-ee-6

I am trying to use #Resource(lookup="") to look up a resource configured in Glassfish 3.1. I am using Eclipse 3.5.
I've set -Djava.endorsed.dirs=${GLASSFISH_HOME}/modules/endorsed and added javax.annotation.jar to my projects build bath but still it doesn't compile.
I am not able to see the lookup parameter with #Resource.
Could someone help me understand why am I not getting the lookup parameter with #Resource?

Are you sure the javax.annotation.jar that you are using is the one for JavaEE6 (and not for a prior version), since lookup was introduced in JavaEE 6. Check the MANIFEST of that jar to confirm.

Related

kie-maven-plugin for Gradle Drools 6.4

We are developing a Drools application and our organization has standardized on Gradle. We need to use the kie-maven-plugin to create and compile our rules in a KJar. This is so we can hot swap new versions of the rules. Is there a Gradle version of this plugin available? I don’t think that Maven plugins can be used in Gradle.
No, you need to port, I think its this project: https://github.com/kiegroup/droolsjbpm-integration/tree/master/kie-maven-plugin
However there is a way of doing drools as resource files like here: https://github.com/Spantree/drools-examples/
and this line is what got me stuck: https://github.com/Spantree/drools-examples/blob/master/src/test/groovy/net/spantree/examples/drools/helloworld/HelloWorldSpec.groovy#L19
(They just get the session directly from container, ignoring getting a base first)
This does not give you the compile time checks the maven module gives you.
However hot swapping resource based drools should be easier (I think).

Grails create-controller fails (inside Eclipse)

first off: sorry if the question should not belong here.
I am fairly new to grails and wanted to set it up with eclipse (Spring Tool Suite + Grails/Groovy plugin).
But already the creation of a HelloWord controller fails with huge exeptions.
I did set JAVA_HOME and GRAILS_HOME in my environment variables in windows.
I keep it short I uploaded it to pastebin: http://pastebin.com/aesgcyP7
As you can see it fails with:
\HelloWorldController.groovy: 1: unexpected token: package # line 1,
column 1.
package 7daystobuild
Background Info: I also tried newer grails versions (2.2.4, since the plugin uses 2.2.3) and both jdk 1.7 and 1.6)
Thanks
I don't think your package name is valid. I've never officially looked it up for Groovy, but I believe Groovy follows Java naming conventions for packages, which states you can't have package names start with a digit.

Configuring NetBeans 7.3 JPQL editor?

I have a RESTful service that builds and runs fine. However, when I try to use the JPQL editor, it gives the error:
java.lang.Exception: You need to add your persistence provider library either to project classpath or registed as Ant Library within Netbeans
You need to register database connection on Services tab
I'm using EclipseLink 2.4.1 as my persistence library, and I already have a library added in the Ant manager as "EclipseLink 2.4." When that failed, I made a library called "EclipseLink (JPA 2.0)(default)" to match the persistence.xml GUI name for it. I even tried creating a library named "org.eclipse.persistence.jpa.PersistenceProvider. All failed and now I'm stumped.
I have a connection the SQL Server database I'm using and it works fine.
I really am unsure of what I need to do to get this working. The editor seems like it would be a great boon, but there doesn't seem to be much documentation on it, nor questions with problems similar to mine. If anybody can help, that would be great.

NO EJB found in .war

I've created a Dynamic Web Project in Eclipse. I have 2 beans, 1 #Entity and the other #Stateless. I've deployed the war to Geronimo 2.2.1 with Tomcat 6 with a warning:
Unresolved ejb reference "com.myconnection.servlet.AddServlet/srvc" in bean
"GeronimoEnc". Will attempt resolution again at runtime.
I have a form on a .jsp with an action to a servlet (AddServlet). The servlet is trying to reference my #Stateless bean (via interface). However, once I hit submit on my form to go to the servlet, I get this error:
java.lang.InstantiationException: Some objects to be injected were not found in jndi:
[javax.naming.NameNotFoundException: No EJB found for reference "com.
I also have my persistence.xml file in src/META-INF, I'm not positive if that's where it should be.
What could I be doing wrong? Thanks
Support for deploying WAR files with EJBs is fixed (but possibly not available; see the following text) in Geronimo 3.0, going by bug report 5117. Going by this report, dependency injection in 2.2.1 is likely to fail.
There is one report on the mailing list, suggesting that Geronimo 3.0 M1 might be used for validating whether dependency injection works for EJBs deployed in a web-application; this is however against a query raised with respect to a failure on the same topic. Reproducing the salient contents of the mail:
Łukasz:
Geronimo is not able to inject #EJB
into a servlet. Both SLSB and my
serlvet are packaged in war. ... By
looking at the release notes I know
that EJB 3.1 is supported only
partially. I take it that the part
that is not yet implemented in
deploying EJBs inside war package?
Ivan:
Hmm, IIRC, the EJB injection should
work in the M1 release, although it
have some bugs in EJB 3.1
integration. I would suggest to use
the latest trunk codes (just update
some codes to try to work around the
address binding issue on the building
machine, hopefully a snapshot build
could be generated in the next round),
as we got a much better TCK result
comparing with M1 release. JCDI
related packages are definitely
included in the latest trunk build.
Going all of the above, 3.0 M1 would be the release to attempt this at the moment, but there is surely some possibility of this feature being absent (given that bug 5117 does not appeared to be in the list of fixed bugs in the release notes).

Where to put the User Library for Eclipse-Dali-Hibernate integration?

I am struggling with the configuration of the Eclipse Dali plugin and Hibernate. The version I'm using is as recommended:
Eclipse 3.6.1 (Helios SR1) IDE for Java EE Developers (including Dali 2.3)
JBoss Tools 3.2 (for the Hibernate Tools plugin)
When configuring the Java Persistence properties for my project, I created a user library named "Hibernate JPA" and included the following JARs:
hibernate-distribution-3.6.1.Final\hibernate3.jar
hibernate-distribution-3.6.1.Final\lib\jpa\hibernate-jpa-2.0-api-1.0.0.Final.jar
hibernate-distribution-3.6.1.Final\lib\required\dom4j-1.6.1.jar
hibernate-distribution-3.6.1.Final\lib\required\slf4j-api-1.6.1.jar
hibernate-distribution-3.6.1.Final\lib\required\javassist-3.12.0.GA.jar
hibernate-distribution-3.6.1.Final\lib\required\commons-collections-3.1.jar
hibernate-distribution-3.6.1.Final\lib\required\antlr-2.7.6.jar
hibernate-distribution-3.6.1.Final\lib\required\jta-1.1.jar
As long as the hibernate-distribution-3.6.1.Final folder is outside of my project directory, everything works fine. However, if I put the Hibernate folder into the project directory, I get an error saying "Required class org.hibernate.SessionFactory does not exist in selected libraries":
The error text is wrong, the required class is definitely included in hibernate3.jar, and everything works as expected when I move the JARs outside of my project directory.
I have two questions about that:
I do not understand why the User Library behaves differently depending on whether the JARs are placed inside or outside of my project directory. Could anybody explain what's happening here?
I would like to have my project in SVN, including all the required libraries. Is there any way to configure Dali to accept User Libraries within the project directory?
Thank you very much.
I was having the same problem cos I forgot to add hibernate-jpa-2.0-api-1.0.0.Final.jar.
The only difference is that I'm using 3.5.1-Final cos 3.6.x seems not stable at the moment.
Actually, I'd prefer EclipseLink: everything works fine as a charm. I've wasted many hours with environment configuration :( Last time I've used Hibernate was years ago and looks like troubles to configure still are the same :(