You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@felix.apache.org by Roland <wg...@ids.de> on 2013/06/21 15:28:53 UTC

Invalid package name: '*' ????

hello,
I'm at it again .... and I hope I'm right here.

I hang on a problem for a few hours. I do not know what I'm doing wrong.
Below is the error message and my POM. 

...
[INFO] [bundle:bundle {execution: default-bundle}]
in default pack? 
[WARNING] Bundle mygroupId:myartifactId:bundle:1.0.0.0 : Invalid package
name: '*'
[ERROR] Bundle
de.ids.acos.rtu.osgi.bundles:acos-rtu-constants:bundle:1.0.0.0 : The default
package '.' is not permitted by the Import-Package syntax. 
 This can be caused by compile errors in Eclipse because Eclipse creates 
valid class files regardless of compile errors.
The following package(s) import from the default package null
[ERROR] Error(s) found in bundle configuration



<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/xsd/maven-4.0.0.xsd">
  <modelVersion>4.0.0</modelVersion>
  <parent>
    <groupId>mygroupID</groupId>
    <artifactId>myparent</artifactId>
    <version>1.0.0.0</version>
  </parent>
  <groupId>mygroupID</groupId>
  <artifactId>myproject</artifactId>
  <name>myproject</name>
  <packaging>bundle</packaging>
  <build>
    <plugins>
      <plugin>
        <groupId>org.apache.felix</groupId>
        <artifactId>maven-bundle-plugin</artifactId>
        <extensions>true</extensions>
        <configuration>
          <archive>
          </archive>
          <instructions>
           
<Bundle-SymbolicName>${project.groupId}.${project.artifactId}</Bundle-SymbolicName>
            <Bundle-Description>${project.description}</Bundle-Description>
            <Bundle-Version>${project.version}</Bundle-Version>
            <Bundle-Activator></Bundle-Activator>
            <EXPORT-PACKAGE>
              mypackage;version=1.0.0.0
            </EXPORT-PACKAGE>
            <IMPORT-PACKAGE>
              *
            </IMPORT-PACKAGE>
          </instructions>
        </configuration>
      </plugin>
    </plugins>
  </build>
</project>



I have already tried "mvn clean", but that does not help. Recently I get
frequently strange error messages from maven. From time to time I can not
build my projects and I get the following error message: ... Source not
found. This indicates that the compiler can not find the source. After a
further try everything works again! There is probably a bug somewhere in the
Maven-Universe. Maybe I should ask this in a Maven forum.

Any suggestions?

Thanks in advance!
Roland



--
View this message in context: http://apache-felix.18485.x6.nabble.com/Invalid-package-name-tp5004065.html
Sent from the Apache Felix - Users mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
For additional commands, e-mail: users-help@felix.apache.org


Re: Invalid package name: '*' ????

Posted by Roland <wg...@ids.de>.
If I import the project with M2E it says:

Error(s) found in manifest configuration
(org.apache.felix:maven-bundle-plugin:2.4.0:bundle:default-bundle:package)

nothing else...



--
View this message in context: http://apache-felix.18485.x6.nabble.com/Invalid-package-name-tp5004065p5004068.html
Sent from the Apache Felix - Users mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
For additional commands, e-mail: users-help@felix.apache.org


Re: Invalid package name: '*' ????

Posted by Neil Bartlett <nj...@gmail.com>.
The answer is right there in the error message.  

You probably have Eclipse open on this project, and there are compile errors. Unlike javac, Eclipse still outputs a class file for java sources with compile errors, but these classes are weird. In particular they depend on the default package ".", which is illegal in OSGi.  

-- 
Neil Bartlett
Sent from a phone


On Friday, 21 June 2013 at 14:59, Roland wrote:

> Thanks for your reply 
> 
> This is common practise and is not the reason...
> 
> <IMPORT-PACKAGE>*</IMPORT-PACKAGE>
> 
> 
> 
> --
> View this message in context: http://apache-felix.18485.x6.nabble.com/Invalid-package-name-tp5004065p5004069.html
> Sent from the Apache Felix - Users mailing list archive at Nabble.com.
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
> For additional commands, e-mail: users-help@felix.apache.org
> 
> 



