NoClassDefFound - possibly having .NET keyword in namespace

View: New views
8 Messages — Rating Filter:   Alert me  

NoClassDefFound - possibly having .NET keyword in namespace

by kpowerinfinity :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hello,

I have been trying to compile Drools 5 to .NET using ikvm. I've had
good success with the past versions, however, in version 5, the
runtime throws a NoClassDefFound exception:
  InnerException: java.lang.NoClassDefFoundError
       Message="org.drools.base.extractors.BaseDoubleClassFieldReader"
       Source="IKVM.Runtime"
       StackTrace:
            at IKVM.NativeCode.java.lang.ClassLoader.defineClass1(Object
thisClassLoader, String name, Byte[] b, Int32 off, Int32 len, Object
pd, String source)
            at java.lang.ClassLoader.defineClass1(String , Byte[] ,
Int32 , Int32 , ProtectionDomain , String )
            at java.lang.ClassLoader.defineClass(String name, Byte[]
b, Int32 off, Int32 len, ProtectionDomain protectionDomain)
            at org.drools.base.ClassFieldAccessorCache.ByteArrayClassLoader.defineClass(String
name, Byte[] bytes, ProtectionDomain domain)
            at org.drools.base.ClassFieldAccessorFactory.getClassFieldReader(Class
clazz, String fieldName, CacheEntry cache)
            at org.drools.base.ClassFieldAccessorCache.CacheEntry.getReadAccessor(AccessorKey
key, Class cls)
            at org.drools.base.ClassFieldAccessorCache.getReadAcessor(ClassFieldReader
reader)
            at org.drools.base.ClassFieldAccessorStore.wire(ClassFieldReader
reader)
            at org.drools.base.ClassFieldAccessorStore.getReader(String
className, String fieldName, AcceptsReadAccessor target, AccessorType
accessorType)
            at org.drools.base.ClassFieldAccessorStore.getReader(String
className, String fieldName, AcceptsReadAccessor target)
            at org.drools.rule.builder.PatternBuilder.getFieldReadAccessor(RuleBuildContext
context, BaseDescr descr, ObjectType objectType, String fieldName,
AcceptsReadAccessor target, Boolean reportError)
            at org.drools.rule.builder.PatternBuilder.build(RuleBuildContext
, Pattern , FieldConstraintDescr , AbstractCompositeConstraint )
            at org.drools.rule.builder.PatternBuilder.buildConstraint(RuleBuildContext
, Pattern , Object , AbstractCompositeConstraint )
            at org.drools.rule.builder.PatternBuilder.build(RuleBuildContext
context, BaseDescr descr, Pattern prefixPattern)
            at org.drools.rule.builder.PatternBuilder.build(RuleBuildContext
context, BaseDescr descr)
            at org.drools.rule.builder.GroupElementBuilder.build(RuleBuildContext
context, BaseDescr descr, Pattern prefixPattern)
            at org.drools.rule.builder.RuleBuilder.build(RuleBuildContext
context)
            at org.drools.compiler.PackageBuilder.addRule(RuleDescr )
            at org.drools.compiler.PackageBuilder.addPackage(PackageDescr
packageDescr)
            at org.drools.compiler.PackageBuilder.addPackageFromDrl(Resource
resource)
            at org.drools.compiler.PackageBuilder.addKnowledgeResource(Resource
resource, ResourceType type, ResourceConfiguration configuration)
            at org.drools.builder.impl.KnowledgeBuilderImpl.add(Resource
resource, ResourceType type)

Interestingly, the class
"org.drools.base.extractors.BaseDoubleClassFieldReader" is actually
present in the assembly, and I have verified the same using the Object
explorer. However, the runtime can't find it, and I can also not find
it using the intellisense (and compiler) of Visual Studio because
"base" within the namespace is a C# keyword. I tried
org.drools.@... and that seems
to be valid (just like @event).

I couldn't find a good way to help the compiler/VM detect the class. I
have tried writing a ClassLoader that can do a string-replace from
org.drools.base to org.drools.@base, but haven't been able to (unable
to compile the CustomClassLoader file due to the presence of
ikvm.runtime.AssemblyClassLoader in the constructor -- I need to post
this separately).

Will really appreciate if somebody can help me figure out how to make
the class visible. I am guessing a C# keyword being in a java package
name could be a common scenario.

Regards,


Krishna Mehra

--
http://kpowerinfinity.wordpress.com
http://www.linkedin.com/in/kpowerinfinity

------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
trial. Simplify your report design, integration and deployment - and focus on
what you do best, core application coding. Discover what's new with
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
Ikvm-developers mailing list
Ikvm-developers@...
https://lists.sourceforge.net/lists/listinfo/ikvm-developers

Re: NoClassDefFound - possibly having .NET keyword in namespace

by Jeroen Frijters :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi,

I don't know what's going on (although it most likely is a class loader issue). I do know that it has nothing to with base being a C# keyword. Neither IKVM.NET nor the CLR care about C# keywords.

If you mail instructions on how to reproduce this issue, I'd be happy to have a look.

Regards,
Jeroen

> -----Original Message-----
> From: kpowerinfinity [mailto:kpowerinfinity@...]
> Sent: Saturday, August 29, 2009 5:45 PM
> To: ikvm-developers@...
> Subject: [Ikvm-developers] NoClassDefFound - possibly having .NET
> keyword in namespace
>
> Hello,
>
> I have been trying to compile Drools 5 to .NET using ikvm. I've had
> good success with the past versions, however, in version 5, the runtime
> throws a NoClassDefFound exception:
>   InnerException: java.lang.NoClassDefFoundError
>        Message="org.drools.base.extractors.BaseDoubleClassFieldReader"
>        Source="IKVM.Runtime"
>        StackTrace:
>             at
> IKVM.NativeCode.java.lang.ClassLoader.defineClass1(Object
> thisClassLoader, String name, Byte[] b, Int32 off, Int32 len, Object
> pd, String source)
>             at java.lang.ClassLoader.defineClass1(String , Byte[] ,
> Int32 , Int32 , ProtectionDomain , String )
>             at java.lang.ClassLoader.defineClass(String name, Byte[] b,
> Int32 off, Int32 len, ProtectionDomain protectionDomain)
>             at
> org.drools.base.ClassFieldAccessorCache.ByteArrayClassLoader.defineClas
> s(String
> name, Byte[] bytes, ProtectionDomain domain)
>             at
> org.drools.base.ClassFieldAccessorFactory.getClassFieldReader(Class
> clazz, String fieldName, CacheEntry cache)
>             at
> org.drools.base.ClassFieldAccessorCache.CacheEntry.getReadAccessor(Acce
> ssorKey
> key, Class cls)
>             at
> org.drools.base.ClassFieldAccessorCache.getReadAcessor(ClassFieldReader
> reader)
>             at
> org.drools.base.ClassFieldAccessorStore.wire(ClassFieldReader
> reader)
>             at org.drools.base.ClassFieldAccessorStore.getReader(String
> className, String fieldName, AcceptsReadAccessor target, AccessorType
> accessorType)
>             at org.drools.base.ClassFieldAccessorStore.getReader(String
> className, String fieldName, AcceptsReadAccessor target)
>             at
> org.drools.rule.builder.PatternBuilder.getFieldReadAccessor(RuleBuildCo
> ntext
> context, BaseDescr descr, ObjectType objectType, String fieldName,
> AcceptsReadAccessor target, Boolean reportError)
>             at
> org.drools.rule.builder.PatternBuilder.build(RuleBuildContext
> , Pattern , FieldConstraintDescr , AbstractCompositeConstraint )
>             at
> org.drools.rule.builder.PatternBuilder.buildConstraint(RuleBuildContext
> , Pattern , Object , AbstractCompositeConstraint )
>             at
> org.drools.rule.builder.PatternBuilder.build(RuleBuildContext
> context, BaseDescr descr, Pattern prefixPattern)
>             at
> org.drools.rule.builder.PatternBuilder.build(RuleBuildContext
> context, BaseDescr descr)
>             at
> org.drools.rule.builder.GroupElementBuilder.build(RuleBuildContext
> context, BaseDescr descr, Pattern prefixPattern)
>             at
> org.drools.rule.builder.RuleBuilder.build(RuleBuildContext
> context)
>             at org.drools.compiler.PackageBuilder.addRule(RuleDescr )
>             at
> org.drools.compiler.PackageBuilder.addPackage(PackageDescr
> packageDescr)
>             at
> org.drools.compiler.PackageBuilder.addPackageFromDrl(Resource
> resource)
>             at
> org.drools.compiler.PackageBuilder.addKnowledgeResource(Resource
> resource, ResourceType type, ResourceConfiguration configuration)
>             at
> org.drools.builder.impl.KnowledgeBuilderImpl.add(Resource
> resource, ResourceType type)
>
> Interestingly, the class
> "org.drools.base.extractors.BaseDoubleClassFieldReader" is actually
> present in the assembly, and I have verified the same using the Object
> explorer. However, the runtime can't find it, and I can also not find
> it using the intellisense (and compiler) of Visual Studio because
> "base" within the namespace is a C# keyword. I tried
> org.drools.@... and that seems
> to be valid (just like @event).
>
> I couldn't find a good way to help the compiler/VM detect the class. I
> have tried writing a ClassLoader that can do a string-replace from
> org.drools.base to org.drools.@base, but haven't been able to (unable
> to compile the CustomClassLoader file due to the presence of
> ikvm.runtime.AssemblyClassLoader in the constructor -- I need to post
> this separately).
>
> Will really appreciate if somebody can help me figure out how to make
> the class visible. I am guessing a C# keyword being in a java package
> name could be a common scenario.
>
> Regards,
>
>
> Krishna Mehra
>
> --
> http://kpowerinfinity.wordpress.com
> http://www.linkedin.com/in/kpowerinfinity
>
> -----------------------------------------------------------------------
> -------
> Let Crystal Reports handle the reporting - Free Crystal Reports 2008
> 30-Day trial. Simplify your report design, integration and deployment -
> and focus on what you do best, core application coding. Discover what's
> new with Crystal Reports now.  http://p.sf.net/sfu/bobj-july
> _______________________________________________
> Ikvm-developers mailing list
> Ikvm-developers@...
> https://lists.sourceforge.net/lists/listinfo/ikvm-developers

------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
trial. Simplify your report design, integration and deployment - and focus on
what you do best, core application coding. Discover what's new with
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
Ikvm-developers mailing list
Ikvm-developers@...
https://lists.sourceforge.net/lists/listinfo/ikvm-developers

Re: NoClassDefFound - possibly having .NET keyword in namespace

by kpowerinfinity :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi Jeroen,

Thanks for the prompt response.

