freemarker.template.Configuration (v.2.3.22) cannot be injected because of final method decleration in OSGI environment

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

freemarker.template.Configuration (v.2.3.22) cannot be injected because of final method decleration in OSGI environment

halil
Hi All,

I could not create a reference of freemarker.template.Configuration on OSGI blueprint file. I referenced it as below. Blueprint throwed exception which states that Configuration class has final method declerations. It seems that OSGI (org.apache.felix.framework-4.4.1) does not support injection of classes having final method declerations...

<reference id="freemarkerCfgRef" interface="freemarker.template.Configuration"  ext:proxy-method='classes' />

When I did below steps, I succeed.

1. create an interface of Configuration class
2. put it a new package named freemarker.template.api.
3. Configuration class now implements freemarker.template.api.FreeMarkerConfigurationInt
3. reference it as below

<reference id="freemarkerCfgRef" interface="freemarker.template.api.FreeMarkerConfigurationInt" />

Now, it works perfectly...

I read some mails of developers stating that freemarker works on OSGI but I could not succeed until I have done it as above...


I would like to inform you,


best,


-halil.

------------------------------------------------------------------------------
One dashboard for servers and applications across Physical-Virtual-Cloud
Widest out-of-the-box monitoring support with 50+ applications
Performance metrics, stats and reports that give you Actionable Insights
Deep dive visibility with transaction tracing using APM Insight.
http://ad.doubleclick.net/ddm/clk/290420510;117567292;y
_______________________________________________
FreeMarker-user mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/freemarker-user
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: freemarker.template.Configuration (v.2.3.22) cannot be injected because of final method decleration in OSGI environment

Daniel Dekany
Note that "works on OSGi" doesn't imply at all that it can be (easily)
proxyed (for Buleprint or whatever). It just means that you can drop
the jar into an OSGi container, and then can link to it from the other
bundles.

OTOH surely if somebody for some reason wants to proxy Configuration,
final methods make it hard (requires byte code manipulation). I will
consider making them non-final in 2.3.23.


Wednesday, May 20, 2015, 4:30:43 PM, halil wrote:

> Hi All,
>
> I could not create a reference of freemarker.template.Configuration
> on OSGI blueprint file. I referenced it as below. Blueprint throwed
> exception which states that Configuration class has final method
> declerations. It seems that OSGI (org.apache.felix.framework-4.4.1)
> does not support injection of classes having final method declerations...
>
> <reference id="freemarkerCfgRef"
> interface="freemarker.template.Configuration"  ext:proxy-method='classes' />
>
> When I did below steps, I succeed.
>
> 1. create an interface of Configuration class
> 2. put it a new package named freemarker.template.api.
> 3. Configuration class now implements
> freemarker.template.api.FreeMarkerConfigurationInt
> 3. reference it as below
>
> <reference id="freemarkerCfgRef"
> interface="freemarker.template.api.FreeMarkerConfigurationInt" />
>
> Now, it works perfectly...
>
> I read some mails of developers stating that freemarker works on
> OSGI but I could not succeed until I have done it as above...
>
>
> I would like to inform you,
>
>
> best,
>
>
> -halil.

--
Thanks,
 Daniel Dekany


------------------------------------------------------------------------------
One dashboard for servers and applications across Physical-Virtual-Cloud
Widest out-of-the-box monitoring support with 50+ applications
Performance metrics, stats and reports that give you Actionable Insights
Deep dive visibility with transaction tracing using APM Insight.
http://ad.doubleclick.net/ddm/clk/290420510;117567292;y
_______________________________________________
FreeMarker-user mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/freemarker-user
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Someone feels like picking up the OSGi and Felix issues? Was: freemarker.template.Configuration (v.2.3.22) cannot be injected because of final method decleration in OSGI environment

Daniel Dekany
On second though, having some final methods is not a problem. The
problem is simply that Freemarker doesn't define a service interface,
which then Configuration would implement (and then only the methods
that are also in the service interface must be non-final). If I add a
such interface (is freemarker.template.FreemarkerService a good
name?), will you or somebody else test if now it indeed works with
Felix / Blueprint, and if the interface contains the methods that are
expected from a "Freemarker service" (I guess the setting setters
won't be there for example)?

We also have some other strange problem reported for Felix:
https://sourceforge.net/p/freemarker/bugs/428/

Someone feels like picking this up, and test that (A) the Freemarker
bundle (that's just freemarker.jar - it's already an OSGi bundle) can
be used under Felix without problems from a different bundle via its
package exports, and (B) that it can be used as a Blueprint service
out-of-the-box? Ideally, testing means testing in the form of a JUnit
tests.

--
Thanks,
 Daniel Dekany


Thursday, May 21, 2015, 12:59:25 AM, Daniel Dekany wrote:

> Note that "works on OSGi" doesn't imply at all that it can be (easily)
> proxyed (for Buleprint or whatever). It just means that you can drop
> the jar into an OSGi container, and then can link to it from the other
> bundles.
>
> OTOH surely if somebody for some reason wants to proxy Configuration,
> final methods make it hard (requires byte code manipulation). I will
> consider making them non-final in 2.3.23.
>
>
> Wednesday, May 20, 2015, 4:30:43 PM, halil wrote:
>
>> Hi All,
>>
>> I could not create a reference of freemarker.template.Configuration
>> on OSGI blueprint file. I referenced it as below. Blueprint throwed
>> exception which states that Configuration class has final method
>> declerations. It seems that OSGI (org.apache.felix.framework-4.4.1)
>> does not support injection of classes having final method declerations...
>>
>> <reference id="freemarkerCfgRef"
>> interface="freemarker.template.Configuration"  ext:proxy-method='classes' />
>>
>> When I did below steps, I succeed.
>>
>> 1. create an interface of Configuration class
>> 2. put it a new package named freemarker.template.api.
>> 3. Configuration class now implements
>> freemarker.template.api.FreeMarkerConfigurationInt
>> 3. reference it as below
>>
>> <reference id="freemarkerCfgRef"
>> interface="freemarker.template.api.FreeMarkerConfigurationInt" />
>>
>> Now, it works perfectly...
>>
>> I read some mails of developers stating that freemarker works on
>> OSGI but I could not succeed until I have done it as above...
>>
>>
>> I would like to inform you,
>>
>>
>> best,
>>
>>
>> -halil.
>


------------------------------------------------------------------------------
_______________________________________________
FreeMarker-user mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/freemarker-user
Loading...