Re: Invalid package name: '*' ????

Posted by Roland <wg...@ids.de>.
Thanks for your reply 

This is common practise and is not the reason...

     <IMPORT-PACKAGE>*</IMPORT-PACKAGE>



--
View this message in context: http://apache-felix.18485.x6.nabble.com/Invalid-package-name-tp5004065p5004069.html
Sent from the Apache Felix - Users mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
For additional commands, e-mail: users-help@felix.apache.org


Re: Invalid package name: '*' ????

Posted by Ferry Huberts <ma...@hupie.com>.

On 21/06/13 15:28, Roland wrote:
> hello,
> I'm at it again .... and I hope I'm right here.
> 
> I hang on a problem for a few hours. I do not know what I'm doing wrong.
> Below is the error message and my POM. 
> 
> ...
> [INFO] [bundle:bundle {execution: default-bundle}]
> in default pack? 
> [WARNING] Bundle mygroupId:myartifactId:bundle:1.0.0.0 : Invalid package
> name: '*'
> [ERROR] Bundle
> de.ids.acos.rtu.osgi.bundles:acos-rtu-constants:bundle:1.0.0.0 : The default
> package '.' is not permitted by the Import-Package syntax. 
>  This can be caused by compile errors in Eclipse because Eclipse creates 
> valid class files regardless of compile errors.
> The following package(s) import from the default package null
> [ERROR] Error(s) found in bundle configuration
> 
> 
> 
> <project xmlns="http://maven.apache.org/POM/4.0.0"
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
> http://maven.apache.org/xsd/maven-4.0.0.xsd">
>   <modelVersion>4.0.0</modelVersion>
>   <parent>
>     <groupId>mygroupID</groupId>
>     <artifactId>myparent</artifactId>
>     <version>1.0.0.0</version>
>   </parent>
>   <groupId>mygroupID</groupId>
>   <artifactId>myproject</artifactId>
>   <name>myproject</name>
>   <packaging>bundle</packaging>
>   <build>
>     <plugins>
>       <plugin>
>         <groupId>org.apache.felix</groupId>
>         <artifactId>maven-bundle-plugin</artifactId>
>         <extensions>true</extensions>
>         <configuration>
>           <archive>
>           </archive>
>           <instructions>
>            
> <Bundle-SymbolicName>${project.groupId}.${project.artifactId}</Bundle-SymbolicName>
>             <Bundle-Description>${project.description}</Bundle-Description>
>             <Bundle-Version>${project.version}</Bundle-Version>
>             <Bundle-Activator></Bundle-Activator>
>             <EXPORT-PACKAGE>
>               mypackage;version=1.0.0.0
>             </EXPORT-PACKAGE>
>             <IMPORT-PACKAGE>
>               *
>             </IMPORT-PACKAGE>


I'm not a maven user, but try without the import-package section.
bnd calculates this for you.

>           </instructions>
>         </configuration>
>       </plugin>
>     </plugins>
>   </build>
> </project>
> 
> 
> 
> I have already tried "mvn clean", but that does not help. Recently I get
> frequently strange error messages from maven. From time to time I can not
> build my projects and I get the following error message: ... Source not
> found. This indicates that the compiler can not find the source. After a
> further try everything works again! There is probably a bug somewhere in the
> Maven-Universe. Maybe I should ask this in a Maven forum.
> 
> Any suggestions?
> 
> Thanks in advance!
> Roland
> 
> 
> 
> --
> View this message in context: http://apache-felix.18485.x6.nabble.com/Invalid-package-name-tp5004065.html
> Sent from the Apache Felix - Users mailing list archive at Nabble.com.
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
> For additional commands, e-mail: users-help@felix.apache.org
> 

-- 
Ferry Huberts

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
For additional commands, e-mail: users-help@felix.apache.org


Re: Invalid package name: '*' ????

Posted by Roland <wg...@ids.de>.
I read sometime in the past that BND is case-sensitive and therefore
"Import-Package" must be capitalized.



--
View this message in context: http://apache-felix.18485.x6.nabble.com/Invalid-package-name-tp5004065p5004077.html
Sent from the Apache Felix - Users mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
For additional commands, e-mail: users-help@felix.apache.org