To reproduce this:
1. Download drools-5.0.1 from jboss.org
2. Run:
ikvmc antlr-runtime-3.1.1.jar joda-time-1.6.jar
core-3.4.2.v_883_R34x.jar  xstream-1.3.1.jar jaxb-xjc-2.0.3.jar
jaxb-impl-2.0.3.jar milyn-smooks-javabean-1.1.jar jxl-2.4.2.jar
jxls-reader-0.9.6.jar  drools-decisiontables-5.0.1.jar
janino-2.5.15.jar mvel2-2.0.10.jar drools-core-5.0.1.jar
drools-api-5.0.1.jar drools-compiler-5.0.1.jar  jsr94-1.1.jar
-out:..\dotnet\drools5.dll -target:library
3. Add this as a reference to a VS project and try to use it to
compile a drools DRL file:

            java.io.InputStream source =new java.io.FileInputStream(filename);
            org.drools.builder.KnowledgeBuilderConfiguration kbc =
org.drools.builder.KnowledgeBuilderFactory.newKnowledgeBuilderConfiguration();
            org.drools.builder.KnowledgeBuilder builder =
org.drools.builder.KnowledgeBuilderFactory.newKnowledgeBuilder(kbc);
            builder.add(org.drools.io.ResourceFactory.newInputStreamResource(source),
org.drools.builder.ResourceType.DRL);
            if (builder.hasErrors())
            {
                Console.WriteLine("Error: " + builder.getErrors().ToString());
            }

            org.drools.KnowledgeBase kbase =
org.drools.KnowledgeBaseFactory.newKnowledgeBase();
            kbase.addKnowledgePackages(builder.getKnowledgePackages());
            return kbase;


It throws the exception I had earlier mailed. I can find the
org.drools.base.extractors.BaseDoubleClassFieldReader class in the
Object Explorer, but it seems the CLR is unable to find it at runtime.

Thanks, Krishna.

PS: A sample DRL file is attached.

--
http://kpowerinfinity.wordpress.com
http://www.linkedin.com/in/kpowerinfinity




On Sat, Aug 29, 2009 at 10:58 PM, Jeroen Frijters<jeroen@...> wrote:

> Hi,
>
> I don't know what's going on (although it most likely is a class loader issue). I do know that it has nothing to with base being a C# keyword. Neither IKVM.NET nor the CLR care about C# keywords.
>
> If you mail instructions on how to reproduce this issue, I'd be happy to have a look.
>
> Regards,
> Jeroen
>
>> -----Original Message-----
>> From: kpowerinfinity [mailto:kpowerinfinity@...]
>> Sent: Saturday, August 29, 2009 5:45 PM
>> To: ikvm-developers@...
>> Subject: [Ikvm-developers] NoClassDefFound - possibly having .NET
>> keyword in namespace
>>
>> Hello,
>>
>> I have been trying to compile Drools 5 to .NET using ikvm. I've had
>> good success with the past versions, however, in version 5, the runtime
>> throws a NoClassDefFound exception:
>>   InnerException: java.lang.NoClassDefFoundError
>>        Message="org.drools.base.extractors.BaseDoubleClassFieldReader"
>>        Source="IKVM.Runtime"
>>        StackTrace:
>>             at
>> IKVM.NativeCode.java.lang.ClassLoader.defineClass1(Object
>> thisClassLoader, String name, Byte[] b, Int32 off, Int32 len, Object
>> pd, String source)
>>             at java.lang.ClassLoader.defineClass1(String , Byte[] ,
>> Int32 , Int32 , ProtectionDomain , String )
>>             at java.lang.ClassLoader.defineClass(String name, Byte[] b,
>> Int32 off, Int32 len, ProtectionDomain protectionDomain)
>>             at
>> org.drools.base.ClassFieldAccessorCache.ByteArrayClassLoader.defineClas
>> s(String
>> name, Byte[] bytes, ProtectionDomain domain)
>>             at
>> org.drools.base.ClassFieldAccessorFactory.getClassFieldReader(Class
>> clazz, String fieldName, CacheEntry cache)
>>             at
>> org.drools.base.ClassFieldAccessorCache.CacheEntry.getReadAccessor(Acce
>> ssorKey
>> key, Class cls)
>>             at
>> org.drools.base.ClassFieldAccessorCache.getReadAcessor(ClassFieldReader
>> reader)
>>             at
>> org.drools.base.ClassFieldAccessorStore.wire(ClassFieldReader
>> reader)
>>             at org.drools.base.ClassFieldAccessorStore.getReader(String
>> className, String fieldName, AcceptsReadAccessor target, AccessorType
>> accessorType)
>>             at org.drools.base.ClassFieldAccessorStore.getReader(String
>> className, String fieldName, AcceptsReadAccessor target)
>>             at
>> org.drools.rule.builder.PatternBuilder.getFieldReadAccessor(RuleBuildCo
>> ntext
>> context, BaseDescr descr, ObjectType objectType, String fieldName,
>> AcceptsReadAccessor target, Boolean reportError)
>>             at
>> org.drools.rule.builder.PatternBuilder.build(RuleBuildContext
>> , Pattern , FieldConstraintDescr , AbstractCompositeConstraint )
>>             at
>> org.drools.rule.builder.PatternBuilder.buildConstraint(RuleBuildContext
>> , Pattern , Object , AbstractCompositeConstraint )
>>             at
>> org.drools.rule.builder.PatternBuilder.build(RuleBuildContext
>> context, BaseDescr descr, Pattern prefixPattern)
>>             at
>> org.drools.rule.builder.PatternBuilder.build(RuleBuildContext
>> context, BaseDescr descr)
>>             at
>> org.drools.rule.builder.GroupElementBuilder.build(RuleBuildContext
>> context, BaseDescr descr, Pattern prefixPattern)
>>             at
>> org.drools.rule.builder.RuleBuilder.build(RuleBuildContext
>> context)
>>             at org.drools.compiler.PackageBuilder.addRule(RuleDescr )
>>             at
>> org.drools.compiler.PackageBuilder.addPackage(PackageDescr
>> packageDescr)
>>             at
>> org.drools.compiler.PackageBuilder.addPackageFromDrl(Resource
>> resource)
>>             at
>> org.drools.compiler.PackageBuilder.addKnowledgeResource(Resource
>> resource, ResourceType type, ResourceConfiguration configuration)
>>             at
>> org.drools.builder.impl.KnowledgeBuilderImpl.add(Resource
>> resource, ResourceType type)
>>
>> Interestingly, the class
>> "org.drools.base.extractors.BaseDoubleClassFieldReader" is actually
>> present in the assembly, and I have verified the same using the Object
>> explorer. However, the runtime can't find it, and I can also not find
>> it using the intellisense (and compiler) of Visual Studio because
>> "base" within the namespace is a C# keyword. I tried
>> org.drools.@... and that seems
>> to be valid (just like @event).
>>
>> I couldn't find a good way to help the compiler/VM detect the class. I
>> have tried writing a ClassLoader that can do a string-replace from
>> org.drools.base to org.drools.@base, but haven't been able to (unable
>> to compile the CustomClassLoader file due to the presence of
>> ikvm.runtime.AssemblyClassLoader in the constructor -- I need to post
>> this separately).
>>
>> Will really appreciate if somebody can help me figure out how to make
>> the class visible. I am guessing a C# keyword being in a java package
>> name could be a common scenario.
>>
>> Regards,
>>
>>
>> Krishna Mehra
>>
>> --
>> http://kpowerinfinity.wordpress.com
>> http://www.linkedin.com/in/kpowerinfinity
>>
>> -----------------------------------------------------------------------
>> -------
>> Let Crystal Reports handle the reporting - Free Crystal Reports 2008
>> 30-Day trial. Simplify your report design, integration and deployment -
>> and focus on what you do best, core application coding. Discover what's
>> new with Crystal Reports now.  http://p.sf.net/sfu/bobj-july
>> _______________________________________________
>> Ikvm-developers mailing list
>> Ikvm-developers@...
>> https://lists.sourceforge.net/lists/listinfo/ikvm-developers
>


------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
trial. Simplify your report design, integration and deployment - and focus on
what you do best, core application coding. Discover what's new with
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
Ikvm-developers mailing list
Ikvm-developers@...
https://lists.sourceforge.net/lists/listinfo/ikvm-developers

VoucherIssueRules.drl (1K) Download Attachment

Re: NoClassDefFound - possibly having .NET keyword in namespace

by Jeroen Frijters :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi,

This does not reproduce the exception you posted.

Regards,
Jeroen

