You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@felix.apache.org by Maxim Suponya <ma...@qbe.com> on 2008/10/08 09:44:33 UTC

building a felix embedding web app with maven

Hi,
I have a web app that is built using maven 2.0.8. The application's 
pom.xml contains following dependency:

      <dependency>
        <groupId>org.apache.felix</groupId>
        <artifactId>org.apache.felix.framework</artifactId>
        <version>1.2.1</version>
      </dependency>

But felix, in turn, depends on a project defined in 
javax.servlet-1.0.0.pom which subsequently makes a jar file called 
javax.servlet-1.0.0.jar ending up in WEB-INF/lib together with 
org.apache.felix.framework-1.2.1.jar.
When the web application starts and the servlet that launches felix gets 
initialized, a ClassCastException is thrown saying that this servlet is 
not a Servlet.. this is due to presence of javax.servlet-1.0.0.jar with 
Servlet.class in WEB-INF/lib which comes in conflict with the one that's 
provided by Tomcat.

Adding <scope>provided</scope> in my app's pom.xml doesn't make any 
difference.

      <dependency>
        <groupId>org.apache.felix</groupId>
        <artifactId>javax.servlet</artifactId>
        <version>1.0.0</version>
        <scope>provided</scope>
      </dependency>

Is there any way around this?

Thanks a lot,

Maxim



- ----------------
IMPORTANT NOTICE : The information in this email is confidential and may also be privileged. If you are not the intended recipient, any use or dissemination of the information and any disclosure or copying of this email is unauthorised and strictly prohibited. If you have received this email in error, please promptly inform us by reply email or telephone. You should also delete this email and destroy any hard copies produced.

AW: Using log4J

Posted by Kevin Lohmann <ke...@d-velop.de>.
Hi Barend,

> W.B. Garvelink wrote
> While I never ran into the problem you describe, it sounds as if the
> jboss lib is not reaching the same LoggerRepository singleton as the
> others. You may have already checked this, but make sure that the
> jboss lib uses the same log4j bundle as the other libs?
that was the crux. A big thanks, that solve the problem!

Cheers,
 Kevin

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


Re: Using log4J

Posted by "W.B. Garvelink" <ba...@gmail.com>.
The application I'm working on uses log4j directly. Like you, we had
to configure programmatically. We wired ManagedService and
PropertyConfigurator together.

While I never ran into the problem you describe, it sounds as if the
jboss lib is not reaching the same LoggerRepository singleton as the
others. You may have already checked this, but make sure that the
jboss lib uses the same log4j bundle as the other libs? Also, use
-Dlog4j.debug=true if you haven't yet, that might give some clues as
well.

HTH,
Barend


On 10/9/08, Kevin Lohmann <ke...@d-velop.de> wrote:
>
> Hi *,
>
> in our application we have our own logging-system: some statements get
> point out at the console, other statements will be written into a
> database.
>
> A few bundles (3rd party: jpa, jboss, etc) use log4j. To cover those
> log4j-statements we have an Appender, which maps log4j-LoggingEvents to
> our logging-system. Thats the theory.
>
> The reality asks: How can you do this?
> The first approach was an extension-bundle that contained the
> log4j.properties-file. While using log4j-appenders everything worked
> fine, because those bundles, that use log4j, have import-declarations on
> log4j. When we tried to use our own appenders, those bundles would need
> an import on our appender-package (the extension-bundle must not have
> import-declaration). But to hack these declarations into the bundles is
> not a good idea.
>
> So we tried fragment-bundles. But a fragment can just only have one
> host...also, not good.
>
> The third (and for now the last) idea was to create a bundle, that
> configures log4j programmatically (no log4j.properties file). And heyja,
> there you go. But for logger "org.jboss.messaging.util.Version" was no
> appender found. Thats curious, because we have configured a RootLogger,
> that should log everything, shouldn't it? At least jpa and mortybay
> don't complain about having no appender. When we set a specific logger
> to "org.jboss.messaging.util.Version" nothing changes.
>
> So did anyone saw those problems to and solved it? Has anyone another
> approach that will be solving this problem?
>
> Thanks for any reply,
>  Kevin
>
> ---------------------------------------------------------------------
> 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


Using log4J

Posted by Kevin Lohmann <ke...@d-velop.de>.
Hi *,

in our application we have our own logging-system: some statements get
point out at the console, other statements will be written into a
database. 

A few bundles (3rd party: jpa, jboss, etc) use log4j. To cover those
log4j-statements we have an Appender, which maps log4j-LoggingEvents to
our logging-system. Thats the theory.

