Mike Hostetler | 18 Apr 21:52 2014
Picon

[groovy-user] Deployment Woes in Glassfish after adding Groovy classes

I hinted at this yesterday but now I have more time to dig into it . . . and have little answers.

We have a EJB3 application where the DAOs are injected into the Services.  I've been working on a long-range branch implementing some Groovy classes into our DAO layer. One thing I did was to have our DAOs extend a base DAO written in Groovy.

 At the end, I merged my branch into Trunk. When we try to deploy we get the following error:

 Cannot resolve reference Local ejb-ref name=com.foo.services.business.SomeServiceImpl/someDaoService,Local 3.x interface =com.foo.services.dao.SomeDaoService,ejb-link=null,lookup=,mappedName=,jndi-name=,refType=Session

With varying values of SomeServiceImpl and SomeDaoService. That is right -- I can deploy the exact same build multiple times and get different EJBs failing. 

I re-wrote the base DAO class from Groovy to Java and tweaked the DAOs to compile and still got the same error, so I changed it back.

We are using Maven to build our deployments and I used the groovy-eclipse-compiler. The project also uses Lombok, which I followed the directions on CodeHaus to configure. I get everything to build just fine, and the tests all pass . . . it's just deploying to our app server.

anyone have any ideas?

--
Mike Hostetler
http://mike.hostetlerhome.com/

KARR, DAVID | 17 Apr 20:13 2014
Picon

[groovy-user] Struggling with grape/grab

I'm trying to write a short groovy script to do a sql query.  I got it working by explicitly setting the
classpath to point to the Oracle driver jar, but I'd prefer to have this work with Grape.

I have the Oracle driver jar on a Nexus repo on our intranet.

This is my prototype script:
-----------------
#! env groovy
// <at> GrabResolver(name='OurRepo', root='http://...')
// <at> Grab(group='oracle.jdbc', module='oracle.jdbc.OracleDriver', version='1.0.0')
import groovy.sql.Sql
sql = Sql.newInstance('jdbc:oracle:thin: <at> host:1521:cclabprd',
                      'cclabro', 'password', 'oracle.jdbc.driver.OracleDriver')