Re: Invalid package name: '*' ????

Posted by Felix Meschberger <fm...@adobe.com>.
Hi could it be the all caps spelling of your import and export statements ?

Regards
Felix

--
Felix Meschberger  |  Principal Scientist  |  fmeschbe@adobe.com

Am 21.06.2013 um 16:44 schrieb "Roland" <wg...@ids.de>:

> I deleted the project but now all the other projects can no longer be built
> because of compiler errors I mentiond above: cannot find symbol...
> Obviously my class-paths were destroyed by the whole action. This must be a
> bug!
> I remember that I had accidentally moved a class out from a package. I
> immediately reversed that. It may be that Eclipse has added this class to
> the default package.
> 
> 
> 
> --
> View this message in context: http://apache-felix.18485.x6.nabble.com/Invalid-package-name-tp5004065p5004074.html
> Sent from the Apache Felix - Users mailing list archive at Nabble.com.
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
> For additional commands, e-mail: users-help@felix.apache.org
> 

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
For additional commands, e-mail: users-help@felix.apache.org


Re: Invalid package name: '*' ????

Posted by Ferry Huberts <ma...@hupie.com>.

On 21/06/13 17:47, Roland wrote:
> But in all other projects of mine are like this and are ok. Why not this
> project?
> 

the bundle plugin was recently updated. it contains a much newer bnd.
that bnd probably is much stricter.

did you rebuild all of these other projects?
if not, then do so to support your claim ;-)

> 
> 
> --
> View this message in context: http://apache-felix.18485.x6.nabble.com/Invalid-package-name-tp5004065p5004079.html
> Sent from the Apache Felix - Users mailing list archive at Nabble.com.
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
> For additional commands, e-mail: users-help@felix.apache.org
> 

-- 
Ferry Huberts

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
For additional commands, e-mail: users-help@felix.apache.org


Re: Invalid package name: '*' ????

Posted by Neil Bartlett <nj...@gmail.com>.
I have no idea. You haven't given any details about those other projects, so probably they are not really the same at all. 

Neil


-- 
Neil Bartlett
Sent from a phone


On Friday, 21 June 2013 at 16:47, Roland wrote:

> But in all other projects of mine are like this and are ok. Why not this
> project?
> 
> 
> 
> --
> View this message in context: http://apache-felix.18485.x6.nabble.com/Invalid-package-name-tp5004065p5004079.html
> Sent from the Apache Felix - Users mailing list archive at Nabble.com.
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
> For additional commands, e-mail: users-help@felix.apache.org
> 
> 



Re: Invalid package name: '*' ????

Posted by Roland <wg...@ids.de>.
But in all other projects of mine are like this and are ok. Why not this
project?



--
View this message in context: http://apache-felix.18485.x6.nabble.com/Invalid-package-name-tp5004065p5004079.html
Sent from the Apache Felix - Users mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
For additional commands, e-mail: users-help@felix.apache.org


Re: Invalid package name: '*' ????

Posted by Roland <wg...@ids.de>.
An empty element "<Bundle-Activator></Bundle-Activator>" results in a equal
error-output.
Regards!
Roland



--
View this message in context: http://apache-felix.18485.x6.nabble.com/Invalid-package-name-tp5004065p5004624.html
Sent from the Apache Felix - Users mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
For additional commands, e-mail: users-help@felix.apache.org


Re: Invalid package name: '*' ????

Posted by Roland <wg...@ids.de>.
I now know why it worked last Friday.

I specified jar as the packaging but not "bundle". I.e. I get a ordinary
JAR. It is then converted into a bundle with "mvn bundle:bundle". After a
"mvn clean" I get back the original error "The default package '.' is not
permitted...". This could be a short term workaround for errors like this
but it does not solves the error.

If the class is empty (no methodes defined) nothing will be exported. This
causes the warning: "The JAR is empty: The instructions for the JAR named
mypackage did not cause any content to be exported..."

And I define a *public static final* member-variable in my class which is in
the default package. This causes "The default package '.' is not
permitted...".

so take care what you do...