> -----Original Message-----
> From: kpowerinfinity [mailto:kpowerinfinity@...]
> Sent: Saturday, August 29, 2009 8:26 PM
> To: Jeroen Frijters
> Cc: ikvm-developers@...
> Subject: Re: [Ikvm-developers] NoClassDefFound - possibly having .NET
> keyword in namespace
>
> Hi Jeroen,
>
> Thanks for the prompt response.
>
> To reproduce this:
> 1. Download drools-5.0.1 from jboss.org
> 2. Run:
> ikvmc antlr-runtime-3.1.1.jar joda-time-1.6.jar
> core-3.4.2.v_883_R34x.jar  xstream-1.3.1.jar jaxb-xjc-2.0.3.jar
> jaxb-impl-2.0.3.jar milyn-smooks-javabean-1.1.jar jxl-2.4.2.jar
> jxls-reader-0.9.6.jar  drools-decisiontables-5.0.1.jar
> janino-2.5.15.jar mvel2-2.0.10.jar drools-core-5.0.1.jar
> drools-api-5.0.1.jar drools-compiler-5.0.1.jar  jsr94-1.1.jar
> -out:..\dotnet\drools5.dll -target:library
> 3. Add this as a reference to a VS project and try to use it to
> compile a drools DRL file:
>
>             java.io.InputStream source =new
> java.io.FileInputStream(filename);
>             org.drools.builder.KnowledgeBuilderConfiguration kbc =
> org.drools.builder.KnowledgeBuilderFactory.newKnowledgeBuilderConfigura
> tion();
>             org.drools.builder.KnowledgeBuilder builder =
> org.drools.builder.KnowledgeBuilderFactory.newKnowledgeBuilder(kbc);
>
> builder.add(org.drools.io.ResourceFactory.newInputStreamResource(source
> ),
> org.drools.builder.ResourceType.DRL);
>             if (builder.hasErrors())
>             {
>                 Console.WriteLine("Error: " +
> builder.getErrors().ToString());
>             }
>
>             org.drools.KnowledgeBase kbase =
> org.drools.KnowledgeBaseFactory.newKnowledgeBase();
>             kbase.addKnowledgePackages(builder.getKnowledgePackages());
>             return kbase;
>
>
> It throws the exception I had earlier mailed. I can find the
> org.drools.base.extractors.BaseDoubleClassFieldReader class in the
> Object Explorer, but it seems the CLR is unable to find it at runtime.
>
> Thanks, Krishna.
>
> PS: A sample DRL file is attached.
>
> --
> http://kpowerinfinity.wordpress.com
> http://www.linkedin.com/in/kpowerinfinity
>
>
>
>
> On Sat, Aug 29, 2009 at 10:58 PM, Jeroen Frijters<jeroen@...>
> wrote:
> > Hi,
> >
> > I don't know what's going on (although it most likely is a class
> loader issue). I do know that it has nothing to with base being a C#
> keyword. Neither IKVM.NET nor the CLR care about C# keywords.
> >
> > If you mail instructions on how to reproduce this issue, I'd be happy
> to have a look.
> >
> > Regards,
> > Jeroen
> >
> >> -----Original Message-----
> >> From: kpowerinfinity [mailto:kpowerinfinity@...]
> >> Sent: Saturday, August 29, 2009 5:45 PM
> >> To: ikvm-developers@...
> >> Subject: [Ikvm-developers] NoClassDefFound - possibly having .NET
> >> keyword in namespace
> >>
> >> Hello,
> >>
> >> I have been trying to compile Drools 5 to .NET using ikvm. I've had
> >> good success with the past versions, however, in version 5, the
> runtime
> >> throws a NoClassDefFound exception:
> >>   InnerException: java.lang.NoClassDefFoundError
> >>
>  Message="org.drools.base.extractors.BaseDoubleClassFieldReader"
> >>        Source="IKVM.Runtime"
> >>        StackTrace:
> >>             at
> >> IKVM.NativeCode.java.lang.ClassLoader.defineClass1(Object
> >> thisClassLoader, String name, Byte[] b, Int32 off, Int32 len, Object
> >> pd, String source)
> >>             at java.lang.ClassLoader.defineClass1(String , Byte[] ,
> >> Int32 , Int32 , ProtectionDomain , String )
> >>             at java.lang.ClassLoader.defineClass(String name, Byte[]
> b,
> >> Int32 off, Int32 len, ProtectionDomain protectionDomain)
> >>             at
> >>
> org.drools.base.ClassFieldAccessorCache.ByteArrayClassLoader.defineClas
> >> s(String
> >> name, Byte[] bytes, ProtectionDomain domain)
> >>             at
> >> org.drools.base.ClassFieldAccessorFactory.getClassFieldReader(Class
> >> clazz, String fieldName, CacheEntry cache)
> >>             at
> >>
> org.drools.base.ClassFieldAccessorCache.CacheEntry.getReadAccessor(Acce
> >> ssorKey
> >> key, Class cls)
> >>             at
> >>
> org.drools.base.ClassFieldAccessorCache.getReadAcessor(ClassFieldReader
> >> reader)
> >>             at
> >> org.drools.base.ClassFieldAccessorStore.wire(ClassFieldReader
> >> reader)
> >>             at
> org.drools.base.ClassFieldAccessorStore.getReader(String
> >> className, String fieldName, AcceptsReadAccessor target,
> AccessorType
> >> accessorType)
> >>             at
> org.drools.base.ClassFieldAccessorStore.getReader(String
> >> className, String fieldName, AcceptsReadAccessor target)
> >>             at
> >>
> org.drools.rule.builder.PatternBuilder.getFieldReadAccessor(RuleBuildCo
> >> ntext
> >> context, BaseDescr descr, ObjectType objectType, String fieldName,
> >> AcceptsReadAccessor target, Boolean reportError)
> >>             at
> >> org.drools.rule.builder.PatternBuilder.build(RuleBuildContext
> >> , Pattern , FieldConstraintDescr , AbstractCompositeConstraint )
> >>             at
> >>
> org.drools.rule.builder.PatternBuilder.buildConstraint(RuleBuildContext
> >> , Pattern , Object , AbstractCompositeConstraint )
> >>             at
> >> org.drools.rule.builder.PatternBuilder.build(RuleBuildContext
> >> context, BaseDescr descr, Pattern prefixPattern)
> >>             at
> >> org.drools.rule.builder.PatternBuilder.build(RuleBuildContext
> >> context, BaseDescr descr)
> >>             at
> >> org.drools.rule.builder.GroupElementBuilder.build(RuleBuildContext
> >> context, BaseDescr descr, Pattern prefixPattern)
> >>             at
> >> org.drools.rule.builder.RuleBuilder.build(RuleBuildContext
> >> context)
> >>             at org.drools.compiler.PackageBuilder.addRule(RuleDescr
> )
> >>             at
> >> org.drools.compiler.PackageBuilder.addPackage(PackageDescr
> >> packageDescr)
> >>             at
> >> org.drools.compiler.PackageBuilder.addPackageFromDrl(Resource
> >> resource)
> >>             at
> >> org.drools.compiler.PackageBuilder.addKnowledgeResource(Resource
> >> resource, ResourceType type, ResourceConfiguration configuration)
> >>             at
> >> org.drools.builder.impl.KnowledgeBuilderImpl.add(Resource
> >> resource, ResourceType type)
> >>
> >> Interestingly, the class
> >> "org.drools.base.extractors.BaseDoubleClassFieldReader" is actually
> >> present in the assembly, and I have verified the same using the
> Object
> >> explorer. However, the runtime can't find it, and I can also not
> find
> >> it using the intellisense (and compiler) of Visual Studio because
> >> "base" within the namespace is a C# keyword. I tried
> >> org.drools.@... and that
> seems
> >> to be valid (just like @event).
> >>
> >> I couldn't find a good way to help the compiler/VM detect the class.
> I
> >> have tried writing a ClassLoader that can do a string-replace from
> >> org.drools.base to org.drools.@base, but haven't been able to
> (unable
> >> to compile the CustomClassLoader file due to the presence of
> >> ikvm.runtime.AssemblyClassLoader in the constructor -- I need to
> post
> >> this separately).
> >>
> >> Will really appreciate if somebody can help me figure out how to
> make
> >> the class visible. I am guessing a C# keyword being in a java
> package
> >> name could be a common scenario.
> >>
> >> Regards,
> >>
> >>
> >> Krishna Mehra
> >>
> >> --
> >> http://kpowerinfinity.wordpress.com
> >> http://www.linkedin.com/in/kpowerinfinity
> >>
> >> --------------------------------------------------------------------
> ---
> >> -------
> >> Let Crystal Reports handle the reporting - Free Crystal Reports 2008
> >> 30-Day trial. Simplify your report design, integration and
> deployment -
> >> and focus on what you do best, core application coding. Discover
> what's
> >> new with Crystal Reports now.  http://p.sf.net/sfu/bobj-july
> >> _______________________________________________
> >> Ikvm-developers mailing list
> >> Ikvm-developers@...
> >> https://lists.sourceforge.net/lists/listinfo/ikvm-developers
> >

------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
trial. Simplify your report design, integration and deployment - and focus on
what you do best, core application coding. Discover what's new with
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
Ikvm-developers mailing list
Ikvm-developers@...
https://lists.sourceforge.net/lists/listinfo/ikvm-developers

Re: NoClassDefFound - possibly having .NET keyword in namespace

by kpowerinfinity :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi Jeroen,

Thanks for the investigation.

This is very intriguing - I am not sure why the problem can't be
reproduced at your end. I do think there's some problem with the
classloader.

For instance, see the code:
var klass = Type.GetType("org.drools.base.extractors.BaseDoubleClassFieldReader");
var ass = System.Reflection.Assembly.GetAssembly(typeof(org.drools.@...));
foreach (var ty in ass.GetTypes())
{
     if (ty.FullName.StartsWith("org.drools.base.extractors.BaseDouble"))
        Console.WriteLine(ty.ToString());
}
Console.WriteLine(klass == null ? "NULL" : klass.ToString());

The output for this is:
org.drools.base.extractors.BaseDoubleClassFieldReader
org.drools.base.extractors.BaseDoubleClassFieldWriter
org.drools.base.extractors.BaseDoubleClassFieldReader+__<CallerID>
org.drools.base.extractors.BaseDoubleClassFieldWriter+__<CallerID>
NULL

This means that I can list that class when I iterate through all the
assembly, but ont create the class on its own. The class can also be
referenced at compile-time and found at runtime, but I can't seem to
reference it later.

I have uploaded the DLL that I created here:
http://kpowerinfinity.googlepages.com/drools-capillary.dll (it was
10MB and I didn't want to attach here).

Look forward to hearing from you again.

Regards
Krishna.
--
http://kpowerinfinity.wordpress.com
http://www.linkedin.com/in/kpowerinfinity




On Sun, Aug 30, 2009 at 12:09 PM, Jeroen Frijters<jeroen@...> wrote:

> Hi,
>
> This does not reproduce the exception you posted.
>
> Regards,
> Jeroen
>
>> -----Original Message-----
>> From: kpowerinfinity [mailto:kpowerinfinity@...]
>> Sent: Saturday, August 29, 2009 8:26 PM
>> To: Jeroen Frijters
>> Cc: ikvm-developers@...
>> Subject: Re: [Ikvm-developers] NoClassDefFound - possibly having .NET
>> keyword in namespace
>>
>> Hi Jeroen,
>>
>> Thanks for the prompt response.
>>
>> To reproduce this:
>> 1. Download drools-5.0.1 from jboss.org
>> 2. Run:
>> ikvmc antlr-runtime-3.1.1.jar joda-time-1.6.jar
>> core-3.4.2.v_883_R34x.jar  xstream-1.3.1.jar jaxb-xjc-2.0.3.jar
>> jaxb-impl-2.0.3.jar milyn-smooks-javabean-1.1.jar jxl-2.4.2.jar
>> jxls-reader-0.9.6.jar  drools-decisiontables-5.0.1.jar
>> janino-2.5.15.jar mvel2-2.0.10.jar drools-core-5.0.1.jar
>> drools-api-5.0.1.jar drools-compiler-5.0.1.jar  jsr94-1.1.jar
>> -out:..\dotnet\drools5.dll -target:library
>> 3. Add this as a reference to a VS project and try to use it to
>> compile a drools DRL file:
>>
>>             java.io.InputStream source =new
>> java.io.FileInputStream(filename);
>>             org.drools.builder.KnowledgeBuilderConfiguration kbc =
>> org.drools.builder.KnowledgeBuilderFactory.newKnowledgeBuilderConfigura
>> tion();
>>             org.drools.builder.KnowledgeBuilder builder =
>> org.drools.builder.KnowledgeBuilderFactory.newKnowledgeBuilder(kbc);
>>
>> builder.add(org.drools.io.ResourceFactory.newInputStreamResource(source
>> ),
>> org.drools.builder.ResourceType.DRL);
>>             if (builder.hasErrors())
>>             {
>>                 Console.WriteLine("Error: " +
>> builder.getErrors().ToString());
>>             }
>>
>>             org.drools.KnowledgeBase kbase =
>> org.drools.KnowledgeBaseFactory.newKnowledgeBase();
>>             kbase.addKnowledgePackages(builder.getKnowledgePackages());
>>             return kbase;
>>
>>
>> It throws the exception I had earlier mailed. I can find the
>> org.drools.base.extractors.BaseDoubleClassFieldReader class in the
>> Object Explorer, but it seems the CLR is unable to find it at runtime.
>>
>> Thanks, Krishna.
>>
>> PS: A sample DRL file is attached.
>>
>> --
>> http://kpowerinfinity.wordpress.com
>> http://www.linkedin.com/in/kpowerinfinity
>>
>>
>>
>>
>> On Sat, Aug 29, 2009 at 10:58 PM, Jeroen Frijters<jeroen@...>
>> wrote:
>> > Hi,
>> >
>> > I don't know what's going on (although it most likely is a class
>> loader issue). I do know that it has nothing to with base being a C#
>> keyword. Neither IKVM.NET nor the CLR care about C# keywords.
>> >
>> > If you mail instructions on how to reproduce this issue, I'd be happy
>> to have a look.
>> >
>> > Regards,
>> > Jeroen
>> >
>> >> -----Original Message-----
>> >> From: kpowerinfinity [mailto:kpowerinfinity@...]
>> >> Sent: Saturday, August 29, 2009 5:45 PM
>> >> To: ikvm-developers@...
>> >> Subject: [Ikvm-developers] NoClassDefFound - possibly having .NET
>> >> keyword in namespace
>> >>
>> >> Hello,
>> >>
>> >> I have been trying to compile Drools 5 to .NET using ikvm. I've had
>> >> good success with the past versions, however, in version 5, the
>> runtime
>> >> throws a NoClassDefFound exception:
>> >>   InnerException: java.lang.NoClassDefFoundError
>> >>
>>  Message="org.drools.base.extractors.BaseDoubleClassFieldReader"
>> >>        Source="IKVM.Runtime"
>> >>        StackTrace:
>> >>             at
>> >> IKVM.NativeCode.java.lang.ClassLoader.defineClass1(Object
>> >> thisClassLoader, String name, Byte[] b, Int32 off, Int32 len, Object
>> >> pd, String source)
>> >>             at java.lang.ClassLoader.defineClass1(String , Byte[] ,
>> >> Int32 , Int32 , ProtectionDomain , String )
>> >>             at java.lang.ClassLoader.defineClass(String name, Byte[]
>> b,
>> >> Int32 off, Int32 len, ProtectionDomain protectionDomain)
>> >>             at
>> >>
>> org.drools.base.ClassFieldAccessorCache.ByteArrayClassLoader.defineClas
>> >> s(String
>> >> name, Byte[] bytes, ProtectionDomain domain)
>> >>             at
>> >> org.drools.base.ClassFieldAccessorFactory.getClassFieldReader(Class
>> >> clazz, String fieldName, CacheEntry cache)
>> >>             at
>> >>
>> org.drools.base.ClassFieldAccessorCache.CacheEntry.getReadAccessor(Acce
>> >> ssorKey
>> >> key, Class cls)
>> >>             at
>> >>
>> org.drools.base.ClassFieldAccessorCache.getReadAcessor(ClassFieldReader
>> >> reader)
>> >>             at
>> >> org.drools.base.ClassFieldAccessorStore.wire(ClassFieldReader
>> >> reader)
>> >>             at
>> org.drools.base.ClassFieldAccessorStore.getReader(String
>> >> className, String fieldName, AcceptsReadAccessor target,
>> AccessorType
>> >> accessorType)
>> >>             at
>> org.drools.base.ClassFieldAccessorStore.getReader(String
>> >> className, String fieldName, AcceptsReadAccessor target)
>> >>             at
>> >>
>> org.drools.rule.builder.PatternBuilder.getFieldReadAccessor(RuleBuildCo
>> >> ntext
>> >> context, BaseDescr descr, ObjectType objectType, String fieldName,
>> >> AcceptsReadAccessor target, Boolean reportError)
>> >>             at
>> >> org.drools.rule.builder.PatternBuilder.build(RuleBuildContext
>> >> , Pattern , FieldConstraintDescr , AbstractCompositeConstraint )
>> >>             at
>> >>
>> org.drools.rule.builder.PatternBuilder.buildConstraint(RuleBuildContext
>> >> , Pattern , Object , AbstractCompositeConstraint )
>> >>             at
>> >> org.drools.rule.builder.PatternBuilder.build(RuleBuildContext
>> >> context, BaseDescr descr, Pattern prefixPattern)
>> >>             at
>> >> org.drools.rule.builder.PatternBuilder.build(RuleBuildContext
>> >> context, BaseDescr descr)
>> >>             at
>> >> org.drools.rule.builder.GroupElementBuilder.build(RuleBuildContext
>> >> context, BaseDescr descr, Pattern prefixPattern)
>> >>             at
>> >> org.drools.rule.builder.RuleBuilder.build(RuleBuildContext
>> >> context)
>> >>             at org.drools.compiler.PackageBuilder.addRule(RuleDescr
>> )
>> >>             at
>> >> org.drools.compiler.PackageBuilder.addPackage(PackageDescr
>> >> packageDescr)
>> >>             at
>> >> org.drools.compiler.PackageBuilder.addPackageFromDrl(Resource
>> >> resource)
>> >>             at
>> >> org.drools.compiler.PackageBuilder.addKnowledgeResource(Resource
>> >> resource, ResourceType type, ResourceConfiguration configuration)
>> >>             at
>> >> org.drools.builder.impl.KnowledgeBuilderImpl.add(Resource
>> >> resource, ResourceType type)
>> >>
>> >> Interestingly, the class
>> >> "org.drools.base.extractors.BaseDoubleClassFieldReader" is actually
>> >> present in the assembly, and I have verified the same using the
>> Object
>> >> explorer. However, the runtime can't find it, and I can also not
>> find
>> >> it using the intellisense (and compiler) of Visual Studio because
>> >> "base" within the namespace is a C# keyword. I tried
>> >> org.drools.@... and that
>> seems
>> >> to be valid (just like @event).
>> >>
>> >> I couldn't find a good way to help the compiler/VM detect the class.
>> I
>> >> have tried writing a ClassLoader that can do a string-replace from
>> >> org.drools.base to org.drools.@base, but haven't been able to
>> (unable
>> >> to compile the CustomClassLoader file due to the presence of
>> >> ikvm.runtime.AssemblyClassLoader in the constructor -- I need to
>> post
>> >> this separately).
>> >>
>> >> Will really appreciate if somebody can help me figure out how to
>> make
>> >> the class visible. I am guessing a C# keyword being in a java
>> package
>> >> name could be a common scenario.
>> >>
>> >> Regards,
>> >>
>> >>
>> >> Krishna Mehra
>> >>
>> >> --
>> >> http://kpowerinfinity.wordpress.com
>> >> http://www.linkedin.com/in/kpowerinfinity
>> >>
>> >> --------------------------------------------------------------------
>> ---
>> >> -------
>> >> Let Crystal Reports handle the reporting - Free Crystal Reports 2008
>> >> 30-Day trial. Simplify your report design, integration and
>> deployment -
>> >> and focus on what you do best, core application coding. Discover
>> what's
>> >> new with Crystal Reports now.  http://p.sf.net/sfu/bobj-july
>> >> _______________________________________________
>> >> Ikvm-developers mailing list
>> >> Ikvm-developers@...
>> >> https://lists.sourceforge.net/lists/listinfo/ikvm-developers
>> >
>

------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
trial. Simplify your report design, integration and deployment - and focus on
what you do best, core application coding. Discover what's new with
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
Ikvm-developers mailing list
Ikvm-developers@...
https://lists.sourceforge.net/lists/listinfo/ikvm-developers

Re: NoClassDefFound - possibly having .NET keyword in namespace

by Jeroen Frijters :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi Krishna,

Sorry for being blunt, but all this shows is that you don't understand how type loading in .NET works.

Type.GetType(string) only loads from the current assembly and mscorlib.

I recommend studying the .NET assembly/type loading model and after that the IKVM class loading model:
http://weblog.ikvm.net/PermaLink.aspx?guid=4e0b7f7c-6f5d-42a3-a4d6-5d05a99c84ff

Regards,
Jeroen