sql.eachRow("select gd.GRPDSCRPTN_TITLE from GRPDSCRPTN gd join GROUPUSERS gu on
gu.GROUPUSERS_GROUPID = gd.GRPDSCRPTN_ID join USER_VIEW u on u.ID = gu.GROUPUSERS_USERID where
u.login = 'us2300'") { println "$it" }
---------------------

This runs quickly when I run it with a "-cp" command-line parameter pointing to my local install of the "ojdbc6.jar".

When I instead comment back in the  <at> GrabResolver and  <at> Grab lines, and then add
"-Dgroovy.grape.report.downloads=true" to the command line, it prints the following and then hangs:
------------------
Resolving dependency: oracle.jdbc#oracle.jdbc.OracleDriver;1.0.0 {default=[default]}
------------------

I first ran this with Groovy 2.2.2.  I also tried it with 2.3.0-beta2, but that fails with an even more useless error:
----------------------
Caught: java.net.MalformedURLException: unknown protocol: c
java.net.MalformedURLException: unknown protocol: c
-----------------------

When I added "-d" to the command line, I get this:
----------------------
        at java.net.URL.<init>(URL.java:592)
        at java.net.URL.<init>(URL.java:482)
        at java.net.URL.<init>(URL.java:431)
        at java.net.URI.toURL(URI.java:1096)
        at groovy.lang.GroovyCodeSource.<init>(GroovyCodeSource.java:162)
        at groovy.ui.GroovyMain.getScriptSource(GroovyMain.java:448)
        at groovy.ui.GroovyMain.processOnce(GroovyMain.java:627)
        at groovy.ui.GroovyMain.run(GroovyMain.java:379)
        at groovy.ui.GroovyMain.process(GroovyMain.java:365)
        at groovy.ui.GroovyMain.processArgs(GroovyMain.java:124)
        at groovy.ui.GroovyMain.main(GroovyMain.java:104)
....
--------------

I'm running this in Cygwin, so perhaps something is getting confused about navigating the PATH.

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email

Paco Zarate | 17 Apr 18:50 2014

[groovy-user] Groovy 2.3 trait can be used to embed java blocks?

Hi!

I have seen this request before, and I think that traits could provide a new approach for this question.

If I want use java code directly on a groovy file, would it be possible to create an annotation like ( <at> JavaTrait) for one of the traits, generate the bytecode for that trait as Java does and then mix it with the groovy bytecode?

This way we could embed java code in groovy and I think that the generated class should be usable by any jvm language.

Thanks!

davide_cavestro | 17 Apr 10:10 2014
Picon

[groovy-user] Will GREclipse 2.9 still support groovy 1.8 compiler?

I'm using GREclipse 2.9.0.xx-201403261719-e43j8 from
http://dist.springsource.org/milestone/GRECLIPSE/e4.3/ but I can't find a
compatible groovy 1.8 compiler support.
Do you plan to restore groovy 1.8 compatibility?

--
View this message in context: http://groovy.329449.n5.nabble.com/Will-GREclipse-2-9-still-support-groovy-1-8-compiler-tp5719260.html
Sent from the groovy - user mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email

UEHARA Junji | 17 Apr 04:48 2014
Picon

[groovy-user] Groovy 2.3 trait can be used for stackable trait pattern?

Hi,

I have question about trait feature of Grails 2.3.(I like it!)
My question is, is there a way to use Groovy 2.3 trait for "stackable trait pattern" like in which of Scala?

http://www.artima.com/scalazine/articles/stackable_trait_pattern.html

In the other words, is there a way to handle 'super' reference which respond to the upper trait in liner order which composed by (implements trait(s) and as/withTrait()).
Or is there any future plan for that?

Best regards,

--
UEHARA Junji
Jamie Echlin | 16 Apr 23:07 2014
Picon

[groovy-user] dynamically implement marker interfaces

Evening,

Is there some alchemy or mop-magic by which I can dynamically implement marker interfaces, such that instanceof will be true when I say it should be?

The instanceof happens in java code outside of my control, and also the instantiation of my groovy class is in javaland and outside my control, so I can swap it for a delegate or something.

Not sure if I making it more concrete will helpful...

G = new GroovyClass()

I want "G instance SomeMarkerInterface", called from java, to be true at my say-so.

cheers, jamie

Dirk Dittert | 16 Apr 16:25 2014

[groovy-user] Weird IncompatibleClassChangeError stack trace

Hi,

I'm running into a weird IncompatibleClassChangeError (see below) exception in one of my applications. Basically, there seems to be some disagreement over how many constructors there should be. Versions are consistent: Source is compiled with JDK 7 and Groovy 2.1.7. The code is executed with the same Java and Groovy version as it was compiled with.

The code of the class ModeE is quite simple. Something like this:

class SomeClass {
  public static enum ModeE { V1, V2, V3, V4 }

  ModeE someMode = ModeE.V1
  // more stuff here
}

Any ideas, what might be causing this and how to narrow it down?

Thanks,
Dirk

java.lang.IncompatibleClassChangeError: the number of constructors during runtime and compile time for pkg.subpkg.SomeClass$ModeE do not match. Expected -1 but got 2
at groovy.lang.MetaClassImpl.selectConstructorAndTransformArguments(MetaClassImpl.java:1410)
at org.codehaus.groovy.runtime.ScriptBytecodeAdapter.selectConstructorAndTransformArguments(ScriptBytecodeAdapter.java:234)
at pkg.subpkg.SomeClass$ModeE.$INIT(SomeClass.groovy)
at pkg.subpkg.SomeClass$ModeE.<clinit>(SomeClass.groovy)
at sun.misc.Unsafe.ensureClassInitialized(Native Method)
at sun.reflect.UnsafeFieldAccessorFactory.newFieldAccessor(UnsafeFieldAccessorFactory.java:43)
at sun.reflect.ReflectionFactory.newFieldAccessor(ReflectionFactory.java:140)
at java.lang.reflect.Field.acquireFieldAccessor(Field.java:949)
at java.lang.reflect.Field.getFieldAccessor(Field.java:930)
at java.lang.reflect.Field.get(Field.java:372)
at org.codehaus.groovy.reflection.CachedField.getProperty(CachedField.java:51)
at groovy.lang.MetaClassImpl.getProperty(MetaClassImpl.java:1624)
at groovy.lang.MetaClassImpl.getProperty(MetaClassImpl.java:3407)
at org.codehaus.groovy.runtime.callsite.ClassMetaClassGetPropertySite.getProperty(ClassMetaClassGetPropertySite.java:48)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callGetProperty(AbstractCallSite.java:227)
at pkg.subpkg.SomeClass.<init>(SomeClass.groovy:44)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:525)
at org.codehaus.groovy.reflection.CachedConstructor.invoke(CachedConstructor.java:77)
at org.codehaus.groovy.runtime.callsite.ConstructorSite$ConstructorSiteNoUnwrapNoCoerce.callConstructor(ConstructorSite.java:102)
at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCallConstructor(CallSiteArray.java:57)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callConstructor(AbstractCallSite.java:182)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callConstructor(AbstractCallSite.java:186)
at pkg.somesubpkg.SomeBuilder.createNode(SomeBuilder.groovy:19)
at groovy.util.BuilderSupport.doInvokeMethod(BuilderSupport.java:84)
at groovy.util.BuilderSupport.invokeMethod(BuilderSupport.java:64)
at org.codehaus.groovy.runtime.callsite.PogoMetaClassSite.call(PogoMetaClassSite.java:45)
at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:45)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:108)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:116)
at pkg.subpkg2.AClassHere.reporting(AClassHere.groovy:573)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:601)
at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:90)
at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:233)
at org.codehaus.groovy.runtime.metaclass.ClosureMetaClass.invokeMethod(ClosureMetaClass.java:361)
at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:909)
at org.codehaus.groovy.runtime.callsite.PogoMetaClassSite.callCurrent(PogoMetaClassSite.java:66)
at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCallCurrent(CallSiteArray.java:49)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callCurrent(AbstractCallSite.java:133)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callCurrent(AbstractCallSite.java:141)
at <someclass>$_run_closure1.doCall(RSQL:259)
at <someclass>$_run_closure1.doCall(RSQL)
. . .
at java.lang.Thread.run(Thread.java:722)
Will Lucas | 15 Apr 21:38 2014
Picon

