do you put in the line
Tapestry-Module-Classes: net.godcode.tapex.testlib.LibModule
manually or do you use a maven plugin to generate it?

if you do it manually ensure that you have exactly 2 linefeeds at the 
end of the MANIFEST.MF file or it won't work.... a really annoying Java
bug... 

just a guess :)

g,
kris




Chris Lewis <[EMAIL PROTECTED]> 
20.09.2007 14:51
Bitte antworten an
"Tapestry users" <[email protected]>


An
Tapestry users <[email protected]>
Kopie

Thema
Re: [T5] Can't make custom library work






Ick - that would be annoying if it was because you aren't using Jetty...
Answers to your questions:

1. No, my lib module has only that method.
2. Yes. When packaged it lives right beside the component class.
3. No. My template is simply this: "<div>${message}</div>"
4. Yes (see below).
5. No, not significantly (see below).

Here is are all files in my component jar:

META-INF/MANIFEST.MF
META-INF/maven/net.godcode.tapex.testlib/tapestry5-testlib/pom.xml
META-INF/maven/net.godcode.tapex.testlib/tapestry5-testlib/pom.properties
net/godcode/tapex/testlib/components/TestComp.class
net/godcode/tapex/testlib/components/TestComp.html
net/godcode/tapex/testlib/LibModule.class

Ignore the items under META-INF/maven/ - maven sticks these in generated 
artifacts.

Here is my MANIFEST.MF:

Manifest-Version: 1.0
Archiver-Version: Plexus Archiver
Created-By: Apache Maven
Built-By: chrislewis
Build-Jdk: 1.5.0_07
Tapestry-Module-Classes: net.godcode.tapex.testlib.LibModule

Again, maven sticks much of that in the manifest. The only line I tell 
maven to insert is "Tapestry-Module-Classes". This of course points to 
my lib module class.

Here are my exact source files, in case they are of help to you. See my 
earlier post on how I reference my components and the inconsistency, 
depending on if you use instrumentation or not.

TestComp.html (component template):
<div>${message}</div>

TestComp.java (component class):
package net.godcode.tapex.testlib.components;

import org.apache.tapestry.MarkupWriter;
import org.apache.tapestry.annotations.BeginRender;

/**
 * TestComp
 *
 * @author Chris Lewis Sep 19, 2007
 * @version $Id$
 */
public class TestComp {
 
    public String getMessage() {
        return "Test message";
    }
 
    @BeginRender
    void beginRender(MarkupWriter writer) {
        writer.write("??");
    }
}

Note that the beginRender was just a test. The result is output 
appearing before my template body, as expected.

LibModule.java (library module):
package net.godcode.tapex.testlib;

import org.apache.tapestry.ioc.Configuration;
import org.apache.tapestry.services.LibraryMapping;

/**
 * LibModule
 *
 * @author Chris Lewis Sep 19, 2007
 * @version $Id$
 */
public class LibModule {

    public static void 
contributeComponentClassResolver(Configuration<LibraryMapping> 
configuration) {
        configuration.add(new LibraryMapping("testlib", 
"net.godcode.tapex.testlib"));
    }
 
}

And thats it. I can refer to my components using "<t:testlib.TestComp/>" 
or with instrumentation "<div t:type="testlib/TestComp"/>" - note the 
difference. Deviations will cause an error, and this should be 
considered a bug.

Let me know how you progress, and share your exact source if you'd like.

sincerely,
chris