The reality asks: How can you do this?
The first approach was an extension-bundle that contained the
log4j.properties-file. While using log4j-appenders everything worked
fine, because those bundles, that use log4j, have import-declarations on
log4j. When we tried to use our own appenders, those bundles would need
an import on our appender-package (the extension-bundle must not have
import-declaration). But to hack these declarations into the bundles is
not a good idea.

So we tried fragment-bundles. But a fragment can just only have one
host...also, not good.

The third (and for now the last) idea was to create a bundle, that
configures log4j programmatically (no log4j.properties file). And heyja,
there you go. But for logger "org.jboss.messaging.util.Version" was no
appender found. Thats curious, because we have configured a RootLogger,
that should log everything, shouldn't it? At least jpa and mortybay
don't complain about having no appender. When we set a specific logger
to "org.jboss.messaging.util.Version" nothing changes.

So did anyone saw those problems to and solved it? Has anyone another
approach that will be solving this problem?

Thanks for any reply,
 Kevin

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


Re: building a felix embedding web app with maven

Posted by Stuart McCulloch <mc...@gmail.com>.
2008/10/9 Maxim Suponya <ma...@qbe.com>

> Ah, sure!
>
> It works perfectly, thanks a lot, Stuart!
>

no problem, glad to hear it's now working ok


> Maxim.
>
> "Stuart McCulloch" <mc...@gmail.com>
> 08/10/2008 08:15 PM
> Please respond to
> users@felix.apache.org
>
>
> To
> users@felix.apache.org
> cc
>
> Subject
> Re: building a felix embedding web app with maven
>
>
>
>
>
>
> 2008/10/8 Maxim Suponya <ma...@qbe.com>
>
> > Hi,
> > I have a web app that is built using maven 2.0.8. The application's
> > pom.xml contains following dependency:
> >
> >      <dependency>
> >        <groupId>org.apache.felix</groupId>
> >        <artifactId>org.apache.felix.framework</artifactId>
> >        <version>1.2.1</version>
> >      </dependency>
> >
> > But felix, in turn, depends on a project defined in
> > javax.servlet-1.0.0.pom which subsequently makes a jar file called
> > javax.servlet-1.0.0.jar ending up in WEB-INF/lib together with
> > org.apache.felix.framework-1.2.1.jar.
>
>
> have you tried using:
>
>     <dependency>
>       <groupId>org.apache.felix</groupId>
>        <artifactId>org.apache.felix.framework</artifactId>
>       <version>1.2.1</version>
>       <exclusions>
>         <exclusion>
>           <groupId>org.apache.felix</groupId>
>           <artifactId>javax.servlet</artifactId>
>         </exclusion>
>       </exclusions>
>     </dependency>
>
> to tell Maven to exclude the transitive servlet dependency?
>
>
> > When the web application starts and the servlet that launches felix gets
> > initialized, a ClassCastException is thrown saying that this servlet is
> > not a Servlet.. this is due to presence of javax.servlet-1.0.0.jar with
> > Servlet.class in WEB-INF/lib which comes in conflict with the one that's
> > provided by Tomcat.
> >
> > Adding <scope>provided</scope> in my app's pom.xml doesn't make any
> > difference.
> >
> >      <dependency>
> >        <groupId>org.apache.felix</groupId>
> >        <artifactId>javax.servlet</artifactId>
> >        <version>1.0.0</version>
> >        <scope>provided</scope>
> >      </dependency>
> >
> > Is there any way around this?
> >
> > Thanks a lot,
> >
> > Maxim
> >
> > - ----------------
> > IMPORTANT NOTICE : The information in this email is confidential and may
> > also be privileged. If you are not the intended recipient, any use or
> > dissemination of the information and any disclosure or copying of this
> email
> > is unauthorised and strictly prohibited. If you have received this email
> in
> > error, please promptly inform us by reply email or telephone. You should
> > also delete this email and destroy any hard copies produced.
>
>
> --
> Cheers, Stuart
>
>
>
> - ----------------
> IMPORTANT NOTICE : The information in this email is confidential and may
> also be privileged. If you are not the intended recipient, any use or
> dissemination of the information and any disclosure or copying of this email
> is unauthorised and strictly prohibited. If you have received this email in
> error, please promptly inform us by reply email or telephone. You should
> also delete this email and destroy any hard copies produced.
>

-- 
Cheers, Stuart

Re: building a felix embedding web app with maven

Posted by Maxim Suponya <ma...@qbe.com>.
Ah, sure!

It works perfectly, thanks a lot, Stuart!

Maxim.




"Stuart McCulloch" <mc...@gmail.com> 
08/10/2008 08:15 PM
Please respond to
users@felix.apache.org


To
users@felix.apache.org
cc

Subject
Re: building a felix embedding web app with maven






2008/10/8 Maxim Suponya <ma...@qbe.com>