--
View this message in context: http://apache-felix.18485.x6.nabble.com/Invalid-package-name-tp5004065p5004122.html
Sent from the Apache Felix - Users mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
For additional commands, e-mail: users-help@felix.apache.org


Re: Invalid package name: '*' ????

Posted by Roland <wg...@ids.de>.
you will not believe it! I had no luck with mvn clean install. But after I
ran mvn clean bundle: bundle and then mvn install everything works. No idea
why.



       *****SOLVED******



Thank you guys, have a nice weekend




--
View this message in context: http://apache-felix.18485.x6.nabble.com/Invalid-package-name-tp5004065p5004084.html
Sent from the Apache Felix - Users mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
For additional commands, e-mail: users-help@felix.apache.org


Re: Invalid package name: '*' ????

Posted by Roland <wg...@ids.de>.
The error output of the maven-bundle-plugin/bnd is not very helpful. But I
just had an idea.

mvn clean bundle:bundle     shows more error-output than     mvn clean
install -X

Now I just have to figure out why the package is empty.

[WARNING] Bundle mypackage:myproject:bundle:1.0.0.0 : Unused Private-Package
instructions, no such package(s) on the class
 path: [!*]
[WARNING] Bundle mypackage:myproject:bundle:1.0.0.0 : The JAR is empty: The
instructions for the JAR named mypackage did not cause any content to be
included, this is likely wrong
[ERROR] Bundle mypackage:myproject:bundle:1.0.0.0 : The default package '.'
is not permitted by the Import-Package syntax.

 This can be caused by compile errors in Eclipse because Eclipse creates
valid class files regardless of compile errors.
The following package(s) import from the default package null



--
View this message in context: http://apache-felix.18485.x6.nabble.com/Invalid-package-name-tp5004065p5004083.html
Sent from the Apache Felix - Users mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
For additional commands, e-mail: users-help@felix.apache.org


Re: Invalid package name: '*' ????

Posted by Roland <wg...@ids.de>.
Ok, this solved the error "Invalid package name: '*' " but  "The default
package '.' is not permitted..." is still there. But I now get a different
error message from eclipse:

An internal error occurred during: "Updating Maven Project".
Unsupported IClasspathEntry kind=4

This concerns to M2E. I will switch back to the maven-bundle-plugin.

tzzzzz....



--
View this message in context: http://apache-felix.18485.x6.nabble.com/Invalid-package-name-tp5004065p5004082.html
Sent from the Apache Felix - Users mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
For additional commands, e-mail: users-help@felix.apache.org


Re: Invalid package name: '*' ????

Posted by Neil Bartlett <nj...@gmail.com>.
Ah of course, this is the problem.

IMPORT-PACKAGE is not recognised by bnd (or the Maven bundle plugin).
Therefore the value "*" just passes straight through.

However OSGi in the runtime doesn't care about capitalisation, so it's
equivalent to setting Import-Package, and * is not a legal value in
OSGI. So just correct it to Import-Package.

On Fri, Jun 21, 2013 at 4:31 PM, Roland <wg...@ids.de> wrote:
> I deleted the entire workspace and checked out everything from svn. Now
> everything is working again. The error "cannot find symbol..." is solved.
> But the original error " Invalid package name: '*'" still there. Let's see
> if I can also fix it.
>
>
>
> --
> View this message in context: http://apache-felix.18485.x6.nabble.com/Invalid-package-name-tp5004065p5004076.html
> Sent from the Apache Felix - Users mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
> For additional commands, e-mail: users-help@felix.apache.org
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
For additional commands, e-mail: users-help@felix.apache.org


Re: Invalid package name: '*' ????

Posted by Roland <wg...@ids.de>.
I deleted the entire workspace and checked out everything from svn. Now
everything is working again. The error "cannot find symbol..." is solved.
But the original error " Invalid package name: '*'" still there. Let's see
if I can also fix it.



--
View this message in context: http://apache-felix.18485.x6.nabble.com/Invalid-package-name-tp5004065p5004076.html
Sent from the Apache Felix - Users mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
For additional commands, e-mail: users-help@felix.apache.org


Re: Invalid package name: '*' ????