Kolesnikov, Alexander GNI wrote:
> I wonder if my problem is a classloader issue... I guess most people
> here are running Jetty why I am using Tomcat... 
>
> Which server do you use, Chris?
>
> -----Original Message-----
> From: Kolesnikov, Alexander GNI 
> Sent: 20 September 2007 11:17
> To: Tapestry users
> Subject: RE: [T5] Can't make custom library work
>
>
> Hi Chris,
>
> I know all this about how to reference the component. And I don't use
> Maven. I check the contents of the packaged JAR to see if everything as
> expected. And still, I can't make my trivial component available to the
> application. 
>
> Could you please tell me a few things about your library:
>
> 1. Does your library module contain anything but
> contributeComponentClassResolver() method?
> 2. Does your component(s) have a template, and if yes, is it packaged
> next to the component class, in the same Java package? 3. Do you use
> <html xmlns:t="..."> </html> in your component's template? 4. Do you
> package components and module in the same way as I do:
>
> 
>>> META-INF/MANIFEST.MF
>>> com/test/TestModule.class
>>> com/test/components/TestComp.class
>>> com/test/components/TestComp.html
>>> 
>
> 5. Is your MANIFEST.MF significantly different from mine:
>
> 
>>> Manifest-Version: 1.0
>>> Tapestry-Module-Classes: com.test.TestModule
>>> 
>
> Thanks,
>
> Alex
>
>
>
> -----Original Message-----
> From: Chris Lewis [mailto:[EMAIL PROTECTED] 
> Sent: 19 September 2007 18:29
> To: Tapestry users
> Subject: Re: [T5] Can't make custom library work
>
>
> Ok I've made some progress.
>
> First of all, my component not loading issue was a problem with 
> eclipse/maven plugin. As I said I created a different project for my 
> test component lib, also using maven, and used mvn install to install 
> the artifact to my local repo. I manually added this artifact as a 
> dependency to my Tapestry app's pom.xml, and then things got a bit odd. 
> The maven 2 plugin creates an eclipse library that dynamically includes 
> all artifact jars of each artifact listed as a dependency in the pom. 
> However, with my test lib it didn't to this. Instead it showed a bland 
> folder icon with the same name as my test lib project. I verified this 
> was caused by my pom entry by removing the dep from the pom and cleaning
>
> the project. So to confirm this test I created a "normal" user library 
> (called "Mine") and manually added the test lib artifact to it. Now I am
>
> able to use my component in my tap app! If anyone has any suggestions 
> for configuring eclipse/m2 plugin to behave, that'd be much appreciated!
>
> Now how to reference the component. I've noticed some slight 
> inconsistencies in using components (or passing component params) in 
> templates. For my component, if I want to use tap's invisible 
> instrumentation, I have to do this:
>
> <div t:type="testlib/TestComp"/>
>
> Note that this WILL NOT work:
>
> <div t:type="testlib.TestComp"/>
>
> However, the inverse is true using tap-namespaced tags:
>
> <t:testlib.TestComp/>
>
> Works, while this DOES NOT:
>
> <t:testlib/TestComp/>
>
> That makes sense because "<t:testlib/TestComp/>" is invalid XML, but the
>
> fact that "<div t:type="testlib.TestComp"/>" causes an error is 
> inconsistent, and I find it a bit annoying.
>
> I hope this helps - let me know how you fare.
>
> sincerely,
> chris
>
> Kolesnikov, Alexander GNI wrote:
> 
>> Hi Chris,
>>
>> The only idea I have so far is that the problem is in HTML template
>> that goes into the same package as the page class. I would try 
>> creating a component without template to test this. Do not have time 
>> at the moment though, will try later.
>>
>> I suspect that T5 with its pro-Maven orientation expects to see HTML
>> stuff in some other place, like resources.
>>
>> I wonder if Ted could give us a hint on how he managed to package his
>> components...
>>
>> Cheers,
>>
>> Alexander
>>
>> -----Original Message-----
>> From: Chris Lewis [mailto:[EMAIL PROTECTED]
>> Sent: 19 September 2007 14:59
>> To: Tapestry users
>> Subject: Re: [T5] Can't make custom library work
>>
>>
>> Hi Alexander,
>>
>> I too am curious about this - I'm in the same situation. I've started 
>> poking into ComponentClassResolverImpl but haven't caught anything
>> 
> yet. 
> 
>> Do tell if you discover anything.
>>
>> sincerely,
>> chris
>>
>> Kolesnikov, Alexander GNI wrote:
>> 
>> 
>>> Finally, logging shows that contributeComponentClassResolver() method
>>> 
>
> 
>>> in the library's module actually runs. Does Tapestry expect the 
>>> components not to be POJOs? Questions, questions... Will go look into
>>> 
>
> 
>>> the source.
>>>
>>> -----Original Message-----
>>> From: Kolesnikov, Alexander GNI
>>> Sent: 19 September 2007 13:45
>>> To: Tapestry users
>>> Subject: RE: [T5] Can't make custom library work
>>>
>>>
>>> The additional detail is that if I change the reference in the 
>>> manifest misspelling the module name, the application doesn't start, 
>>> throwing ClassNotFoundException. Which proves that Tapestry does read
>>> 
>
> 
>>> the manifest and tries to load the library's module. Why it doesn't
>>> see the components then?
>>>
>>> -----Original Message-----
>>> From: Kolesnikov, Alexander GNI
>>> Sent: 19 September 2007 11:45
>>> To: Tapestry users
>>> Subject: [T5] Can't make custom library work
>>>
>>>
>>> I am trying to create and use a trivial custom library.
>>>
>>> Here is the component:
>>>
>>> TestComp.java:
>>>
>>> package com.test.components;
>>>
>>> public class TestComp {
>>>              public String getMessage() {
>>>                              return "Test message";
>>>              }
>>> }
>>>
>>> TestComp.html:
>>>
>>> <html xmlns:t="http://tapestry.apache.org/schema/tapestry_5_0_0.xsd";>
>>>              <p>${message}</p>
>>> </html>
>>>
>>> Here is its module:
>>>
>>> package com.test;
>>>
>>> import org.apache.tapestry.ioc.Configuration;
>>> import org.apache.tapestry.services.LibraryMapping;
>>>
>>> public class TestModule {
>>>              public static void 
>>> contributeComponentClassResolver(Configuration<LibraryMapping>
>>> configuration){
>>>                              configuration.add(new 
LibraryMapping("test",
>>> "com.test"));
>>>              }
>>> }
>>>
>>> Here is the manifest:
>>>
>>> Manifest-Version: 1.0
>>> Tapestry-Module-Classes: com.test.TestModule
>>>
>>>
>>> The testlib.jar is packaged like so:
>>>
>>> META-INF/MANIFEST.MF
>>> com/test/TestModule.class
>>> com/test/components/TestComp.class
>>> com/test/components/TestComp.html
>>>
>>> This JAR is placed into WEB-INF/lib of a T5 application and I am 
>>> trying to display the test component like so:
>>>
>>> <t:test.TestComp/>
>>>
>>> The result is:
>>>
>>> Unable to resolve component type 'test/TestComp' to a component class
>>> 
>
> 
>>> name. Available component types: core/ActionLink, core/BeanEditForm, 
>>> core/Checkbox, core/ComponentMessages, core/Delegate, core/Errors, 
>>> core/Form, core/FormSupportImpl, core/Grid, core/GridCell, 
>>> core/GridColumns, core/GridPager, core/GridRows, core/If, core/Label,
>>> 
>
> 
>>> core/Loop, core/Output, core/OutputRaw, core/PageLink, core/Palette,
>>> core/PasswordField, core/Radio, core/RadioGroup, core/RenderObject, 
>>> core/Select, core/Submit, core/TextArea, core/TextField, 
>>> fckeditor/Editor, jscalendar/DatePicker.
>>>
>>> Why Tapestry doesn't see my component I wonder?
>>>
>>> ---------------------------------------------------------------------
>>> -
>>> --
>>> ------
>>> CONFIDENTIALITY NOTICE: If you have received this email in error,
>>> 
>>> 
>> please
>> 
>> 
>>> immediately notify the sender by e-mail at the address shown.  This
>>> email transmission may contain confidential information.  This 
>>> information is intended only for the use of the individual(s) or
>>> 
>>> 
>> entity
>> 
>> 
>>> to whom it is intended even if addressed incorrectly.  Please delete
>>> 
>>> 
>> it
>> 
>> 
>>> from your files if you are not the intended recipient.  Thank you for
>>> 
>
> 
>>> your compliance.  Copyright 2007 CIGNA
>>>
>>> 
>>> 
>> ======================================================================
>> ==
>> 
>> 
>>> ======
>>>
>>> ---------------------------------------------------------------------
>>> -
>>> --
>>> ------
>>> CONFIDENTIALITY NOTICE: If you have received this email in error,
>>> 
>>> 
>> please
>> 
>> 
>>> immediately notify the sender by e-mail at the address shown.  This
>>> email transmission may contain confidential information.  This 
>>> information is intended only for the use of the individual(s) or
>>> 
>>> 
>> entity
>> 
>> 
>>> to whom it is intended even if addressed incorrectly.  Please delete
>>> 
>>> 
>> it
>> 
>> 
>>> from your files if you are not the intended recipient.  Thank you for
>>> 
>
> 
>>> your compliance.  Copyright 2007 CIGNA
>>>
>>> 
>>> 
>> ======================================================================
>> ==
>> 
>> 
>>> ======
>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: [EMAIL PROTECTED]
>>> For additional commands, e-mail: [EMAIL PROTECTED]
>>>
>>>
>>>
>>> ---------------------------------------------------------------------
>>> -
>>> --------
>>> CONFIDENTIALITY NOTICE: If you have received this email in error,
>>> 
>>> 
>> please immediately notify the sender by e-mail at the address shown.
>> This email transmission may contain confidential information.  This 
>> information is intended only for the use of the individual(s) or 
>> entity to whom it is intended even if addressed incorrectly.  Please 
>> delete it from your files if you are not the intended recipient. 
>> Thank you for your compliance.  Copyright 2007 CIGNA
>> 
>> ======================================================================
>> ==
>> ======
>> 
>> 
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: [EMAIL PROTECTED]
>>> For additional commands, e-mail: [EMAIL PROTECTED]
>>>
>>>
>>> 
>>> 
>>> 
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: [EMAIL PROTECTED]
>> For additional commands, e-mail: [EMAIL PROTECTED]
>>
>>
>>
>> ----------------------------------------------------------------------
>> --------
>> CONFIDENTIALITY NOTICE: If you have received this email in error,
>> 
> please immediately notify the sender by e-mail at the address shown.
> This email transmission may contain confidential information.  This
> information is intended only for the use of the individual(s) or entity
> to whom it is intended even if addressed incorrectly.  Please delete it
> from your files if you are not the intended recipient.  Thank you for
> your compliance.  Copyright 2007 CIGNA
> 
> ========================================================================
> ======
> 
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: [EMAIL PROTECTED]
>> For additional commands, e-mail: [EMAIL PROTECTED]
>>
>>
>> 
>> 
>
>
> ------------------------------------------------------------------------
> ------
> CONFIDENTIALITY NOTICE: If you have received this email in error, please
> immediately notify the sender by e-mail at the address shown.  This
> email transmission may contain confidential information.  This
> information is intended only for the use of the individual(s) or entity
> to whom it is intended even if addressed incorrectly.  Please delete it
> from your files if you are not the intended recipient.  Thank you for
> your compliance.  Copyright 2007 CIGNA
> ========================================================================
> ======
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>
>
> 
------------------------------------------------------------------------------
> CONFIDENTIALITY NOTICE: If you have received this email in error, please 
immediately notify the sender by e-mail at the address shown.  This email 
transmission may contain confidential information.  This information is 
intended only for the use of the individual(s) or entity to whom it is 
intended even if addressed incorrectly.  Please delete it from your files 
if you are not the intended recipient.  Thank you for your compliance. 
Copyright 2007 CIGNA
> 
==============================================================================
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>
> 


Reply via email to