> -----Original Message-----
> From: kpowerinfinity [mailto:kpowerinfinity@...]
> Sent: Monday, August 31, 2009 5:34 PM
> To: Jeroen Frijters
> Cc: ikvm-developers@...
> Subject: Re: [Ikvm-developers] NoClassDefFound - possibly having .NET
> keyword in namespace
>
> Hi Jeroen,
>
> Thanks for the investigation.
>
> This is very intriguing - I am not sure why the problem can't be
> reproduced at your end. I do think there's some problem with the
> classloader.
>
> For instance, see the code:
> var klass =
> Type.GetType("org.drools.base.extractors.BaseDoubleClassFieldReader");
> var ass =
> System.Reflection.Assembly.GetAssembly(typeof(org.drools.@...
> rs.BaseDoubleClassFieldReader));
> foreach (var ty in ass.GetTypes())
> {
>      if
> (ty.FullName.StartsWith("org.drools.base.extractors.BaseDouble"))
>         Console.WriteLine(ty.ToString()); } Console.WriteLine(klass ==
> null ? "NULL" : klass.ToString());
>
> The output for this is:
> org.drools.base.extractors.BaseDoubleClassFieldReader
> org.drools.base.extractors.BaseDoubleClassFieldWriter
> org.drools.base.extractors.BaseDoubleClassFieldReader+__<CallerID>
> org.drools.base.extractors.BaseDoubleClassFieldWriter+__<CallerID>
> NULL
>
> This means that I can list that class when I iterate through all the
> assembly, but ont create the class on its own. The class can also be
> referenced at compile-time and found at runtime, but I can't seem to
> reference it later.
>
> I have uploaded the DLL that I created here:
> http://kpowerinfinity.googlepages.com/drools-capillary.dll (it was 10MB
> and I didn't want to attach here).
>
> Look forward to hearing from you again.
>
> Regards
> Krishna.
> --
> http://kpowerinfinity.wordpress.com
> http://www.linkedin.com/in/kpowerinfinity
>
>
>
>
> On Sun, Aug 30, 2009 at 12:09 PM, Jeroen Frijters<jeroen@...>
> wrote:
> > Hi,
> >
> > This does not reproduce the exception you posted.
> >
> > Regards,
> > Jeroen
> >
> >> -----Original Message-----
> >> From: kpowerinfinity [mailto:kpowerinfinity@...]
> >> Sent: Saturday, August 29, 2009 8:26 PM
> >> To: Jeroen Frijters
> >> Cc: ikvm-developers@...
> >> Subject: Re: [Ikvm-developers] NoClassDefFound - possibly having
> .NET
> >> keyword in namespace
> >>
> >> Hi Jeroen,
> >>
> >> Thanks for the prompt response.
> >>
> >> To reproduce this:
> >> 1. Download drools-5.0.1 from jboss.org 2. Run:
> >> ikvmc antlr-runtime-3.1.1.jar joda-time-1.6.jar
> >> core-3.4.2.v_883_R34x.jar  xstream-1.3.1.jar jaxb-xjc-2.0.3.jar
> >> jaxb-impl-2.0.3.jar milyn-smooks-javabean-1.1.jar jxl-2.4.2.jar
> >> jxls-reader-0.9.6.jar  drools-decisiontables-5.0.1.jar
> >> janino-2.5.15.jar mvel2-2.0.10.jar drools-core-5.0.1.jar
> >> drools-api-5.0.1.jar drools-compiler-5.0.1.jar  jsr94-1.1.jar
> >> -out:..\dotnet\drools5.dll -target:library 3. Add this as a
> reference
> >> to a VS project and try to use it to compile a drools DRL file:
> >>
> >>             java.io.InputStream source =new
> >> java.io.FileInputStream(filename);
> >>             org.drools.builder.KnowledgeBuilderConfiguration kbc =
> >>
> org.drools.builder.KnowledgeBuilderFactory.newKnowledgeBuilderConfigu
> >> ra
> >> tion();
> >>             org.drools.builder.KnowledgeBuilder builder =
> >> org.drools.builder.KnowledgeBuilderFactory.newKnowledgeBuilder(kbc);
> >>
> >>
> builder.add(org.drools.io.ResourceFactory.newInputStreamResource(sour
> >> ce
> >> ),
> >> org.drools.builder.ResourceType.DRL);
> >>             if (builder.hasErrors())
> >>             {
> >>                 Console.WriteLine("Error: " +
> >> builder.getErrors().ToString());
> >>             }
> >>
> >>             org.drools.KnowledgeBase kbase =
> >> org.drools.KnowledgeBaseFactory.newKnowledgeBase();
> >>
> >> kbase.addKnowledgePackages(builder.getKnowledgePackages());
> >>             return kbase;
> >>
> >>
> >> It throws the exception I had earlier mailed. I can find the
> >> org.drools.base.extractors.BaseDoubleClassFieldReader class in the
> >> Object Explorer, but it seems the CLR is unable to find it at
> runtime.
> >>
> >> Thanks, Krishna.
> >>
> >> PS: A sample DRL file is attached.
> >>
> >> --
> >> http://kpowerinfinity.wordpress.com
> >> http://www.linkedin.com/in/kpowerinfinity
> >>
> >>
> >>
> >>
> >> On Sat, Aug 29, 2009 at 10:58 PM, Jeroen Frijters<jeroen@...>
> >> wrote:
> >> > Hi,
> >> >
> >> > I don't know what's going on (although it most likely is a class
> >> loader issue). I do know that it has nothing to with base being a C#
> >> keyword. Neither IKVM.NET nor the CLR care about C# keywords.
> >> >
> >> > If you mail instructions on how to reproduce this issue, I'd be
> >> > happy
> >> to have a look.
> >> >
> >> > Regards,
> >> > Jeroen
> >> >
> >> >> -----Original Message-----
> >> >> From: kpowerinfinity [mailto:kpowerinfinity@...]
> >> >> Sent: Saturday, August 29, 2009 5:45 PM
> >> >> To: ikvm-developers@...
> >> >> Subject: [Ikvm-developers] NoClassDefFound - possibly having .NET
> >> >> keyword in namespace
> >> >>
> >> >> Hello,
> >> >>
> >> >> I have been trying to compile Drools 5 to .NET using ikvm. I've
> >> >> had good success with the past versions, however, in version 5,
> >> >> the
> >> runtime
> >> >> throws a NoClassDefFound exception:
> >> >>   InnerException: java.lang.NoClassDefFoundError
> >> >>
> >>  Message="org.drools.base.extractors.BaseDoubleClassFieldReader"
> >> >>        Source="IKVM.Runtime"
> >> >>        StackTrace:
> >> >>             at
> >> >> IKVM.NativeCode.java.lang.ClassLoader.defineClass1(Object
> >> >> thisClassLoader, String name, Byte[] b, Int32 off, Int32 len,
> >> >> Object pd, String source)
> >> >>             at java.lang.ClassLoader.defineClass1(String , Byte[]
> >> >> ,
> >> >> Int32 , Int32 , ProtectionDomain , String )
> >> >>             at java.lang.ClassLoader.defineClass(String name,
> >> >> Byte[]
> >> b,
> >> >> Int32 off, Int32 len, ProtectionDomain protectionDomain)
> >> >>             at
> >> >>
> >>
> org.drools.base.ClassFieldAccessorCache.ByteArrayClassLoader.defineCl
> >> as
> >> >> s(String
> >> >> name, Byte[] bytes, ProtectionDomain domain)
> >> >>             at
> >> >>
> org.drools.base.ClassFieldAccessorFactory.getClassFieldReader(Clas
> >> >> s clazz, String fieldName, CacheEntry cache)
> >> >>             at
> >> >>
> >>
> org.drools.base.ClassFieldAccessorCache.CacheEntry.getReadAccessor(Ac
> >> ce
> >> >> ssorKey
> >> >> key, Class cls)
> >> >>             at
> >> >>
> >>
> org.drools.base.ClassFieldAccessorCache.getReadAcessor(ClassFieldRead
> >> er
> >> >> reader)
> >> >>             at
> >> >> org.drools.base.ClassFieldAccessorStore.wire(ClassFieldReader
> >> >> reader)
> >> >>             at
> >> org.drools.base.ClassFieldAccessorStore.getReader(String
> >> >> className, String fieldName, AcceptsReadAccessor target,
> >> AccessorType
> >> >> accessorType)
> >> >>             at
> >> org.drools.base.ClassFieldAccessorStore.getReader(String
> >> >> className, String fieldName, AcceptsReadAccessor target)
> >> >>             at
> >> >>
> >>
> org.drools.rule.builder.PatternBuilder.getFieldReadAccessor(RuleBuild
> >> Co
> >> >> ntext
> >> >> context, BaseDescr descr, ObjectType objectType, String
> fieldName,
> >> >> AcceptsReadAccessor target, Boolean reportError)
> >> >>             at
> >> >> org.drools.rule.builder.PatternBuilder.build(RuleBuildContext
> >> >> , Pattern , FieldConstraintDescr , AbstractCompositeConstraint )
> >> >>             at
> >> >>
> >>
> org.drools.rule.builder.PatternBuilder.buildConstraint(RuleBuildConte
> >> xt
> >> >> , Pattern , Object , AbstractCompositeConstraint )
> >> >>             at
> >> >> org.drools.rule.builder.PatternBuilder.build(RuleBuildContext
> >> >> context, BaseDescr descr, Pattern prefixPattern)
> >> >>             at
> >> >> org.drools.rule.builder.PatternBuilder.build(RuleBuildContext
> >> >> context, BaseDescr descr)
> >> >>             at
> >> >>
> org.drools.rule.builder.GroupElementBuilder.build(RuleBuildContext
> >> >> context, BaseDescr descr, Pattern prefixPattern)
> >> >>             at
> >> >> org.drools.rule.builder.RuleBuilder.build(RuleBuildContext
> >> >> context)
> >> >>             at
> >> >> org.drools.compiler.PackageBuilder.addRule(RuleDescr
> >> )
> >> >>             at
> >> >> org.drools.compiler.PackageBuilder.addPackage(PackageDescr
> >> >> packageDescr)
> >> >>             at
> >> >> org.drools.compiler.PackageBuilder.addPackageFromDrl(Resource
> >> >> resource)
> >> >>             at
> >> >> org.drools.compiler.PackageBuilder.addKnowledgeResource(Resource
> >> >> resource, ResourceType type, ResourceConfiguration configuration)
> >> >>             at
> >> >> org.drools.builder.impl.KnowledgeBuilderImpl.add(Resource
> >> >> resource, ResourceType type)
> >> >>
> >> >> Interestingly, the class
> >> >> "org.drools.base.extractors.BaseDoubleClassFieldReader" is
> >> >> actually present in the assembly, and I have verified the same
> >> >> using the
> >> Object
> >> >> explorer. However, the runtime can't find it, and I can also not
> >> find
> >> >> it using the intellisense (and compiler) of Visual Studio because
> >> >> "base" within the namespace is a C# keyword. I tried
> >> >> org.drools.@... and that
> >> seems
> >> >> to be valid (just like @event).
> >> >>
> >> >> I couldn't find a good way to help the compiler/VM detect the
> class.
> >> I
> >> >> have tried writing a ClassLoader that can do a string-replace
> from
> >> >> org.drools.base to org.drools.@base, but haven't been able to
> >> (unable
> >> >> to compile the CustomClassLoader file due to the presence of
> >> >> ikvm.runtime.AssemblyClassLoader in the constructor -- I need to
> >> post
> >> >> this separately).
> >> >>
> >> >> Will really appreciate if somebody can help me figure out how to
> >> make
> >> >> the class visible. I am guessing a C# keyword being in a java
> >> package
> >> >> name could be a common scenario.
> >> >>
> >> >> Regards,
> >> >>
> >> >>
> >> >> Krishna Mehra
> >> >>
> >> >> --
> >> >> http://kpowerinfinity.wordpress.com
> >> >> http://www.linkedin.com/in/kpowerinfinity
> >> >>
> >> >> -----------------------------------------------------------------
> -
> >> >> --
> >> ---
> >> >> -------
> >> >> Let Crystal Reports handle the reporting - Free Crystal Reports
> >> >> 2008 30-Day trial. Simplify your report design, integration and
> >> deployment -
> >> >> and focus on what you do best, core application coding. Discover
> >> what's
> >> >> new with Crystal Reports now.  http://p.sf.net/sfu/bobj-july
> >> >> _______________________________________________
> >> >> Ikvm-developers mailing list
> >> >> Ikvm-developers@...
> >> >> https://lists.sourceforge.net/lists/listinfo/ikvm-developers
> >> >
> >

------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
trial. Simplify your report design, integration and deployment - and focus on
what you do best, core application coding. Discover what's new with
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
Ikvm-developers mailing list
Ikvm-developers@...
https://lists.sourceforge.net/lists/listinfo/ikvm-developers

Re: NoClassDefFound - possibly having .NET keyword in namespace

