Problem importing dom4j to Cellfie plugin

classic Classic list List threaded Threaded
9 messages Options
Reply | Threaded
Open this post in threaded view
|

Problem importing dom4j to Cellfie plugin

Imane An
Hello everyone,

I'm new to Java and maven and I trying to modify Cellfie plugin for parsing XML file. I need to import dom4j so I add the following code in pom.xml.

<dependency>
    <groupId>dom4j</groupId>
    <artifactId>dom4j</artifactId>
    <version>1.6.1</version>
</dependency>

It is successfully built by maven, however, the plugin cannot be shown in Protege. After I checked my code, I believe there is something wrong with dom4j. It will be appreciated if you can offer any help.

Thank you,
Imane

_______________________________________________
protege-dev mailing list
[hidden email]
https://mailman.stanford.edu/mailman/listinfo/protege-dev
Reply | Threaded
Open this post in threaded view
|

Re: Problem importing dom4j to Cellfie plugin

giacomo.ronconi
I think you have to embed the dependency into the plug-in jar. Can you report the protégé log file?

Il giorno ven 16 nov 2018 15:40 Imane An <[hidden email]> ha scritto:
Hello everyone,

I'm new to Java and maven and I trying to modify Cellfie plugin for parsing XML file. I need to import dom4j so I add the following code in pom.xml.

<dependency>
    <groupId>dom4j</groupId>
    <artifactId>dom4j</artifactId>
    <version>1.6.1</version>
</dependency>

It is successfully built by maven, however, the plugin cannot be shown in Protege. After I checked my code, I believe there is something wrong with dom4j. It will be appreciated if you can offer any help.

Thank you,
Imane
_______________________________________________
protege-dev mailing list
[hidden email]
https://mailman.stanford.edu/mailman/listinfo/protege-dev

_______________________________________________
protege-dev mailing list
[hidden email]
https://mailman.stanford.edu/mailman/listinfo/protege-dev
Reply | Threaded
Open this post in threaded view
|

Re: Problem importing dom4j to Cellfie plugin

Imane An
Thank you so much! I checked my protege.log file and found you're right!
Here is the error I got.


2018-11-16 23:22:17.903 [FelixStartLevel] ERROR FrameworkSlf4jLogger
Error starting file:/Applications/Protégé.app/Contents/Java/plugins/97.jar
org.osgi.framework.BundleException: Unresolved constraint in bundle
MyPlugin [54]: Unable to resolve 54.0: missing requirement [54.0]
osgi.wiring.package;
(&(osgi.wiring.package=org.dom4j.io)(version>=1.6.1))
    at org.apache.felix.framework.Felix.resolveBundleRevision(Felix.java:4002)
~[org.apache.felix.main.jar:na]
    at org.apache.felix.framework.Felix.startBundle(Felix.java:2045)
~[org.apache.felix.main.jar:na]
    at org.apache.felix.framework.Felix.setActiveStartLevel(Felix.java:1299)
~[org.apache.felix.main.jar:na]
    at org.apache.felix.framework.FrameworkStartLevelImpl.run(FrameworkStartLevelImpl.java:304)
[org.apache.felix.main.jar:na]
    at java.lang.Thread.run(Thread.java:745) [na:1.8.0_40]


Full log is also attached.

Can you offer some details about "embed the dependency into the plug-in jar"?

Thank you!
Imane

Giacomo Ronconi <[hidden email]> 于2018年11月16日周五 下午11:13写道:

>
> I think you have to embed the dependency into the plug-in jar. Can you report the protégé log file?
>
> Il giorno ven 16 nov 2018 15:40 Imane An <[hidden email]> ha scritto:
>>
>> Hello everyone,
>>
>> I'm new to Java and maven and I trying to modify Cellfie plugin for parsing XML file. I need to import dom4j so I add the following code in pom.xml.
>>
>> <dependency>
>>     <groupId>dom4j</groupId>
>>     <artifactId>dom4j</artifactId>
>>     <version>1.6.1</version>
>> </dependency>
>>
>> It is successfully built by maven, however, the plugin cannot be shown in Protege. After I checked my code, I believe there is something wrong with dom4j. It will be appreciated if you can offer any help.
>>
>> Thank you,
>> Imane
>> _______________________________________________
>> protege-dev mailing list
>> [hidden email]
>> https://mailman.stanford.edu/mailman/listinfo/protege-dev
>
> _______________________________________________
> protege-dev mailing list
> [hidden email]
> https://mailman.stanford.edu/mailman/listinfo/protege-dev

_______________________________________________
protege-dev mailing list
[hidden email]
https://mailman.stanford.edu/mailman/listinfo/protege-dev

