Sure. In order of gotcha:
1. CDI: I hadn't declared beans.xml for my plugin
2. Dependencies: I had scaffold-impl as a dependency
3. Seam Render: I was using .getCompiledTemplate().getTemplate() instead of
.getSourceTemplateResource().getInputStream()
4. Class loading: I was loading some resources as "foo/bar" instead of
"/foo/bar"
5. Class loading: getClass().getResourceAsStream() works differently depending on which
JAR the class was loaded from. So for example the
getClass().getResourceAsStream() that lives inside metawidget.jar couldn't see the
resources that were declared in my plugin.jar
6. Dependencies: I hadn't included JPA and Hibernate Validator as compile-time
dependencies
These are all things that caused my packaged plugin to fail, even though all unit tests
(including forge-test-harness) passed.
Regards,
Richard.
On 2/03/2012 4:15 PM, Lincoln Baxter, III wrote:
Responses inline.
Thanks,
Lincoln
On Thu, Mar 1, 2012 at 4:38 PM, Richard Kennard <richard(a)kennardconsulting.com
<mailto:richard@kennardconsulting.com>> wrote:
Lincoln,
Can I ask you to clarify some things:
1. When you say 'compile time dependency' do you mean
<scope>provided</scope> or <scope>compile</scope>? I note that
hibernate-jpa-api.jar is already
shipped with Forge, so I'd be keen to reuse that rather than embed a new JAR if
possible?
Either should be fine. Don't worry about re-using dependencies. The idea of Modular
classloading is that you can clutter all you want and things will
still be isolated here. We're also not concerned with wasting space at this point
since plugins are installed separately from the runtime.
2. Which JAR should I be attaching to? hibernate-jpa-api.jar or persistence-api.jar?
Because I don't think the latter is shipped with Forge?
Either, see above.
3. I've hit half a dozen gotchas like this between unit tests and testing
'for real'. I know I've mentioned this before, but it really brings home
the need
for an integration test environment for Forge that is more realistic than
forge-test-harness. It'd be awesome if we could move in that direction.
It would be awesome :) however, if you could identify specific gotchas, that would help
until this becomes a reality.
Regards,
Richard.
On 2/03/2012 4:22 AM, Lincoln Baxter, III wrote:
> Add the javax.persistence APIs as a compile time dependency to your plugin's
POM. This is expected behavior AFAIK.
>
> Unfortunately, I believe you are probably seeing these classes resolve in your
IDE because of this pom.xml entry:
>
> <dependency>
> <groupId>org.jboss.forge</groupId>
> <artifactId>forge-javaee-impl</artifactId>
> <version>${forge.version}</version>
> <scope>test</scope>
> </dependency>
>
> Which is needed for testing... Damn the IDEs.
>
> ~Lincoln
>
> On Thu, Mar 1, 2012 at 1:41 AM, Richard Kennard
<richard(a)kennardconsulting.com <mailto:richard@kennardconsulting.com>
<mailto:richard@kennardconsulting.com
<mailto:richard@kennardconsulting.com>>> wrote:
>
> Hi guys,
>
> I'm struggling to get the AeroGear plugin working. It runs fine in unit
tests, but when packaged as a standalone plugin I get the error below.
>
> It appears my module does not have access to javax.persistence.*
(hibernate-jpa-2.0-api-1.0.1.Final.jar or similar). How do I declare this
dependency?
>
> Regards,
>
> Richard.
>
> ---
>
> [test] test $ scaffold from-entity com.test.model.* --scaffoldType
aerogear
> java.lang.reflect.InvocationTargetException
> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
> at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
> at java.lang.reflect.Method.invoke(Method.java:597)
> at
org.jboss.forge.shell.command.Execution.perform(Execution.java:149)
> at
org.jboss.forge.shell.command.fshparser.FSHRuntime.run(FSHRuntime.java:125)
> at
org.jboss.forge.shell.command.fshparser.FSHRuntime.run(FSHRuntime.java:63)
> at
org.jboss.forge.shell.ShellImpl$ExecutorThread.run(ShellImpl.java:829)
> at org.jboss.forge.shell.ShellImpl.execute(ShellImpl.java:852)
> at org.jboss.forge.shell.ShellImpl.doShell(ShellImpl.java:642)
> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
> at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
> at java.lang.reflect.Method.invoke(Method.java:597)
> at
org.jboss.weld.bean.proxy.AbstractBeanInstance.invoke(AbstractBeanInstance.java:48)
> at
org.jboss.weld.bean.proxy.ProxyMethodHandler.invoke(ProxyMethodHandler.java:125)
> at
org.jboss.forge.shell.ShellImpl$Proxy$_$$_WeldClientProxy.doShell(ShellImpl$Proxy$_$$_WeldClientProxy.java)
> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
> at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
> at java.lang.reflect.Method.invoke(Method.java:597)
> at
org.jboss.weld.util.reflection.SecureReflections$13.work(SecureReflections.java:305)
> at
org.jboss.weld.util.reflection.SecureReflectionAccess.run(SecureReflectionAccess.java:54)
> at
org.jboss.weld.util.reflection.SecureReflectionAccess.runAsInvocation(SecureReflectionAccess.java:163)
> at
org.jboss.weld.util.reflection.SecureReflections.invoke(SecureReflections.java:299)
> at
org.jboss.weld.introspector.jlr.WeldMethodImpl.invokeOnInstance(WeldMethodImpl.java:188)
> at
org.jboss.weld.introspector.ForwardingWeldMethod.invokeOnInstance(ForwardingWeldMethod.java:59)
> at
org.jboss.weld.injection.MethodInjectionPoint.invokeOnInstanceWithSpecialValue(MethodInjectionPoint.java:198)
> at
org.jboss.weld.event.ObserverMethodImpl.sendEvent(ObserverMethodImpl.java:282)
> at
org.jboss.weld.event.ObserverMethodImpl.sendEvent(ObserverMethodImpl.java:265)
> at
org.jboss.weld.event.ObserverMethodImpl.notify(ObserverMethodImpl.java:234)
> at
org.jboss.weld.manager.BeanManagerImpl.notifyObservers(BeanManagerImpl.java:635)
> at
org.jboss.weld.manager.BeanManagerImpl.fireEvent(BeanManagerImpl.java:622)
> at
org.jboss.weld.manager.BeanManagerImpl.fireEvent(BeanManagerImpl.java:616)
> at org.jboss.forge.shell.Bootstrap$1.run(Bootstrap.java:120)
> at java.lang.Thread.run(Thread.java:662)
> Caused by: java.lang.NoClassDefFoundError: javax/persistence/Lob
> at
org.metawidget.inspector.jpa.JpaInspector.inspectProperty(JpaInspector.java:86)
> at
org.metawidget.inspector.impl.BaseObjectInspector.inspectTraits(BaseObjectInspector.java:343)
> at
org.metawidget.inspector.impl.BaseObjectInspector.inspectAsDom(BaseObjectInspector.java:243)
> at
org.metawidget.inspector.impl.BaseObjectInspector.inspectAsDom(BaseObjectInspector.java:69)
> at
org.metawidget.inspector.composite.CompositeInspector.runInspector(CompositeInspector.java:241)
> at
org.metawidget.inspector.composite.CompositeInspector.runInspectors(CompositeInspector.java:220)
> at
org.metawidget.inspector.composite.CompositeInspector.inspectAsDom(CompositeInspector.java:167)
> at
org.metawidget.inspector.composite.CompositeInspector.inspectAsDom(CompositeInspector.java:151)
> at
org.metawidget.inspector.composite.CompositeInspector.inspectAsDom(CompositeInspector.java:53)
> at
org.metawidget.pipeline.base.BasePipeline.inspectAsDom(BasePipeline.java:344)
> at
org.metawidget.statically.StaticMetawidget.inspect(StaticMetawidget.java:305)
> at
org.metawidget.statically.StaticMetawidget.write(StaticMetawidget.java:251)
> at
org.jboss.forge.scaffold.aerogear.AeroGearScaffold.generateFromEntity(AeroGearScaffold.java:218)
> at
org.jboss.forge.scaffold.plugins.ScaffoldPlugin.generateFromEntity(ScaffoldPlugin.java:174)
> ... 36 more
>
> _______________________________________________
> forge-dev mailing list
> forge-dev(a)lists.jboss.org <mailto:forge-dev@lists.jboss.org>
<mailto:forge-dev@lists.jboss.org <mailto:forge-dev@lists.jboss.org>>
>
https://lists.jboss.org/mailman/listinfo/forge-dev
>
>
>
>
> --
> Lincoln Baxter, III
>
http://ocpsoft.com
>
http://scrumshark.com
> "Keep it Simple"
>
>
> _______________________________________________
> forge-dev mailing list
> forge-dev(a)lists.jboss.org <mailto:forge-dev@lists.jboss.org>
>
https://lists.jboss.org/mailman/listinfo/forge-dev
_______________________________________________
forge-dev mailing list
forge-dev(a)lists.jboss.org <mailto:forge-dev@lists.jboss.org>
https://lists.jboss.org/mailman/listinfo/forge-dev
--
Lincoln Baxter, III
http://ocpsoft.com
http://scrumshark.com
"Keep it Simple"
_______________________________________________
forge-dev mailing list
forge-dev(a)lists.jboss.org
https://lists.jboss.org/mailman/listinfo/forge-dev