by kpowerinfinity :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi,

The problem really occured because drools uses its own class-loading
architecture, and cooks up the classes "in-situ" using a byte stream.

The resolution has been posted on the drools dev list.

Regards
Krishna.

--
http://kpowerinfinity.wordpress.com
http://www.linkedin.com/in/kpowerinfinity




On Mon, Aug 31, 2009 at 9:15 PM, Jeroen Frijters<jeroen@...> wrote:

> Hi Krishna,
>
> Sorry for being blunt, but all this shows is that you don't understand how type loading in .NET works.
>
> Type.GetType(string) only loads from the current assembly and mscorlib.
>
> I recommend studying the .NET assembly/type loading model and after that the IKVM class loading model:
> http://weblog.ikvm.net/PermaLink.aspx?guid=4e0b7f7c-6f5d-42a3-a4d6-5d05a99c84ff
>
> Regards,
> Jeroen
>
>> -----Original Message-----
>> From: kpowerinfinity [mailto:kpowerinfinity@...]
>> Sent: Monday, August 31, 2009 5:34 PM
>> To: Jeroen Frijters
>> Cc: ikvm-developers@...
>> Subject: Re: [Ikvm-developers] NoClassDefFound - possibly having .NET
>> keyword in namespace
>>
>> Hi Jeroen,
>>
>> Thanks for the investigation.
>>
>> This is very intriguing - I am not sure why the problem can't be
>> reproduced at your end. I do think there's some problem with the
>> classloader.
>>
>> For instance, see the code:
>> var klass =
>> Type.GetType("org.drools.base.extractors.BaseDoubleClassFieldReader");
>> var ass =
>> System.Reflection.Assembly.GetAssembly(typeof(org.drools.@...
>> rs.BaseDoubleClassFieldReader));
>> foreach (var ty in ass.GetTypes())
>> {
>>      if
>> (ty.FullName.StartsWith("org.drools.base.extractors.BaseDouble"))
>>         Console.WriteLine(ty.ToString()); } Console.WriteLine(klass ==
>> null ? "NULL" : klass.ToString());
>>
>> The output for this is:
>> org.drools.base.extractors.BaseDoubleClassFieldReader
>> org.drools.base.extractors.BaseDoubleClassFieldWriter
>> org.drools.base.extractors.BaseDoubleClassFieldReader+__<CallerID>
>> org.drools.base.extractors.BaseDoubleClassFieldWriter+__<CallerID>
>> NULL
>>
>> This means that I can list that class when I iterate through all the
>> assembly, but ont create the class on its own. The class can also be
>> referenced at compile-time and found at runtime, but I can't seem to
>> reference it later.
>>
>> I have uploaded the DLL that I created here:
>> http://kpowerinfinity.googlepages.com/drools-capillary.dll (it was 10MB
>> and I didn't want to attach here).
>>
>> Look forward to hearing from you again.
>>
>> Regards
>> Krishna.
>> --
>> http://kpowerinfinity.wordpress.com
>> http://www.linkedin.com/in/kpowerinfinity
>>
>>
>>
>>
>> On Sun, Aug 30, 2009 at 12:09 PM, Jeroen Frijters<jeroen@...>
>> wrote:
>> > Hi,
>> >
>> > This does not reproduce the exception you posted.
>> >
>> > Regards,
>> > Jeroen
>> >
>> >> -----Original Message-----
>> >> From: kpowerinfinity [mailto:kpowerinfinity@...]
>> >> Sent: Saturday, August 29, 2009 8:26 PM
>> >> To: Jeroen Frijters
>> >> Cc: ikvm-developers@...
>> >> Subject: Re: [Ikvm-developers] NoClassDefFound - possibly having
>> .NET
>> >> keyword in namespace
>> >>
>> >> Hi Jeroen,
>> >>
>> >> Thanks for the prompt response.
>> >>
>> >> To reproduce this:
>> >> 1. Download drools-5.0.1 from jboss.org 2. Run:
>> >> ikvmc antlr-runtime-3.1.1.jar joda-time-1.6.jar
>> >> core-3.4.2.v_883_R34x.jar  xstream-1.3.1.jar jaxb-xjc-2.0.3.jar
>> >> jaxb-impl-2.0.3.jar milyn-smooks-javabean-1.1.jar jxl-2.4.2.jar
>> >> jxls-reader-0.9.6.jar  drools-decisiontables-5.0.1.jar
>> >> janino-2.5.15.jar mvel2-2.0.10.jar drools-core-5.0.1.jar
>> >> drools-api-5.0.1.jar drools-compiler-5.0.1.jar  jsr94-1.1.jar
>> >> -out:..\dotnet\drools5.dll -target:library 3. Add this as a
>> reference
>> >> to a VS project and try to use it to compile a drools DRL file:
>> >>
>> >>             java.io.InputStream source =new
>> >> java.io.FileInputStream(filename);
>> >>             org.drools.builder.KnowledgeBuilderConfiguration kbc =
>> >>
>> org.drools.builder.KnowledgeBuilderFactory.newKnowledgeBuilderConfigu
>> >> ra
>> >> tion();
>> >>             org.drools.builder.KnowledgeBuilder builder =
>> >> org.drools.builder.KnowledgeBuilderFactory.newKnowledgeBuilder(kbc);
>> >>
>> >>
>> builder.add(org.drools.io.ResourceFactory.newInputStreamResource(sour
>> >> ce
>> >> ),
>> >> org.drools.builder.ResourceType.DRL);
>> >>             if (builder.hasErrors())
>> >>             {
>> >>                 Console.WriteLine("Error: " +
>> >> builder.getErrors().ToString());
>> >>             }
>> >>
>> >>             org.drools.KnowledgeBase kbase =
>> >> org.drools.KnowledgeBaseFactory.newKnowledgeBase();
>> >>
>> >> kbase.addKnowledgePackages(builder.getKnowledgePackages());
>> >>             return kbase;
>> >>
>> >>
>> >> It throws the exception I had earlier mailed. I can find the
>> >> org.drools.base.extractors.BaseDoubleClassFieldReader class in the
>> >> Object Explorer, but it seems the CLR is unable to find it at
>> runtime.
>> >>
>> >> Thanks, Krishna.
>> >>
>> >> PS: A sample DRL file is attached.
>> >>
>> >> --
>> >> http://kpowerinfinity.wordpress.com
>> >> http://www.linkedin.com/in/kpowerinfinity
>> >>
>> >>
>> >>
>> >>
>> >> On Sat, Aug 29, 2009 at 10:58 PM, Jeroen Frijters<jeroen@...>
>> >> wrote:
>> >> > Hi,
>> >> >
>> >> > I don't know what's going on (although it most likely is a class
>> >> loader issue). I do know that it has nothing to with base being a C#
>> >> keyword. Neither IKVM.NET nor the CLR care about C# keywords.
>> >> >
>> >> > If you mail instructions on how to reproduce this issue, I'd be
>> >> > happy
>> >> to have a look.
>> >> >
>> >> > Regards,
>> >> > Jeroen
>> >> >
>> >> >> -----Original Message-----
>> >> >> From: kpowerinfinity [mailto:kpowerinfinity@...]
>> >> >> Sent: Saturday, August 29, 2009 5:45 PM
>> >> >> To: ikvm-developers@...
>> >> >> Subject: [Ikvm-developers] NoClassDefFound - possibly having .NET
>> >> >> keyword in namespace
>> >> >>
>> >> >> Hello,
>> >> >>
>> >> >> I have been trying to compile Drools 5 to .NET using ikvm. I've
>> >> >> had good success with the past versions, however, in version 5,
>> >> >> the
>> >> runtime
>> >> >> throws a NoClassDefFound exception:
>> >> >>   InnerException: java.lang.NoClassDefFoundError
>> >> >>
>> >>  Message="org.drools.base.extractors.BaseDoubleClassFieldReader"
>> >> >>        Source="IKVM.Runtime"
>> >> >>        StackTrace:
>> >> >>             at
>> >> >> IKVM.NativeCode.java.lang.ClassLoader.defineClass1(Object
>> >> >> thisClassLoader, String name, Byte[] b, Int32 off, Int32 len,
>> >> >> Object pd, String source)
>> >> >>             at java.lang.ClassLoader.defineClass1(String , Byte[]
>> >> >> ,
>> >> >> Int32 , Int32 , ProtectionDomain , String )
>> >> >>             at java.lang.ClassLoader.defineClass(String name,
>> >> >> Byte[]
>> >> b,
>> >> >> Int32 off, Int32 len, ProtectionDomain protectionDomain)
>> >> >>             at
>> >> >>
>> >>
>> org.drools.base.ClassFieldAccessorCache.ByteArrayClassLoader.defineCl
>> >> as
>> >> >> s(String
>> >> >> name, Byte[] bytes, ProtectionDomain domain)
>> >> >>             at
>> >> >>
>> org.drools.base.ClassFieldAccessorFactory.getClassFieldReader(Clas
>> >> >> s clazz, String fieldName, CacheEntry cache)
>> >> >>             at
>> >> >>
>> >>
>> org.drools.base.ClassFieldAccessorCache.CacheEntry.getReadAccessor(Ac
>> >> ce
>> >> >> ssorKey
>> >> >> key, Class cls)
>> >> >>             at
>> >> >>
>> >>
>> org.drools.base.ClassFieldAccessorCache.getReadAcessor(ClassFieldRead
>> >> er
>> >> >> reader)
>> >> >>             at
>> >> >> org.drools.base.ClassFieldAccessorStore.wire(ClassFieldReader
>> >> >> reader)
>> >> >>             at
>> >> org.drools.base.ClassFieldAccessorStore.getReader(String
>> >> >> className, String fieldName, AcceptsReadAccessor target,
>> >> AccessorType
>> >> >> accessorType)
>> >> >>             at
>> >> org.drools.base.ClassFieldAccessorStore.getReader(String
>> >> >> className, String fieldName, AcceptsReadAccessor target)
>> >> >>             at
>> >> >>
>> >>
>> org.drools.rule.builder.PatternBuilder.getFieldReadAccessor(RuleBuild
>> >> Co
>> >> >> ntext
>> >> >> context, BaseDescr descr, ObjectType objectType, String
>> fieldName,
>> >> >> AcceptsReadAccessor target, Boolean reportError)
>> >> >>             at
>> >> >> org.drools.rule.builder.PatternBuilder.build(RuleBuildContext
>> >> >> , Pattern , FieldConstraintDescr , AbstractCompositeConstraint )
>> >> >>             at
>> >> >>
>> >>
>> org.drools.rule.builder.PatternBuilder.buildConstraint(RuleBuildConte
>> >> xt
>> >> >> , Pattern , Object , AbstractCompositeConstraint )
>> >> >>             at
>> >> >> org.drools.rule.builder.PatternBuilder.build(RuleBuildContext
>> >> >> context, BaseDescr descr, Pattern prefixPattern)
>> >> >>             at
>> >> >> org.drools.rule.builder.PatternBuilder.build(RuleBuildContext
>> >> >> context, BaseDescr descr)
>> >> >>             at
>> >> >>
>> org.drools.rule.builder.GroupElementBuilder.build(RuleBuildContext
>> >> >> context, BaseDescr descr, Pattern prefixPattern)
>> >> >>             at
>> >> >> org.drools.rule.builder.RuleBuilder.build(RuleBuildContext
>> >> >> context)
>> >> >>             at
>> >> >> org.drools.compiler.PackageBuilder.addRule(RuleDescr
>> >> )
>> >> >>             at
>> >> >> org.drools.compiler.PackageBuilder.addPackage(PackageDescr
>> >> >> packageDescr)
>> >> >>             at
>> >> >> org.drools.compiler.PackageBuilder.addPackageFromDrl(Resource
>> >> >> resource)
>> >> >>             at
>> >> >> org.drools.compiler.PackageBuilder.addKnowledgeResource(Resource
>> >> >> resource, ResourceType type, ResourceConfiguration configuration)
>> >> >>             at
>> >> >> org.drools.builder.impl.KnowledgeBuilderImpl.add(Resource
>> >> >> resource, ResourceType type)
>> >> >>
>> >> >> Interestingly, the class
>> >> >> "org.drools.base.extractors.BaseDoubleClassFieldReader" is
>> >> >> actually present in the assembly, and I have verified the same
>> >> >> using the
>> >> Object
>> >> >> explorer. However, the runtime can't find it, and I can also not
>> >> find
>> >> >> it using the intellisense (and compiler) of Visual Studio because
>> >> >> "base" within the namespace is a C# keyword. I tried
>> >> >> org.drools.@... and that
>> >> seems
>> >> >> to be valid (just like @event).
>> >> >>
>> >> >> I couldn't find a good way to help the compiler/VM detect the
>> class.
>> >> I
>> >> >> have tried writing a ClassLoader that can do a string-replace
>> from
>> >> >> org.drools.base to org.drools.@base, but haven't been able to
>> >> (unable
>> >> >> to compile the CustomClassLoader file due to the presence of
>> >> >> ikvm.runtime.AssemblyClassLoader in the constructor -- I need to
>> >> post
>> >> >> this separately).
>> >> >>
>> >> >> Will really appreciate if somebody can help me figure out how to
>> >> make
>> >> >> the class visible. I am guessing a C# keyword being in a java
>> >> package
>> >> >> name could be a common scenario.
>> >> >>
>> >> >> Regards,
>> >> >>
>> >> >>
>> >> >> Krishna Mehra
>> >> >>
>> >> >> --
>> >> >> http://kpowerinfinity.wordpress.com
>> >> >> http://www.linkedin.com/in/kpowerinfinity
>> >> >>
>> >> >> -----------------------------------------------------------------
>> -
>> >> >> --
>> >> ---
>> >> >> -------
>> >> >> Let Crystal Reports handle the reporting - Free Crystal Reports
>> >> >> 2008 30-Day trial. Simplify your report design, integration and
>> >> deployment -
>> >> >> and focus on what you do best, core application coding. Discover
>> >> what's
>> >> >> new with Crystal Reports now.  http://p.sf.net/sfu/bobj-july
>> >> >> _______________________________________________
>> >> >> Ikvm-developers mailing list
>> >> >> Ikvm-developers@...
>> >> >> https://lists.sourceforge.net/lists/listinfo/ikvm-developers
>> >> >
>> >
>