> Hi,
> I have a web app that is built using maven 2.0.8. The application's
> pom.xml contains following dependency:
>
>      <dependency>
>        <groupId>org.apache.felix</groupId>
>        <artifactId>org.apache.felix.framework</artifactId>
>        <version>1.2.1</version>
>      </dependency>
>
> But felix, in turn, depends on a project defined in
> javax.servlet-1.0.0.pom which subsequently makes a jar file called
> javax.servlet-1.0.0.jar ending up in WEB-INF/lib together with
> org.apache.felix.framework-1.2.1.jar.


have you tried using:

     <dependency>
       <groupId>org.apache.felix</groupId>
        <artifactId>org.apache.felix.framework</artifactId>
       <version>1.2.1</version>
       <exclusions>
         <exclusion>
           <groupId>org.apache.felix</groupId>
           <artifactId>javax.servlet</artifactId>
         </exclusion>
       </exclusions>
     </dependency>

to tell Maven to exclude the transitive servlet dependency?


> When the web application starts and the servlet that launches felix gets
> initialized, a ClassCastException is thrown saying that this servlet is
> not a Servlet.. this is due to presence of javax.servlet-1.0.0.jar with
> Servlet.class in WEB-INF/lib which comes in conflict with the one that's
> provided by Tomcat.
>
> Adding <scope>provided</scope> in my app's pom.xml doesn't make any
> difference.
>
>      <dependency>
>        <groupId>org.apache.felix</groupId>
>        <artifactId>javax.servlet</artifactId>
>        <version>1.0.0</version>
>        <scope>provided</scope>
>      </dependency>
>
> Is there any way around this?
>
> Thanks a lot,
>
> Maxim
>
> - ----------------
> IMPORTANT NOTICE : The information in this email is confidential and may
> also be privileged. If you are not the intended recipient, any use or
> dissemination of the information and any disclosure or copying of this 
email
> is unauthorised and strictly prohibited. If you have received this email 
in
> error, please promptly inform us by reply email or telephone. You should
> also delete this email and destroy any hard copies produced.


-- 
Cheers, Stuart



- ----------------
IMPORTANT NOTICE : The information in this email is confidential and may also be privileged. If you are not the intended recipient, any use or dissemination of the information and any disclosure or copying of this email is unauthorised and strictly prohibited. If you have received this email in error, please promptly inform us by reply email or telephone. You should also delete this email and destroy any hard copies produced.

Re: building a felix embedding web app with maven

Posted by Stuart McCulloch <mc...@gmail.com>.
2008/10/8 Maxim Suponya <ma...@qbe.com>

> Hi,
> I have a web app that is built using maven 2.0.8. The application's
> pom.xml contains following dependency:
>
>      <dependency>
>        <groupId>org.apache.felix</groupId>
>        <artifactId>org.apache.felix.framework</artifactId>
>        <version>1.2.1</version>
>      </dependency>
>
> But felix, in turn, depends on a project defined in
> javax.servlet-1.0.0.pom which subsequently makes a jar file called
> javax.servlet-1.0.0.jar ending up in WEB-INF/lib together with
> org.apache.felix.framework-1.2.1.jar.


have you tried using:

     <dependency>
       <groupId>org.apache.felix</groupId>
        <artifactId>org.apache.felix.framework</artifactId>
       <version>1.2.1</version>
       <exclusions>
         <exclusion>
           <groupId>org.apache.felix</groupId>
           <artifactId>javax.servlet</artifactId>
         </exclusion>
       </exclusions>
     </dependency>

to tell Maven to exclude the transitive servlet dependency?


> When the web application starts and the servlet that launches felix gets
> initialized, a ClassCastException is thrown saying that this servlet is
> not a Servlet.. this is due to presence of javax.servlet-1.0.0.jar with
> Servlet.class in WEB-INF/lib which comes in conflict with the one that's
> provided by Tomcat.
>
> Adding <scope>provided</scope> in my app's pom.xml doesn't make any
> difference.
>
>      <dependency>
>        <groupId>org.apache.felix</groupId>
>        <artifactId>javax.servlet</artifactId>
>        <version>1.0.0</version>
>        <scope>provided</scope>
>      </dependency>
>
> Is there any way around this?
>
> Thanks a lot,
>
> Maxim
>
> - ----------------
> IMPORTANT NOTICE : The information in this email is confidential and may
> also be privileged. If you are not the intended recipient, any use or
> dissemination of the information and any disclosure or copying of this email
> is unauthorised and strictly prohibited. If you have received this email in
> error, please promptly inform us by reply email or telephone. You should
> also delete this email and destroy any hard copies produced.


-- 
Cheers, Stuart