Posted by Roland <wg...@ids.de>.
I deleted the project but now all the other projects can no longer be built
because of compiler errors I mentiond above: cannot find symbol...
Obviously my class-paths were destroyed by the whole action. This must be a
bug!
I remember that I had accidentally moved a class out from a package. I
immediately reversed that. It may be that Eclipse has added this class to
the default package.



--
View this message in context: http://apache-felix.18485.x6.nabble.com/Invalid-package-name-tp5004065p5004074.html
Sent from the Apache Felix - Users mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
For additional commands, e-mail: users-help@felix.apache.org


Re: Invalid package name: '*' ????

Posted by Karl Pauls <ka...@gmail.com>.
You must have a Class in the default package (i.e., not inside a package at
all). This doesn't work because OSGi doesn't allow you to have something
inside the default package (i.e., without a package, i.e., in the '.').

Now, the question is why you have something in there. Double check you are
not referencing a class that has no package but if you don't, you might
want to make sure its not just some compile error that messes things up or
that it is not a transitive reference.

regards,

Karl


On Fri, Jun 21, 2013 at 3:28 PM, Roland <wg...@ids.de> wrote:

> hello,
> I'm at it again .... and I hope I'm right here.
>
> I hang on a problem for a few hours. I do not know what I'm doing wrong.
> Below is the error message and my POM.
>
> ...
> [INFO] [bundle:bundle {execution: default-bundle}]
> in default pack?
> [WARNING] Bundle mygroupId:myartifactId:bundle:1.0.0.0 : Invalid package
> name: '*'
> [ERROR] Bundle
> de.ids.acos.rtu.osgi.bundles:acos-rtu-constants:bundle:1.0.0.0 : The
> default
> package '.' is not permitted by the Import-Package syntax.
>  This can be caused by compile errors in Eclipse because Eclipse creates
> valid class files regardless of compile errors.
> The following package(s) import from the default package null
> [ERROR] Error(s) found in bundle configuration
>
>
>
> <project xmlns="http://maven.apache.org/POM/4.0.0"
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
> http://maven.apache.org/xsd/maven-4.0.0.xsd">
>   <modelVersion>4.0.0</modelVersion>
>   <parent>
>     <groupId>mygroupID</groupId>
>     <artifactId>myparent</artifactId>
>     <version>1.0.0.0</version>
>   </parent>
>   <groupId>mygroupID</groupId>
>   <artifactId>myproject</artifactId>
>   <name>myproject</name>
>   <packaging>bundle</packaging>
>   <build>
>     <plugins>
>       <plugin>
>         <groupId>org.apache.felix</groupId>
>         <artifactId>maven-bundle-plugin</artifactId>
>         <extensions>true</extensions>
>         <configuration>
>           <archive>
>           </archive>
>           <instructions>
>
>
> <Bundle-SymbolicName>${project.groupId}.${project.artifactId}</Bundle-SymbolicName>
>             <Bundle-Description>${project.description}</Bundle-Description>
>             <Bundle-Version>${project.version}</Bundle-Version>
>             <Bundle-Activator></Bundle-Activator>
>             <EXPORT-PACKAGE>
>               mypackage;version=1.0.0.0
>             </EXPORT-PACKAGE>
>             <IMPORT-PACKAGE>
>               *
>             </IMPORT-PACKAGE>
>           </instructions>
>         </configuration>
>       </plugin>
>     </plugins>
>   </build>
> </project>
>
>
>
> I have already tried "mvn clean", but that does not help. Recently I get
> frequently strange error messages from maven. From time to time I can not
> build my projects and I get the following error message: ... Source not
> found. This indicates that the compiler can not find the source. After a
> further try everything works again! There is probably a bug somewhere in
> the
> Maven-Universe. Maybe I should ask this in a Maven forum.
>
> Any suggestions?
>
> Thanks in advance!
> Roland
>
>
>
> --
> View this message in context:
> http://apache-felix.18485.x6.nabble.com/Invalid-package-name-tp5004065.html
> Sent from the Apache Felix - Users mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
> For additional commands, e-mail: users-help@felix.apache.org
>
>


-- 
Karl Pauls
karlpauls@gmail.com
http://twitter.com/karlpauls
http://www.linkedin.com/in/karlpauls
https://profiles.google.com/karlpauls