------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
trial. Simplify your report design, integration and deployment - and focus on
what you do best, core application coding. Discover what's new with
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
Ikvm-developers mailing list
Ikvm-developers@...
https://lists.sourceforge.net/lists/listinfo/ikvm-developers

Re: NoClassDefFound - possibly having .NET keyword in namespace

by Jeroen Frijters :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi,

Thanks for the update. I still wonder what happened, because the IKVM class loader architecture change was ages ago. Were you previously using a very old version of IKVM?

For others reading along and for future reference here's a link to the article:
http://article.gmane.org/gmane.comp.java.drools.devel/3116

I don't know anything about drools, but it surprises me that you can have a model class that doesn't have a reference to the drools assembly, as that seems to be what's causing the problem. Using an AppDomainAssemblyClassLoader does indeed resolve the problem, but if you can avoid it I would recommend it, because using static dependencies is more reliable, more robust and more performant.

BWT, did you convert the individual jars into separate assemblies? Because that could explain the problem, if you model referenced only a single (or a few) drools assemblies, but not the one containing BaseDoubleClassFieldReader.

In that case, you can either ikvmc everything into a single assembly or use the ikvmc -sharedclassloader option.

Regards,
Jeroen

> -----Original Message-----
> From: kpowerinfinity [mailto:kpowerinfinity@...]
> Sent: Saturday, September 05, 2009 4:59 AM
> To: Jeroen Frijters
> Cc: ikvm-developers@...
> Subject: Re: [Ikvm-developers] NoClassDefFound - possibly having .NET
> keyword in namespace
>
> Hi,
>
> The problem really occured because drools uses its own class-loading
> architecture, and cooks up the classes "in-situ" using a byte stream.
>
> The resolution has been posted on the drools dev list.
>
> Regards
> Krishna.
>
> --
> http://kpowerinfinity.wordpress.com
> http://www.linkedin.com/in/kpowerinfinity
>
>
>
>
> On Mon, Aug 31, 2009 at 9:15 PM, Jeroen Frijters<jeroen@...>
> wrote:
> > Hi Krishna,
> >
> > Sorry for being blunt, but all this shows is that you don't
> understand how type loading in .NET works.
> >
> > Type.GetType(string) only loads from the current assembly and
> mscorlib.
> >
> > I recommend studying the .NET assembly/type loading model and after
> that the IKVM class loading model:
> > http://weblog.ikvm.net/PermaLink.aspx?guid=4e0b7f7c-6f5d-42a3-a4d6-
> 5d0
> > 5a99c84ff
> >
> > Regards,
> > Jeroen
> >
> >> -----Original Message-----
> >> From: kpowerinfinity [mailto:kpowerinfinity@...]
> >> Sent: Monday, August 31, 2009 5:34 PM
> >> To: Jeroen Frijters
> >> Cc: ikvm-developers@...
> >> Subject: Re: [Ikvm-developers] NoClassDefFound - possibly having
> .NET
> >> keyword in namespace
> >>
> >> Hi Jeroen,
> >>
> >> Thanks for the investigation.
> >>
> >> This is very intriguing - I am not sure why the problem can't be
> >> reproduced at your end. I do think there's some problem with the
> >> classloader.
> >>
> >> For instance, see the code:
> >> var klass =
> >>
> Type.GetType("org.drools.base.extractors.BaseDoubleClassFieldReader")
> >> ;
> >> var ass =
> >>
> System.Reflection.Assembly.GetAssembly(typeof(org.drools.@...
> >> to
> >> rs.BaseDoubleClassFieldReader));
> >> foreach (var ty in ass.GetTypes())
> >> {
> >>      if
> >> (ty.FullName.StartsWith("org.drools.base.extractors.BaseDouble"))
> >>         Console.WriteLine(ty.ToString()); } Console.WriteLine(klass
> >> == null ? "NULL" : klass.ToString());
> >>
> >> The output for this is:
> >> org.drools.base.extractors.BaseDoubleClassFieldReader
> >> org.drools.base.extractors.BaseDoubleClassFieldWriter
> >> org.drools.base.extractors.BaseDoubleClassFieldReader+__<CallerID>
> >> org.drools.base.extractors.BaseDoubleClassFieldWriter+__<CallerID>
> >> NULL
> >>
> >> This means that I can list that class when I iterate through all the
> >> assembly, but ont create the class on its own. The class can also be
> >> referenced at compile-time and found at runtime, but I can't seem to
> >> reference it later.
> >>
> >> I have uploaded the DLL that I created here:
> >> http://kpowerinfinity.googlepages.com/drools-capillary.dll (it was
> >> 10MB and I didn't want to attach here).
> >>
> >> Look forward to hearing from you again.
> >>
> >> Regards
> >> Krishna.
> >> --
> >> http://kpowerinfinity.wordpress.com
> >> http://www.linkedin.com/in/kpowerinfinity
> >>
> >>
> >>
> >>
> >> On Sun, Aug 30, 2009 at 12:09 PM, Jeroen Frijters<jeroen@...>
> >> wrote:
> >> > Hi,
> >> >
> >> > This does not reproduce the exception you posted.
> >> >
> >> > Regards,
> >> > Jeroen
> >> >
> >> >> -----Original Message-----
> >> >> From: kpowerinfinity [mailto:kpowerinfinity@...]
> >> >> Sent: Saturday, August 29, 2009 8:26 PM
> >> >> To: Jeroen Frijters
> >> >> Cc: ikvm-developers@...
> >> >> Subject: Re: [Ikvm-developers] NoClassDefFound - possibly having
> >> .NET
> >> >> keyword in namespace
> >> >>
> >> >> Hi Jeroen,
> >> >>
> >> >> Thanks for the prompt response.
> >> >>
> >> >> To reproduce this:
> >> >> 1. Download drools-5.0.1 from jboss.org 2. Run:
> >> >> ikvmc antlr-runtime-3.1.1.jar joda-time-1.6.jar
> >> >> core-3.4.2.v_883_R34x.jar  xstream-1.3.1.jar jaxb-xjc-2.0.3.jar
> >> >> jaxb-impl-2.0.3.jar milyn-smooks-javabean-1.1.jar jxl-2.4.2.jar
> >> >> jxls-reader-0.9.6.jar  drools-decisiontables-5.0.1.jar
> >> >> janino-2.5.15.jar mvel2-2.0.10.jar drools-core-5.0.1.jar
> >> >> drools-api-5.0.1.jar drools-compiler-5.0.1.jar  jsr94-1.1.jar
> >> >> -out:..\dotnet\drools5.dll -target:library 3. Add this as a
> >> reference
> >> >> to a VS project and try to use it to compile a drools DRL file:
> >> >>
> >> >>             java.io.InputStream source =new
> >> >> java.io.FileInputStream(filename);
> >> >>             org.drools.builder.KnowledgeBuilderConfiguration kbc
> =
> >> >>
> >>
> org.drools.builder.KnowledgeBuilderFactory.newKnowledgeBuilderConfigu
> >> >> ra
> >> >> tion();
> >> >>             org.drools.builder.KnowledgeBuilder builder =
> >> >>
> org.drools.builder.KnowledgeBuilderFactory.newKnowledgeBuilder(kbc
> >> >> );
> >> >>
> >> >>
> >>
> builder.add(org.drools.io.ResourceFactory.newInputStreamResource(sour
> >> >> ce
> >> >> ),
> >> >> org.drools.builder.ResourceType.DRL);
> >> >>             if (builder.hasErrors())
> >> >>             {
> >> >>                 Console.WriteLine("Error: " +
> >> >> builder.getErrors().ToString());
> >> >>             }
> >> >>
> >> >>             org.drools.KnowledgeBase kbase =
> >> >> org.drools.KnowledgeBaseFactory.newKnowledgeBase();
> >> >>
> >> >> kbase.addKnowledgePackages(builder.getKnowledgePackages());
> >> >>             return kbase;
> >> >>
> >> >>
> >> >> It throws the exception I had earlier mailed. I can find the
> >> >> org.drools.base.extractors.BaseDoubleClassFieldReader class in
> the
> >> >> Object Explorer, but it seems the CLR is unable to find it at
> >> runtime.
> >> >>
> >> >> Thanks, Krishna.
> >> >>
> >> >> PS: A sample DRL file is attached.
> >> >>
> >> >> --
> >> >> http://kpowerinfinity.wordpress.com
> >> >> http://www.linkedin.com/in/kpowerinfinity
> >> >>
> >> >>
> >> >>
> >> >>
> >> >> On Sat, Aug 29, 2009 at 10:58 PM, Jeroen
> >> >> Frijters<jeroen@...>
> >> >> wrote:
> >> >> > Hi,
> >> >> >
> >> >> > I don't know what's going on (although it most likely is a
> class
> >> >> loader issue). I do know that it has nothing to with base being a
> >> >> C# keyword. Neither IKVM.NET nor the CLR care about C# keywords.
> >> >> >
> >> >> > If you mail instructions on how to reproduce this issue, I'd be
> >> >> > happy
> >> >> to have a look.
> >> >> >
> >> >> > Regards,
> >> >> > Jeroen
> >> >> >
> >> >> >> -----Original Message-----
> >> >> >> From: kpowerinfinity [mailto:kpowerinfinity@...]
> >> >> >> Sent: Saturday, August 29, 2009 5:45 PM
> >> >> >> To: ikvm-developers@...
> >> >> >> Subject: [Ikvm-developers] NoClassDefFound - possibly having
> >> >> >> .NET keyword in namespace
> >> >> >>
> >> >> >> Hello,
> >> >> >>
> >> >> >> I have been trying to compile Drools 5 to .NET using ikvm.
> I've
> >> >> >> had good success with the past versions, however, in version
> 5,
> >> >> >> the
> >> >> runtime
> >> >> >> throws a NoClassDefFound exception:
> >> >> >>   InnerException: java.lang.NoClassDefFoundError
> >> >> >>
> >> >>  Message="org.drools.base.extractors.BaseDoubleClassFieldReader"
> >> >> >>        Source="IKVM.Runtime"
> >> >> >>        StackTrace:
> >> >> >>             at
> >> >> >> IKVM.NativeCode.java.lang.ClassLoader.defineClass1(Object
> >> >> >> thisClassLoader, String name, Byte[] b, Int32 off, Int32 len,
> >> >> >> Object pd, String source)
> >> >> >>             at java.lang.ClassLoader.defineClass1(String ,
> >> >> >> Byte[] ,
> >> >> >> Int32 , Int32 , ProtectionDomain , String )
> >> >> >>             at java.lang.ClassLoader.defineClass(String name,
> >> >> >> Byte[]
> >> >> b,
> >> >> >> Int32 off, Int32 len, ProtectionDomain protectionDomain)
> >> >> >>             at
> >> >> >>
> >> >>
> >>
> org.drools.base.ClassFieldAccessorCache.ByteArrayClassLoader.defineCl
> >> >> as
> >> >> >> s(String
> >> >> >> name, Byte[] bytes, ProtectionDomain domain)
> >> >> >>             at
> >> >> >>
> >> org.drools.base.ClassFieldAccessorFactory.getClassFieldReader(Clas
> >> >> >> s clazz, String fieldName, CacheEntry cache)
> >> >> >>             at
> >> >> >>
> >> >>
> >>
> org.drools.base.ClassFieldAccessorCache.CacheEntry.getReadAccessor(Ac
> >> >> ce
> >> >> >> ssorKey
> >> >> >> key, Class cls)
> >> >> >>             at
> >> >> >>
> >> >>
> >>
> org.drools.base.ClassFieldAccessorCache.getReadAcessor(ClassFieldRead
> >> >> er
> >> >> >> reader)
> >> >> >>             at
> >> >> >> org.drools.base.ClassFieldAccessorStore.wire(ClassFieldReader
> >> >> >> reader)
> >> >> >>             at
> >> >> org.drools.base.ClassFieldAccessorStore.getReader(String
> >> >> >> className, String fieldName, AcceptsReadAccessor target,
> >> >> AccessorType
> >> >> >> accessorType)
> >> >> >>             at
> >> >> org.drools.base.ClassFieldAccessorStore.getReader(String
> >> >> >> className, String fieldName, AcceptsReadAccessor target)
> >> >> >>             at
> >> >> >>
> >> >>
> >>
> org.drools.rule.builder.PatternBuilder.getFieldReadAccessor(RuleBuild
> >> >> Co
> >> >> >> ntext
> >> >> >> context, BaseDescr descr, ObjectType objectType, String
> >> fieldName,
> >> >> >> AcceptsReadAccessor target, Boolean reportError)
> >> >> >>             at
> >> >> >> org.drools.rule.builder.PatternBuilder.build(RuleBuildContext
> >> >> >> , Pattern , FieldConstraintDescr , AbstractCompositeConstraint
> >> >> >> )
> >> >> >>             at
> >> >> >>
> >> >>
> >>
> org.drools.rule.builder.PatternBuilder.buildConstraint(RuleBuildConte
> >> >> xt
> >> >> >> , Pattern , Object , AbstractCompositeConstraint )
> >> >> >>             at
> >> >> >> org.drools.rule.builder.PatternBuilder.build(RuleBuildContext
> >> >> >> context, BaseDescr descr, Pattern prefixPattern)
> >> >> >>             at
> >> >> >> org.drools.rule.builder.PatternBuilder.build(RuleBuildContext
> >> >> >> context, BaseDescr descr)
> >> >> >>             at
> >> >> >>
> >> org.drools.rule.builder.GroupElementBuilder.build(RuleBuildContext
> >> >> >> context, BaseDescr descr, Pattern prefixPattern)
> >> >> >>             at
> >> >> >> org.drools.rule.builder.RuleBuilder.build(RuleBuildContext
> >> >> >> context)
> >> >> >>             at
> >> >> >> org.drools.compiler.PackageBuilder.addRule(RuleDescr
> >> >> )
> >> >> >>             at
> >> >> >> org.drools.compiler.PackageBuilder.addPackage(PackageDescr
> >> >> >> packageDescr)
> >> >> >>             at
> >> >> >> org.drools.compiler.PackageBuilder.addPackageFromDrl(Resource
> >> >> >> resource)
> >> >> >>             at
> >> >> >>
> org.drools.compiler.PackageBuilder.addKnowledgeResource(Resourc
> >> >> >> e resource, ResourceType type, ResourceConfiguration
> >> >> >> configuration)
> >> >> >>             at
> >> >> >> org.drools.builder.impl.KnowledgeBuilderImpl.add(Resource
> >> >> >> resource, ResourceType type)
> >> >> >>
> >> >> >> Interestingly, the class
> >> >> >> "org.drools.base.extractors.BaseDoubleClassFieldReader" is
> >> >> >> actually present in the assembly, and I have verified the same
> >> >> >> using the
> >> >> Object
> >> >> >> explorer. However, the runtime can't find it, and I can also
> >> >> >> not
> >> >> find
> >> >> >> it using the intellisense (and compiler) of Visual Studio
> >> >> >> because "base" within the namespace is a C# keyword. I tried
> >> >> >> org.drools.@... and
> that
> >> >> seems
> >> >> >> to be valid (just like @event).
> >> >> >>
> >> >> >> I couldn't find a good way to help the compiler/VM detect the
> >> class.
> >> >> I
> >> >> >> have tried writing a ClassLoader that can do a string-replace
> >> from
> >> >> >> org.drools.base to org.drools.@base, but haven't been able to
> >> >> (unable
> >> >> >> to compile the CustomClassLoader file due to the presence of
> >> >> >> ikvm.runtime.AssemblyClassLoader in the constructor -- I need
> >> >> >> to
> >> >> post
> >> >> >> this separately).
> >> >> >>
> >> >> >> Will really appreciate if somebody can help me figure out how
> >> >> >> to
> >> >> make
> >> >> >> the class visible. I am guessing a C# keyword being in a java
> >> >> package
> >> >> >> name could be a common scenario.
> >> >> >>
> >> >> >> Regards,
> >> >> >>
> >> >> >>
> >> >> >> Krishna Mehra
> >> >> >>
> >> >> >> --
> >> >> >> http://kpowerinfinity.wordpress.com
> >> >> >> http://www.linkedin.com/in/kpowerinfinity
> >> >> >>
> >> >> >> --------------------------------------------------------------
> -
> >> >> >> --
> >> -
> >> >> >> --
> >> >> ---
> >> >> >> -------
> >> >> >> Let Crystal Reports handle the reporting - Free Crystal
> Reports
> >> >> >> 2008 30-Day trial. Simplify your report design, integration
> and
> >> >> deployment -
> >> >> >> and focus on what you do best, core application coding.
> >> >> >> Discover
> >> >> what's
> >> >> >> new with Crystal Reports now.  http://p.sf.net/sfu/bobj-july
> >> >> >> _______________________________________________
> >> >> >> Ikvm-developers mailing list
> >> >> >> Ikvm-developers@...
> >> >> >> https://lists.sourceforge.net/lists/listinfo/ikvm-developers
> >> >> >
> >> >
> >
>
> -----------------------------------------------------------------------
> -------
> Let Crystal Reports handle the reporting - Free Crystal Reports 2008
> 30-Day trial. Simplify your report design, integration and deployment -
> and focus on what you do best, core application coding. Discover what's
> new with Crystal Reports now.  http://p.sf.net/sfu/bobj-july
> _______________________________________________
> Ikvm-developers mailing list
> Ikvm-developers@...
> https://lists.sourceforge.net/lists/listinfo/ikvm-developers

------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
trial. Simplify your report design, integration and deployment - and focus on
what you do best, core application coding. Discover what's new with
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
Ikvm-developers mailing list
Ikvm-developers@...
https://lists.sourceforge.net/lists/listinfo/ikvm-developers