protege.log (19K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Problem importing dom4j to Cellfie plugin

giacomo.ronconi

Il giorno ven 16 nov 2018 16:45 Imane An <[hidden email]> ha scritto:
Thank you so much! I checked my protege.log file and found you're right!
Here is the error I got.


2018-11-16 23:22:17.903 [FelixStartLevel] ERROR FrameworkSlf4jLogger
Error starting file:/Applications/Protégé.app/Contents/Java/plugins/97.jar
org.osgi.framework.BundleException: Unresolved constraint in bundle
MyPlugin [54]: Unable to resolve 54.0: missing requirement [54.0]
osgi.wiring.package;
(&(osgi.wiring.package=org.dom4j.io)(version>=1.6.1))
    at org.apache.felix.framework.Felix.resolveBundleRevision(Felix.java:4002)
~[org.apache.felix.main.jar:na]
    at org.apache.felix.framework.Felix.startBundle(Felix.java:2045)
~[org.apache.felix.main.jar:na]
    at org.apache.felix.framework.Felix.setActiveStartLevel(Felix.java:1299)
~[org.apache.felix.main.jar:na]
    at org.apache.felix.framework.FrameworkStartLevelImpl.run(FrameworkStartLevelImpl.java:304)
[org.apache.felix.main.jar:na]
    at java.lang.Thread.run(Thread.java:745) [na:1.8.0_40]


Full log is also attached.

Can you offer some details about "embed the dependency into the plug-in jar"?

Thank you!
Imane

Giacomo Ronconi <[hidden email]> 于2018年11月16日周五 下午11:13写道:
>
> I think you have to embed the dependency into the plug-in jar. Can you report the protégé log file?
>
> Il giorno ven 16 nov 2018 15:40 Imane An <[hidden email]> ha scritto:
>>
>> Hello everyone,
>>
>> I'm new to Java and maven and I trying to modify Cellfie plugin for parsing XML file. I need to import dom4j so I add the following code in pom.xml.
>>
>> <dependency>
>>     <groupId>dom4j</groupId>
>>     <artifactId>dom4j</artifactId>
>>     <version>1.6.1</version>
>> </dependency>
>>
>> It is successfully built by maven, however, the plugin cannot be shown in Protege. After I checked my code, I believe there is something wrong with dom4j. It will be appreciated if you can offer any help.
>>
>> Thank you,
>> Imane
>> _______________________________________________
>> protege-dev mailing list
>> [hidden email]
>> https://mailman.stanford.edu/mailman/listinfo/protege-dev
>
> _______________________________________________
> protege-dev mailing list
> [hidden email]
> https://mailman.stanford.edu/mailman/listinfo/protege-dev
_______________________________________________
protege-dev mailing list
[hidden email]
https://mailman.stanford.edu/mailman/listinfo/protege-dev

_______________________________________________
protege-dev mailing list
[hidden email]
https://mailman.stanford.edu/mailman/listinfo/protege-dev
Reply | Threaded
Open this post in threaded view
|

Re: Problem importing dom4j to Cellfie plugin

Imane An
Thanks a million!

Giacomo Ronconi <[hidden email]>于2018年11月16日 周五下午11:56写道:

Il giorno ven 16 nov 2018 16:45 Imane An <[hidden email]> ha scritto:
Thank you so much! I checked my protege.log file and found you're right!
Here is the error I got.


2018-11-16 23:22:17.903 [FelixStartLevel] ERROR FrameworkSlf4jLogger
Error starting file:/Applications/Protégé.app/Contents/Java/plugins/97.jar
org.osgi.framework.BundleException: Unresolved constraint in bundle
MyPlugin [54]: Unable to resolve 54.0: missing requirement [54.0]
osgi.wiring.package;
(&(osgi.wiring.package=org.dom4j.io)(version>=1.6.1))
    at org.apache.felix.framework.Felix.resolveBundleRevision(Felix.java:4002)
~[org.apache.felix.main.jar:na]
    at org.apache.felix.framework.Felix.startBundle(Felix.java:2045)
~[org.apache.felix.main.jar:na]
    at org.apache.felix.framework.Felix.setActiveStartLevel(Felix.java:1299)
~[org.apache.felix.main.jar:na]
    at org.apache.felix.framework.FrameworkStartLevelImpl.run(FrameworkStartLevelImpl.java:304)
[org.apache.felix.main.jar:na]
    at java.lang.Thread.run(Thread.java:745) [na:1.8.0_40]


Full log is also attached.

Can you offer some details about "embed the dependency into the plug-in jar"?

Thank you!
Imane

Giacomo Ronconi <[hidden email]> 于2018年11月16日周五 下午11:13写道:
>
> I think you have to embed the dependency into the plug-in jar. Can you report the protégé log file?
>
> Il giorno ven 16 nov 2018 15:40 Imane An <[hidden email]> ha scritto:
>>
>> Hello everyone,
>>
>> I'm new to Java and maven and I trying to modify Cellfie plugin for parsing XML file. I need to import dom4j so I add the following code in pom.xml.
>>
>> <dependency>
>>     <groupId>dom4j</groupId>
>>     <artifactId>dom4j</artifactId>
>>     <version>1.6.1</version>
>> </dependency>
>>
>> It is successfully built by maven, however, the plugin cannot be shown in Protege. After I checked my code, I believe there is something wrong with dom4j. It will be appreciated if you can offer any help.
>>
>> Thank you,
>> Imane
>> _______________________________________________
>> protege-dev mailing list
>> [hidden email]
>> https://mailman.stanford.edu/mailman/listinfo/protege-dev
>
> _______________________________________________
> protege-dev mailing list
> [hidden email]
> https://mailman.stanford.edu/mailman/listinfo/protege-dev
_______________________________________________
protege-dev mailing list
[hidden email]
https://mailman.stanford.edu/mailman/listinfo/protege-dev
_______________________________________________
protege-dev mailing list
[hidden email]
https://mailman.stanford.edu/mailman/listinfo/protege-dev

_______________________________________________
protege-dev mailing list
[hidden email]
https://mailman.stanford.edu/mailman/listinfo/protege-dev
Reply | Threaded
Open this post in threaded view
|

Re: Problem importing dom4j to Cellfie plugin

Imane An
Hello, I tried googling and have added the following code into pom.xml
but still got the same error about other packages.


<dependency>
    <groupId>dom4j</groupId>
    <artifactId>dom4j</artifactId>
    <version>1.6.1</version>
</dependency>

<Embed-Dependency>
    dom4j;scope=compile|runtime
</Embed-Dependency>

<Import-Package>
    !org.dom4j.*;version="1.6.1",
</Import-Package>


Then I got this,

2018-11-17 11:19:15.901 [FelixStartLevel] ERROR FrameworkSlf4jLogger
Error starting file:/Applications/Protégé.app/Contents/Java/plugins/119.jar
org.osgi.framework.BundleException: Unresolved constraint in bundle
MyPlugin [41]: Unable to resolve 41.0: missing requirement [41.0]
osgi.wiring.package;
(&(osgi.wiring.package=com.google.gson)(version>=2.3.0)(!(version>=3.0.0)))
    at org.apache.felix.framework.Felix.resolveBundleRevision(Felix.java:4002)
~[org.apache.felix.main.jar:na]
    at org.apache.felix.framework.Felix.startBundle(Felix.java:2045)
~[org.apache.felix.main.jar:na]
    at org.apache.felix.framework.Felix.setActiveStartLevel(Felix.java:1299)
~[org.apache.felix.main.jar:na]
    at org.apache.felix.framework.FrameworkStartLevelImpl.run(FrameworkStartLevelImpl.java:304)
[org.apache.felix.main.jar:na]
    at java.lang.Thread.run(Thread.java:745) [na:1.8.0_40]

It complains about com.google.gson, and after I added

<Import-Package>
    !com.google.gson.*,
</Import-Package>

to pom.xml, the error turned to be org.gjt.xpp.

I've tried a lot and this seems to be endless. I think I've got the
wrong way about this.
Can you help me with it?

Thank you,
Imane
Imane An <[hidden email]> 于2018年11月17日周六 上午12:06写道:

>
> Thanks a million!
>
> Giacomo Ronconi <[hidden email]>于2018年11月16日 周五下午11:56写道:
>>
>> Check this
>>
>> http://felix.apache.org/documentation/subprojects/apache-felix-maven-bundle-plugin-bnd.html#embedding-dependencies
>>
>> Il giorno ven 16 nov 2018 16:45 Imane An <[hidden email]> ha scritto:
>>>
>>> Thank you so much! I checked my protege.log file and found you're right!
>>> Here is the error I got.
>>>
>>>
>>> 2018-11-16 23:22:17.903 [FelixStartLevel] ERROR FrameworkSlf4jLogger
>>> Error starting file:/Applications/Protégé.app/Contents/Java/plugins/97.jar
>>> org.osgi.framework.BundleException: Unresolved constraint in bundle
>>> MyPlugin [54]: Unable to resolve 54.0: missing requirement [54.0]
>>> osgi.wiring.package;
>>> (&(osgi.wiring.package=org.dom4j.io)(version>=1.6.1))
>>>     at org.apache.felix.framework.Felix.resolveBundleRevision(Felix.java:4002)
>>> ~[org.apache.felix.main.jar:na]
>>>     at org.apache.felix.framework.Felix.startBundle(Felix.java:2045)
>>> ~[org.apache.felix.main.jar:na]
>>>     at org.apache.felix.framework.Felix.setActiveStartLevel(Felix.java:1299)
>>> ~[org.apache.felix.main.jar:na]
>>>     at org.apache.felix.framework.FrameworkStartLevelImpl.run(FrameworkStartLevelImpl.java:304)
>>> [org.apache.felix.main.jar:na]
>>>     at java.lang.Thread.run(Thread.java:745) [na:1.8.0_40]
>>>
>>>
>>> Full log is also attached.
>>>
>>> Can you offer some details about "embed the dependency into the plug-in jar"?
>>>
>>> Thank you!
>>> Imane
>>>
>>> Giacomo Ronconi <[hidden email]> 于2018年11月16日周五 下午11:13写道:
>>> >
>>> > I think you have to embed the dependency into the plug-in jar. Can you report the protégé log file?
>>> >
>>> > Il giorno ven 16 nov 2018 15:40 Imane An <[hidden email]> ha scritto:
>>> >>
>>> >> Hello everyone,
>>> >>
>>> >> I'm new to Java and maven and I trying to modify Cellfie plugin for parsing XML file. I need to import dom4j so I add the following code in pom.xml.
>>> >>
>>> >> <dependency>
>>> >>     <groupId>dom4j</groupId>
>>> >>     <artifactId>dom4j</artifactId>
>>> >>     <version>1.6.1</version>
>>> >> </dependency>
>>> >>
>>> >> It is successfully built by maven, however, the plugin cannot be shown in Protege. After I checked my code, I believe there is something wrong with dom4j. It will be appreciated if you can offer any help.
>>> >>
>>> >> Thank you,
>>> >> Imane
>>> >> _______________________________________________
>>> >> protege-dev mailing list
>>> >> [hidden email]
>>> >> https://mailman.stanford.edu/mailman/listinfo/protege-dev
>>> >
>>> > _______________________________________________
>>> > protege-dev mailing list
>>> > [hidden email]
>>> > https://mailman.stanford.edu/mailman/listinfo/protege-dev
>>> _______________________________________________
>>> protege-dev mailing list
>>> [hidden email]
>>> https://mailman.stanford.edu/mailman/listinfo/protege-dev
>>
>> _______________________________________________
>> protege-dev mailing list
>> [hidden email]
>> https://mailman.stanford.edu/mailman/listinfo/protege-dev
_______________________________________________
protege-dev mailing list
[hidden email]
https://mailman.stanford.edu/mailman/listinfo/protege-dev
Reply | Threaded
Open this post in threaded view
|

Re: Problem importing dom4j to Cellfie plugin

Martin O'Connor-2

Take a look at the embedded OSGi dependencies in the Cellfie plugin POM (located at [1]):

<Embed-Dependency>
  commons-codec,
  poi,
  poi-ooxml,
  poi-ooxml-schemas,
  ooxml-schemas,
  xmlbeans,
  gson,
  mapping-master
</Embed-Dependency>

The names above are the artifact identifiers. For example, for ‘poi' the POM will has the following dependency:

<dependency>
  <groupId>org.apache.poi</groupId>
  <artifactId>poi</artifactId>
  <version>3.13</version>
</dependency>

You will need to add your DOM4J dependency to the plugin POM in the same way.

Martin

[1] https://github.com/protegeproject/cellfie-plugin/blob/master/pom.xml

> On Nov 16, 2018, at 7:34 PM, Imane An <[hidden email]> wrote:
>
> Hello, I tried googling and have added the following code into pom.xml
> but still got the same error about other packages.
>
>
> <dependency>
>    <groupId>dom4j</groupId>
>    <artifactId>dom4j</artifactId>
>    <version>1.6.1</version>
> </dependency>
>
> <Embed-Dependency>
>    dom4j;scope=compile|runtime
> </Embed-Dependency>
>
> <Import-Package>
>    !org.dom4j.*;version="1.6.1",
> </Import-Package>
>
>
> Then I got this,
>
> 2018-11-17 11:19:15.901 [FelixStartLevel] ERROR FrameworkSlf4jLogger
> Error starting file:/Applications/Protégé.app/Contents/Java/plugins/119.jar
> org.osgi.framework.BundleException: Unresolved constraint in bundle
> MyPlugin [41]: Unable to resolve 41.0: missing requirement [41.0]
> osgi.wiring.package;
> (&(osgi.wiring.package=com.google.gson)(version>=2.3.0)(!(version>=3.0.0)))
>    at org.apache.felix.framework.Felix.resolveBundleRevision(Felix.java:4002)
> ~[org.apache.felix.main.jar:na]
>    at org.apache.felix.framework.Felix.startBundle(Felix.java:2045)
> ~[org.apache.felix.main.jar:na]
>    at org.apache.felix.framework.Felix.setActiveStartLevel(Felix.java:1299)
> ~[org.apache.felix.main.jar:na]
>    at org.apache.felix.framework.FrameworkStartLevelImpl.run(FrameworkStartLevelImpl.java:304)
> [org.apache.felix.main.jar:na]
>    at java.lang.Thread.run(Thread.java:745) [na:1.8.0_40]
>
> It complains about com.google.gson, and after I added
>
> <Import-Package>
>    !com.google.gson.*,
> </Import-Package>
>
> to pom.xml, the error turned to be org.gjt.xpp.
>
> I've tried a lot and this seems to be endless. I think I've got the
> wrong way about this.
> Can you help me with it?
>
> Thank you,
> Imane
> Imane An <[hidden email]> 于2018年11月17日周六 上午12:06写道:
>>
>> Thanks a million!
>>
>> Giacomo Ronconi <[hidden email]>于2018年11月16日 周五下午11:56写道:
>>>
>>> Check this
>>>
>>> http://felix.apache.org/documentation/subprojects/apache-felix-maven-bundle-plugin-bnd.html#embedding-dependencies
>>>
>>> Il giorno ven 16 nov 2018 16:45 Imane An <[hidden email]> ha scritto:
>>>>
>>>> Thank you so much! I checked my protege.log file and found you're right!
>>>> Here is the error I got.
>>>>
>>>>
>>>> 2018-11-16 23:22:17.903 [FelixStartLevel] ERROR FrameworkSlf4jLogger
>>>> Error starting file:/Applications/Protégé.app/Contents/Java/plugins/97.jar
>>>> org.osgi.framework.BundleException: Unresolved constraint in bundle
>>>> MyPlugin [54]: Unable to resolve 54.0: missing requirement [54.0]
>>>> osgi.wiring.package;
>>>> (&(osgi.wiring.package=org.dom4j.io)(version>=1.6.1))
>>>>    at org.apache.felix.framework.Felix.resolveBundleRevision(Felix.java:4002)
>>>> ~[org.apache.felix.main.jar:na]
>>>>    at org.apache.felix.framework.Felix.startBundle(Felix.java:2045)
>>>> ~[org.apache.felix.main.jar:na]
>>>>    at org.apache.felix.framework.Felix.setActiveStartLevel(Felix.java:1299)
>>>> ~[org.apache.felix.main.jar:na]
>>>>    at org.apache.felix.framework.FrameworkStartLevelImpl.run(FrameworkStartLevelImpl.java:304)
>>>> [org.apache.felix.main.jar:na]
>>>>    at java.lang.Thread.run(Thread.java:745) [na:1.8.0_40]
>>>>
>>>>
>>>> Full log is also attached.
>>>>
>>>> Can you offer some details about "embed the dependency into the plug-in jar"?
>>>>
>>>> Thank you!
>>>> Imane
>>>>
>>>> Giacomo Ronconi <[hidden email]> 于2018年11月16日周五 下午11:13写道:
>>>>>
>>>>> I think you have to embed the dependency into the plug-in jar. Can you report the protégé log file?
>>>>>
>>>>> Il giorno ven 16 nov 2018 15:40 Imane An <[hidden email]> ha scritto:
>>>>>>
>>>>>> Hello everyone,
>>>>>>
>>>>>> I'm new to Java and maven and I trying to modify Cellfie plugin for parsing XML file. I need to import dom4j so I add the following code in pom.xml.
>>>>>>
>>>>>> <dependency>
>>>>>>    <groupId>dom4j</groupId>
>>>>>>    <artifactId>dom4j</artifactId>
>>>>>>    <version>1.6.1</version>
>>>>>> </dependency>
>>>>>>
>>>>>> It is successfully built by maven, however, the plugin cannot be shown in Protege. After I checked my code, I believe there is something wrong with dom4j. It will be appreciated if you can offer any help.
>>>>>>
>>>>>> Thank you,
>>>>>> Imane
>>>>>> _______________________________________________
>>>>>> protege-dev mailing list
>>>>>> [hidden email]
>>>>>> https://mailman.stanford.edu/mailman/listinfo/protege-dev
>>>>>
>>>>> _______________________________________________
>>>>> protege-dev mailing list
>>>>> [hidden email]
>>>>> https://mailman.stanford.edu/mailman/listinfo/protege-dev
>>>> _______________________________________________
>>>> protege-dev mailing list
>>>> [hidden email]
>>>> https://mailman.stanford.edu/mailman/listinfo/protege-dev
>>>
>>> _______________________________________________
>>> protege-dev mailing list
>>> [hidden email]
>>> https://mailman.stanford.edu/mailman/listinfo/protege-dev
> _______________________________________________
> protege-dev mailing list
> [hidden email]
> https://mailman.stanford.edu/mailman/listinfo/protege-dev

_______________________________________________
protege-dev mailing list
[hidden email]
https://mailman.stanford.edu/mailman/listinfo/protege-dev
Reply | Threaded
Open this post in threaded view
|

Re: Problem importing dom4j to Cellfie plugin

Imane An
Thanks a lot!

I think I've finally solved this problem (maybe temporarily)!

For who encounters the same problem, I post part of my pom.xml here
for a reference.

<dependency>
    <groupId>dom4j</groupId>
    <artifactId>dom4j</artifactId>
    <version>1.6.1</version>
</dependency>

<Embed-Dependency>
    commons-codec,
    poi,
    poi-ooxml,
    poi-ooxml-schemas,
    ooxml-schemas,
    xmlbeans,
    gson,
    mapping-master,
    dom4j
</Embed-Dependency>

<Import-Package>
    org.protege.editor.core.*;version="5.0.0",
    org.protege.editor.owl.*;version="5.0.0",
    !com.google.gson.*,
    !org.gjt.xpp.*;version="2.1.0",
    !org.jaxen.*;version="1.1.6",
    !org.relaxng.datatype,
    !org.xmlpull.v1,
    org.semanticweb.owlapi.*;version="[4.1.3,5.0.0)",
    junit.framework;resolution:=optional,
    org.apache.*;resolution:=optional,
    org.bouncycastle.*;resolution:=optional,
    org.etsi.*;resolution:=optional,
    org.junit.*;resolution:=optional,
    org.openxmlformats.*;resolution:=optional,
    schemasMicrosoftCom*;resolution:=optional,
    com.sun.*;resolution:=optional,
    javax.*;resolution:=optional,
    *
</Import-Package>

This works fine for my currently. More information will be updated
here if any issue occurs later.
Martin O'Connor <[hidden email]> 于2018年11月18日周日 上午2:05写道:

>
>
> Take a look at the embedded OSGi dependencies in the Cellfie plugin POM (located at [1]):
>
> <Embed-Dependency>
>   commons-codec,
>   poi,
>   poi-ooxml,
>   poi-ooxml-schemas,
>   ooxml-schemas,
>   xmlbeans,
>   gson,
>   mapping-master
> </Embed-Dependency>
>
> The names above are the artifact identifiers. For example, for ‘poi' the POM will has the following dependency:
>
> <dependency>
>   <groupId>org.apache.poi</groupId>
>   <artifactId>poi</artifactId>
>   <version>3.13</version>
> </dependency>
>
> You will need to add your DOM4J dependency to the plugin POM in the same way.
>
> Martin
>
> [1] https://github.com/protegeproject/cellfie-plugin/blob/master/pom.xml
>
> > On Nov 16, 2018, at 7:34 PM, Imane An <[hidden email]> wrote:
> >
> > Hello, I tried googling and have added the following code into pom.xml
> > but still got the same error about other packages.
> >
> >
> > <dependency>
> >    <groupId>dom4j</groupId>
> >    <artifactId>dom4j</artifactId>
> >    <version>1.6.1</version>
> > </dependency>
> >
> > <Embed-Dependency>
> >    dom4j;scope=compile|runtime
> > </Embed-Dependency>
> >
> > <Import-Package>
> >    !org.dom4j.*;version="1.6.1",
> > </Import-Package>
> >
> >
> > Then I got this,
> >
> > 2018-11-17 11:19:15.901 [FelixStartLevel] ERROR FrameworkSlf4jLogger
> > Error starting file:/Applications/Protégé.app/Contents/Java/plugins/119.jar
> > org.osgi.framework.BundleException: Unresolved constraint in bundle
> > MyPlugin [41]: Unable to resolve 41.0: missing requirement [41.0]
> > osgi.wiring.package;
> > (&(osgi.wiring.package=com.google.gson)(version>=2.3.0)(!(version>=3.0.0)))
> >    at org.apache.felix.framework.Felix.resolveBundleRevision(Felix.java:4002)
> > ~[org.apache.felix.main.jar:na]
> >    at org.apache.felix.framework.Felix.startBundle(Felix.java:2045)
> > ~[org.apache.felix.main.jar:na]
> >    at org.apache.felix.framework.Felix.setActiveStartLevel(Felix.java:1299)
> > ~[org.apache.felix.main.jar:na]
> >    at org.apache.felix.framework.FrameworkStartLevelImpl.run(FrameworkStartLevelImpl.java:304)
> > [org.apache.felix.main.jar:na]
> >    at java.lang.Thread.run(Thread.java:745) [na:1.8.0_40]
> >
> > It complains about com.google.gson, and after I added
> >
> > <Import-Package>
> >    !com.google.gson.*,
> > </Import-Package>
> >
> > to pom.xml, the error turned to be org.gjt.xpp.
> >
> > I've tried a lot and this seems to be endless. I think I've got the
> > wrong way about this.
> > Can you help me with it?
> >
> > Thank you,
> > Imane
> > Imane An <[hidden email]> 于2018年11月17日周六 上午12:06写道:
> >>
> >> Thanks a million!
> >>
> >> Giacomo Ronconi <[hidden email]>于2018年11月16日 周五下午11:56写道:
> >>>
> >>> Check this
> >>>
> >>> http://felix.apache.org/documentation/subprojects/apache-felix-maven-bundle-plugin-bnd.html#embedding-dependencies
> >>>
> >>> Il giorno ven 16 nov 2018 16:45 Imane An <[hidden email]> ha scritto:
> >>>>
> >>>> Thank you so much! I checked my protege.log file and found you're right!
> >>>> Here is the error I got.
> >>>>
> >>>>
> >>>> 2018-11-16 23:22:17.903 [FelixStartLevel] ERROR FrameworkSlf4jLogger
> >>>> Error starting file:/Applications/Protégé.app/Contents/Java/plugins/97.jar
> >>>> org.osgi.framework.BundleException: Unresolved constraint in bundle
> >>>> MyPlugin [54]: Unable to resolve 54.0: missing requirement [54.0]
> >>>> osgi.wiring.package;
> >>>> (&(osgi.wiring.package=org.dom4j.io)(version>=1.6.1))
> >>>>    at org.apache.felix.framework.Felix.resolveBundleRevision(Felix.java:4002)
> >>>> ~[org.apache.felix.main.jar:na]
> >>>>    at org.apache.felix.framework.Felix.startBundle(Felix.java:2045)
> >>>> ~[org.apache.felix.main.jar:na]
> >>>>    at org.apache.felix.framework.Felix.setActiveStartLevel(Felix.java:1299)
> >>>> ~[org.apache.felix.main.jar:na]
> >>>>    at org.apache.felix.framework.FrameworkStartLevelImpl.run(FrameworkStartLevelImpl.java:304)
> >>>> [org.apache.felix.main.jar:na]
> >>>>    at java.lang.Thread.run(Thread.java:745) [na:1.8.0_40]
> >>>>
> >>>>
> >>>> Full log is also attached.
> >>>>
> >>>> Can you offer some details about "embed the dependency into the plug-in jar"?
> >>>>
> >>>> Thank you!
> >>>> Imane
> >>>>
> >>>> Giacomo Ronconi <[hidden email]> 于2018年11月16日周五 下午11:13写道:
> >>>>>
> >>>>> I think you have to embed the dependency into the plug-in jar. Can you report the protégé log file?
> >>>>>
> >>>>> Il giorno ven 16 nov 2018 15:40 Imane An <[hidden email]> ha scritto:
> >>>>>>
> >>>>>> Hello everyone,
> >>>>>>
> >>>>>> I'm new to Java and maven and I trying to modify Cellfie plugin for parsing XML file. I need to import dom4j so I add the following code in pom.xml.
> >>>>>>
> >>>>>> <dependency>
> >>>>>>    <groupId>dom4j</groupId>
> >>>>>>    <artifactId>dom4j</artifactId>
> >>>>>>    <version>1.6.1</version>
> >>>>>> </dependency>
> >>>>>>
> >>>>>> It is successfully built by maven, however, the plugin cannot be shown in Protege. After I checked my code, I believe there is something wrong with dom4j. It will be appreciated if you can offer any help.
> >>>>>>
> >>>>>> Thank you,
> >>>>>> Imane
> >>>>>> _______________________________________________
> >>>>>> protege-dev mailing list
> >>>>>> [hidden email]
> >>>>>> https://mailman.stanford.edu/mailman/listinfo/protege-dev
> >>>>>
> >>>>> _______________________________________________
> >>>>> protege-dev mailing list
> >>>>> [hidden email]
> >>>>> https://mailman.stanford.edu/mailman/listinfo/protege-dev
> >>>> _______________________________________________
> >>>> protege-dev mailing list
> >>>> [hidden email]
> >>>> https://mailman.stanford.edu/mailman/listinfo/protege-dev
> >>>
> >>> _______________________________________________
> >>> protege-dev mailing list
> >>> [hidden email]
> >>> https://mailman.stanford.edu/mailman/listinfo/protege-dev
> > _______________________________________________
> > protege-dev mailing list
> > [hidden email]
> > https://mailman.stanford.edu/mailman/listinfo/protege-dev
>
> _______________________________________________
> protege-dev mailing list
> [hidden email]
> https://mailman.stanford.edu/mailman/listinfo/protege-dev
_______________________________________________
protege-dev mailing list
[hidden email]
https://mailman.stanford.edu/mailman/listinfo/protege-dev
Reply | Threaded
Open this post in threaded view
|

Re: Problem importing dom4j to Cellfie plugin

Martin O'Connor-2

Note that in general you should try to avoid embedding JARs into OSGi bundles and instead use OSGi bundles as dependencies - if available. For example, the OSGi bundles for the DOM4J 1.6.1 dependency is:

<dependency>
    <groupId>dom4j</groupId>
    <artifactId>dom4j.osgi</artifactId>
    <version>1.6.1</version>
</dependency>

However, I've had a very hard time getting some of these bundle dependencies to work so I would only attempt this type of resolution if you are feeling adventurous.

Martin


> On Nov 18, 2018, at 7:20 PM, Imane An <[hidden email]> wrote:
>
> Thanks a lot!
>
> I think I've finally solved this problem (maybe temporarily)!
>
> For who encounters the same problem, I post part of my pom.xml here
> for a reference.
>
> <dependency>
>    <groupId>dom4j</groupId>
>    <artifactId>dom4j</artifactId>
>    <version>1.6.1</version>
> </dependency>
>
> <Embed-Dependency>
>    commons-codec,
>    poi,
>    poi-ooxml,
>    poi-ooxml-schemas,
>    ooxml-schemas,
>    xmlbeans,
>    gson,
>    mapping-master,
>    dom4j
> </Embed-Dependency>
>
> <Import-Package>
>    org.protege.editor.core.*;version="5.0.0",
>    org.protege.editor.owl.*;version="5.0.0",
>    !com.google.gson.*,
>    !org.gjt.xpp.*;version="2.1.0",
>    !org.jaxen.*;version="1.1.6",
>    !org.relaxng.datatype,
>    !org.xmlpull.v1,
>    org.semanticweb.owlapi.*;version="[4.1.3,5.0.0)",
>    junit.framework;resolution:=optional,
>    org.apache.*;resolution:=optional,
>    org.bouncycastle.*;resolution:=optional,
>    org.etsi.*;resolution:=optional,
>    org.junit.*;resolution:=optional,
>    org.openxmlformats.*;resolution:=optional,
>    schemasMicrosoftCom*;resolution:=optional,
>    com.sun.*;resolution:=optional,
>    javax.*;resolution:=optional,
>    *
> </Import-Package>
>
> This works fine for my currently. More information will be updated
> here if any issue occurs later.
> Martin O'Connor <[hidden email]> 于2018年11月18日周日 上午2:05写道:
>>
>>
>> Take a look at the embedded OSGi dependencies in the Cellfie plugin POM (located at [1]):
>>
>> <Embed-Dependency>
>>  commons-codec,
>>  poi,
>>  poi-ooxml,
>>  poi-ooxml-schemas,
>>  ooxml-schemas,
>>  xmlbeans,
>>  gson,
>>  mapping-master
>> </Embed-Dependency>
>>
>> The names above are the artifact identifiers. For example, for ‘poi' the POM will has the following dependency:
>>
>> <dependency>
>>  <groupId>org.apache.poi</groupId>
>>  <artifactId>poi</artifactId>
>>  <version>3.13</version>
>> </dependency>
>>
>> You will need to add your DOM4J dependency to the plugin POM in the same way.
>>
>> Martin
>>
>> [1] https://github.com/protegeproject/cellfie-plugin/blob/master/pom.xml
>>
>>> On Nov 16, 2018, at 7:34 PM, Imane An <[hidden email]> wrote:
>>>
>>> Hello, I tried googling and have added the following code into pom.xml
>>> but still got the same error about other packages.
>>>
>>>
>>> <dependency>
>>>   <groupId>dom4j</groupId>
>>>   <artifactId>dom4j</artifactId>
>>>   <version>1.6.1</version>
>>> </dependency>
>>>
>>> <Embed-Dependency>
>>>   dom4j;scope=compile|runtime
>>> </Embed-Dependency>
>>>
>>> <Import-Package>
>>>   !org.dom4j.*;version="1.6.1",
>>> </Import-Package>
>>>
>>>
>>> Then I got this,
>>>
>>> 2018-11-17 11:19:15.901 [FelixStartLevel] ERROR FrameworkSlf4jLogger
>>> Error starting file:/Applications/Protégé.app/Contents/Java/plugins/119.jar
>>> org.osgi.framework.BundleException: Unresolved constraint in bundle
>>> MyPlugin [41]: Unable to resolve 41.0: missing requirement [41.0]
>>> osgi.wiring.package;
>>> (&(osgi.wiring.package=com.google.gson)(version>=2.3.0)(!(version>=3.0.0)))
>>>   at org.apache.felix.framework.Felix.resolveBundleRevision(Felix.java:4002)
>>> ~[org.apache.felix.main.jar:na]
>>>   at org.apache.felix.framework.Felix.startBundle(Felix.java:2045)
>>> ~[org.apache.felix.main.jar:na]
>>>   at org.apache.felix.framework.Felix.setActiveStartLevel(Felix.java:1299)
>>> ~[org.apache.felix.main.jar:na]
>>>   at org.apache.felix.framework.FrameworkStartLevelImpl.run(FrameworkStartLevelImpl.java:304)
>>> [org.apache.felix.main.jar:na]
>>>   at java.lang.Thread.run(Thread.java:745) [na:1.8.0_40]
>>>
>>> It complains about com.google.gson, and after I added
>>>
>>> <Import-Package>
>>>   !com.google.gson.*,
>>> </Import-Package>
>>>
>>> to pom.xml, the error turned to be org.gjt.xpp.
>>>
>>> I've tried a lot and this seems to be endless. I think I've got the
>>> wrong way about this.
>>> Can you help me with it?
>>>
>>> Thank you,
>>> Imane
>>> Imane An <[hidden email]> 于2018年11月17日周六 上午12:06写道:
>>>>
>>>> Thanks a million!
>>>>
>>>> Giacomo Ronconi <[hidden email]>于2018年11月16日 周五下午11:56写道:
>>>>>
>>>>> Check this
>>>>>
>>>>> http://felix.apache.org/documentation/subprojects/apache-felix-maven-bundle-plugin-bnd.html#embedding-dependencies
>>>>>
>>>>> Il giorno ven 16 nov 2018 16:45 Imane An <[hidden email]> ha scritto:
>>>>>>
>>>>>> Thank you so much! I checked my protege.log file and found you're right!
>>>>>> Here is the error I got.
>>>>>>
>>>>>>
>>>>>> 2018-11-16 23:22:17.903 [FelixStartLevel] ERROR FrameworkSlf4jLogger
>>>>>> Error starting file:/Applications/Protégé.app/Contents/Java/plugins/97.jar
>>>>>> org.osgi.framework.BundleException: Unresolved constraint in bundle
>>>>>> MyPlugin [54]: Unable to resolve 54.0: missing requirement [54.0]
>>>>>> osgi.wiring.package;
>>>>>> (&(osgi.wiring.package=org.dom4j.io)(version>=1.6.1))
>>>>>>   at org.apache.felix.framework.Felix.resolveBundleRevision(Felix.java:4002)
>>>>>> ~[org.apache.felix.main.jar:na]
>>>>>>   at org.apache.felix.framework.Felix.startBundle(Felix.java:2045)
>>>>>> ~[org.apache.felix.main.jar:na]
>>>>>>   at org.apache.felix.framework.Felix.setActiveStartLevel(Felix.java:1299)
>>>>>> ~[org.apache.felix.main.jar:na]
>>>>>>   at org.apache.felix.framework.FrameworkStartLevelImpl.run(FrameworkStartLevelImpl.java:304)
>>>>>> [org.apache.felix.main.jar:na]
>>>>>>   at java.lang.Thread.run(Thread.java:745) [na:1.8.0_40]
>>>>>>
>>>>>>
>>>>>> Full log is also attached.
>>>>>>
>>>>>> Can you offer some details about "embed the dependency into the plug-in jar"?
>>>>>>
>>>>>> Thank you!
>>>>>> Imane
>>>>>>
>>>>>> Giacomo Ronconi <[hidden email]> 于2018年11月16日周五 下午11:13写道:
>>>>>>>
>>>>>>> I think you have to embed the dependency into the plug-in jar. Can you report the protégé log file?
>>>>>>>
>>>>>>> Il giorno ven 16 nov 2018 15:40 Imane An <[hidden email]> ha scritto:
>>>>>>>>
>>>>>>>> Hello everyone,
>>>>>>>>
>>>>>>>> I'm new to Java and maven and I trying to modify Cellfie plugin for parsing XML file. I need to import dom4j so I add the following code in pom.xml.
>>>>>>>>
>>>>>>>> <dependency>
>>>>>>>>   <groupId>dom4j</groupId>
>>>>>>>>   <artifactId>dom4j</artifactId>
>>>>>>>>   <version>1.6.1</version>
>>>>>>>> </dependency>
>>>>>>>>
>>>>>>>> It is successfully built by maven, however, the plugin cannot be shown in Protege. After I checked my code, I believe there is something wrong with dom4j. It will be appreciated if you can offer any help.
>>>>>>>>
>>>>>>>> Thank you,
>>>>>>>> Imane
>>>>>>>> _______________________________________________
>>>>>>>> protege-dev mailing list
>>>>>>>> [hidden email]
>>>>>>>> https://mailman.stanford.edu/mailman/listinfo/protege-dev
>>>>>>>
>>>>>>> _______________________________________________
>>>>>>> protege-dev mailing list
>>>>>>> [hidden email]
>>>>>>> https://mailman.stanford.edu/mailman/listinfo/protege-dev
>>>>>> _______________________________________________
>>>>>> protege-dev mailing list
>>>>>> [hidden email]
>>>>>> https://mailman.stanford.edu/mailman/listinfo/protege-dev
>>>>>
>>>>> _______________________________________________
>>>>> protege-dev mailing list
>>>>> [hidden email]
>>>>> https://mailman.stanford.edu/mailman/listinfo/protege-dev
>>> _______________________________________________
>>> protege-dev mailing list
>>> [hidden email]
>>> https://mailman.stanford.edu/mailman/listinfo/protege-dev
>>
>> _______________________________________________
>> protege-dev mailing list
>> [hidden email]
>> https://mailman.stanford.edu/mailman/listinfo/protege-dev
> _______________________________________________
> protege-dev mailing list
> [hidden email]
> https://mailman.stanford.edu/mailman/listinfo/protege-dev

_______________________________________________
protege-dev mailing list
[hidden email]
https://mailman.stanford.edu/mailman/listinfo/protege-dev