[groovy-user] HTTPBuilder Version

Is the 0.8 snapshot available yet?

API Doc says 0.8 yet all I can find is 0.7.1

Thank you.


cesar.varona | 15 Apr 16:30 2014
Picon

[groovy-user] Static compilation results in generated class being loaded, not just compiled

Hi,

I'm using a mda tool that yields several thousand groovy scripts as
platform-specific model (around 50.000 for the time being). The tool can be
configured to produce scripts annotated with  <at> CompileStatic and I'm highly
interested in doing so, for my customer does appreciate the resulting
performance boost. Alas, this customer also emphasizes the need for all
these scripts to be already compiled when put into production. 

To compile all these annotated scripts has proved a much harder task to
tackle than anyone could imagine. Plain scripts with no  <at> CompileStatic
annotation can be compiled in several ways, all of them satisfyingly
efficient. Scripts get just compiled and no special perm-gen tuning is
needed, for the resulting classes do not get loaded. Whether I use the
groovyc ant task or directly the FileSystemCompiler from a main method, or
even plain CompilationUnits: anything does. It compiles my scripts smoothly
and, being these scripts independent from one another, I have been able to
even apply a multithreading scheme, althout it's not the permance booster it
could be expected because of collisions when accessing parent class loaders.

When the  <at> CompileStatic annotation is  used the groovy compiler behaves
quite differently. Classes are not only generated: the get loaded as they
are being compiled. This results in an ever increasing permgen space that
rather sooner than later gets depleted.

I would like to know if somebody else has experienced this issue when using
static compilation, which I'm not sure can be considered a bug or not. Any
scheme as to how to circumvent this problem would be highly appreciated.

With kind regards

César Varona

--
View this message in context: http://groovy.329449.n5.nabble.com/Static-compilation-results-in-generated-class-being-loaded-not-just-compiled-tp5719235.html
Sent from the groovy - user mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email

davide_cavestro | 15 Apr 10:48 2014
Picon

[groovy-user] Cannot find snapshots for groovy 2.2.3

Hi, I'm searching for the snapshots of groovy 2.2.3, but they don't seem
available on the  snapshots repo
<http://snapshots.repository.codehaus.org/org/codehaus/groovy/groovy/>  .
Isn't it strange? That version should have some interesting fixes (i.e. for 
GROOVY-6611 <http://jira.codehaus.org/browse/GROOVY-6611>  )

--
View this message in context: http://groovy.329449.n5.nabble.com/Cannot-find-snapshots-for-groovy-2-2-3-tp5719231.html
Sent from the groovy - user mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email

Schalk Cronjé | 14 Apr 17:37 2014
Picon

[groovy-user] hasProperty and static

If I have
class A {
    static final String CENTOS = 'Centos'
}

println A.metaClass.hasProperty(new A(),'CENTOS') // Prints 'CENTOS'
println A.metaClass.static.hasProperty('CENTOS') // Prints 'null'
FIrst println is clumsy and should not be necessary. Second println fails, but intuitively I would have expected it to work. WH\hat is the correct way to test for static properties?


(Using Groovy 2.2 + JDK8)
-- Schalk W. Cronjé <at> ysb33r

Gmane