You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@geronimo.apache.org by Ben Adam <ad...@gmail.com> on 2011/02/28 10:55:10 UTC

ClassNotFoundException: org.apache.commons.io.output.DeferredFileOutputStream

Hi

I am getting the following runtime error in geronimo 2.2.1 while trying
upload a file using a servlet to activemq.  Any help appriciated.

Regards,
Adam

java.lang.NoClassDefFoundError:
org/apache/commons/io/output/DeferredFileOutputStream
 org.apache.commons.fileupload.disk.DiskFileItemFactory.createItem(DiskFileItemFactory.java:179)
 org.apache.commons.fileupload.FileUploadBase.createItem(FileUploadBase.java:500)
 org.apache.commons.fileupload.FileUploadBase.parseRequest(FileUploadBase.java:367)
 org.apache.commons.fileupload.servlet.ServletFileUpload.parseRequest(ServletFileUpload.java:116)
 com.hcl.stpa.simulator.FileUploadServlet.doPost(FileUploadServlet.java:74)
 javax.servlet.http.HttpServlet.service(HttpServlet.java:713)
 javax.servlet.http.HttpServlet.service(HttpServlet.java:806)


root cause

java.lang.ClassNotFoundException:
org.apache.commons.io.output.DeferredFileOutputStream in classloader
org.apache.geronimo.configs/axis2/2.2.1/car
 org.apache.geronimo.kernel.config.MultiParentClassLoader.loadOptimizedClass(MultiParentClassLoader.java:407)
 org.apache.geronimo.kernel.config.MultiParentClassLoader.loadClass(MultiParentClassLoader.java:257)
 java.lang.ClassLoader.loadClass(ClassLoader.java:248)
 org.apache.commons.fileupload.disk.DiskFileItemFactory.createItem(DiskFileItemFactory.java:179)
 org.apache.commons.fileupload.FileUploadBase.createItem(FileUploadBase.java:500)
 org.apache.commons.fileupload.FileUploadBase.parseRequest(FileUploadBase.java:367)
 org.apache.commons.fileupload.servlet.ServletFileUpload.parseRequest(ServletFileUpload.java:116)
 com.hcl.stpa.simulator.FileUploadServlet.doPost(FileUploadServlet.java:74)
 javax.servlet.http.HttpServlet.service(HttpServlet.java:713)
 javax.servlet.http.HttpServlet.service(HttpServlet.java:806)

Re: AW: AW: I need to pick your brains....

Posted by Neil Franken <nc...@gmail.com>.
Hi Mike

I tried the approach you mentioned about the lib/endorsed folder and I
just cant get it to work properly. Seems like OpenEJB does not use the
right JTA transaction manager. I have cant seem to get this configured.
Unfortunately for I have now run out of time to get this up and running
for proof of concept and the powers that be have decided to go back to
GF and EclipseLink for the moment. 

I suspect when Geronimo 3 comes out with support for OpenJPA2(I hope) I
will find it a little easier to get the things done I need. To give you
a idea we are looking at a application where we have 250+ logins per
second..... so performance and stability have to be there.

I will continue to experiment with Geronimo and EclipseLink in my spare
time and see if I can get it working. Right now I need to get this
project out.

Thanks for the input.


Regards
Neil

On Tue, 2011-03-01 at 12:54 +0100, Michael Simons wrote:
> Hi Neil,
> 
> we put the eclipselink.jar in the Java lib/endorsed folder, as just deploying it does not work.
> Another possibility - that we do not use - is to put the eclipselink.jar in every WAR/EAR archive that you deploy.
> Hope this helps.
> 
> Kind regards, Michael
> 
> -----Ursprüngliche Nachricht-----
> Von: Neil Franken [mailto:ncjfranken@gmail.com] 
> Gesendet: Dienstag, 1. März 2011 10:31
> An: user@geronimo.apache.org
> Betreff: Re: AW: I need to pick your brains....
> 
> Hi Micheal.
> 
> Well maybe you can help me then. The only stumbling block I have with
> EclipseLink is the fact that whenever I update/delete data and I do a
> em.flush it complains about it not being in a transaction. Now my
> persistence.xml file is setup  as follows:
> 
> <?xml version="1.0" encoding="UTF-8"?>
> <persistence version="1.0"
> xmlns="http://java.sun.com/xml/ns/persistence"
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> xsi:schemaLocation="http://java.sun.com/xml/ns/persistence
> http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd">
> 	<persistence-unit name="cnectdDAL" transaction-type="JTA">
> 
> <provider>org.eclipse.persistence.jpa.PersistenceProvider</provider>
> 		<jta-data-source>jdbc/cnectd</jta-data-source>
> 		<class>com.cnectd.dal.MimeType</class> 
> 		<class>com.cnectd.dal.MimeTypePK</class>
> 	<exclude-unlisted-classes>false</exclude-unlisted-classes>
> 		
> 	</persistence-unit>
> </persistence>
> 
> This means I am running Container Managed Transactions. So why would it
> complain about it not being in a transaction? I have googled this error
> and cannot find anything to help me.
> 
> I did deploy the eclipselink.jar file to geronimo via the admin console.
> 
> Any ideas?
> 
> Regards
> Neil
> 
> 
> On Tue, 2011-03-01 at 09:54 +0100, Michael Simons wrote:
> > Hi Neil,
> > 
> > We faced a similar situation like you a little time ago. We used a JDO-Implementation but there's no AppSrv supporting it. So we had to port to JPA. After some evaluation (and some severe problems with OpenJPA) we decided to use Geronimo with EclipseLink. So far it works quite well. So IMHO you don't need to port code from EL to OpenJPA but just use EL within Geronimo. 
> > You say, that you need "to reduce the load on the MySQL servers". We also used a lot of time to reduce the load on the database server as well as on the AppSrv. IMHO you should still take plain old SQL/JDBC into account, as sometimes this might be the best choice to reduce load and improve performance.
> > 
> > Kind Regards, Michael
> > 
> > 
> > -----Ursprüngliche Nachricht-----
> > Von: David Jencks [mailto:david_jencks@yahoo.com] 
> > Gesendet: Dienstag, 1. März 2011 09:32
> > An: user@geronimo.apache.org
> > Betreff: Re: I need to pick your brains....
> > 
> > Hi Neil,
> > 
> > As far as I know openJPA and EclipseLink are both really good JPA implementations.  I wasn't aware that either one provided data caching without add on products, but I'm not an expert in either product.  In geronimo you are probably more likely to be able to find help using openjpa because the geronimo developers know it better and openjpa is another apache project.  Other than that guess I don't have much advice on a choice.
> > 
> > thanks
> > david jencks
> > 
> > On Feb 28, 2011, at 10:53 PM, Neil Franken wrote:
> > 
> > > Hi All
> > > 
> > > I need some help to make up my mind about what technologies to use in my
> > > project. Now there is going to be some rather newbie questions in here
> > > but I need some input from people that work with the technology.
> > > 
> > > Here is my problem. We are doing a project that requires us to use JPA.
> > > Now I need the JPA to be able to cache data to reduce the load on the
> > > MySQL servers. So over the last couple of days I have been doing a lot
> > > of porting of code from a Glassfish v3 and eclipselink project to
> > > Geronimo. 
> > > 
> > > However going through the documentation I had a look a OpenJPA as well.
> > > It seems that openJPA is also a very good product.... so my main
> > > question is.
> > > 
> > > Which one is better to use in Geronimo.I know OpenJPA is allready
> > > available in Geronimo and from what I can find on the internet it seems
> > > to be a viable alternative to EclipseLink.
> > > 
> > > So can anyone here shed some light on the choice I have to make? Seems
> > > like Java programmers in South Africa just use JDBC so finding someone
> > > to have a decent discussion about JPA/ORM Frameworks leads nowhere fast.
> > > 
> > > Regards
> > > Neil
> > > 
> > 
> 
> 



AW: AW: I need to pick your brains....

Posted by Michael Simons <Mi...@Optitool.DE>.
Hi Neil,

we put the eclipselink.jar in the Java lib/endorsed folder, as just deploying it does not work.
Another possibility - that we do not use - is to put the eclipselink.jar in every WAR/EAR archive that you deploy.
Hope this helps.

Kind regards, Michael

-----Ursprüngliche Nachricht-----
Von: Neil Franken [mailto:ncjfranken@gmail.com] 
Gesendet: Dienstag, 1. März 2011 10:31
An: user@geronimo.apache.org
Betreff: Re: AW: I need to pick your brains....

Hi Micheal.

Well maybe you can help me then. The only stumbling block I have with
EclipseLink is the fact that whenever I update/delete data and I do a
em.flush it complains about it not being in a transaction. Now my
persistence.xml file is setup  as follows:

<?xml version="1.0" encoding="UTF-8"?>
<persistence version="1.0"
xmlns="http://java.sun.com/xml/ns/persistence"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/persistence
http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd">
	<persistence-unit name="cnectdDAL" transaction-type="JTA">

<provider>org.eclipse.persistence.jpa.PersistenceProvider</provider>
		<jta-data-source>jdbc/cnectd</jta-data-source>
		<class>com.cnectd.dal.MimeType</class> 
		<class>com.cnectd.dal.MimeTypePK</class>
	<exclude-unlisted-classes>false</exclude-unlisted-classes>
		
	</persistence-unit>
</persistence>

This means I am running Container Managed Transactions. So why would it
complain about it not being in a transaction? I have googled this error
and cannot find anything to help me.

I did deploy the eclipselink.jar file to geronimo via the admin console.

Any ideas?

Regards
Neil


On Tue, 2011-03-01 at 09:54 +0100, Michael Simons wrote:
> Hi Neil,
> 
> We faced a similar situation like you a little time ago. We used a JDO-Implementation but there's no AppSrv supporting it. So we had to port to JPA. After some evaluation (and some severe problems with OpenJPA) we decided to use Geronimo with EclipseLink. So far it works quite well. So IMHO you don't need to port code from EL to OpenJPA but just use EL within Geronimo. 
> You say, that you need "to reduce the load on the MySQL servers". We also used a lot of time to reduce the load on the database server as well as on the AppSrv. IMHO you should still take plain old SQL/JDBC into account, as sometimes this might be the best choice to reduce load and improve performance.
> 
> Kind Regards, Michael
> 
> 
> -----Ursprüngliche Nachricht-----
> Von: David Jencks [mailto:david_jencks@yahoo.com] 
> Gesendet: Dienstag, 1. März 2011 09:32
> An: user@geronimo.apache.org
> Betreff: Re: I need to pick your brains....
> 
> Hi Neil,
> 
> As far as I know openJPA and EclipseLink are both really good JPA implementations.  I wasn't aware that either one provided data caching without add on products, but I'm not an expert in either product.  In geronimo you are probably more likely to be able to find help using openjpa because the geronimo developers know it better and openjpa is another apache project.  Other than that guess I don't have much advice on a choice.
> 
> thanks
> david jencks
> 
> On Feb 28, 2011, at 10:53 PM, Neil Franken wrote:
> 
> > Hi All
> > 
> > I need some help to make up my mind about what technologies to use in my
> > project. Now there is going to be some rather newbie questions in here
> > but I need some input from people that work with the technology.
> > 
> > Here is my problem. We are doing a project that requires us to use JPA.
> > Now I need the JPA to be able to cache data to reduce the load on the
> > MySQL servers. So over the last couple of days I have been doing a lot
> > of porting of code from a Glassfish v3 and eclipselink project to
> > Geronimo. 
> > 
> > However going through the documentation I had a look a OpenJPA as well.
> > It seems that openJPA is also a very good product.... so my main
> > question is.
> > 
> > Which one is better to use in Geronimo.I know OpenJPA is allready
> > available in Geronimo and from what I can find on the internet it seems
> > to be a viable alternative to EclipseLink.
> > 
> > So can anyone here shed some light on the choice I have to make? Seems
> > like Java programmers in South Africa just use JDBC so finding someone
> > to have a decent discussion about JPA/ORM Frameworks leads nowhere fast.
> > 
> > Regards
> > Neil
> > 
> 



Re: AW: I need to pick your brains....

Posted by Neil Franken <nc...@gmail.com>.
Hi Micheal.

Well maybe you can help me then. The only stumbling block I have with
EclipseLink is the fact that whenever I update/delete data and I do a
em.flush it complains about it not being in a transaction. Now my
persistence.xml file is setup  as follows:

<?xml version="1.0" encoding="UTF-8"?>
<persistence version="1.0"
xmlns="http://java.sun.com/xml/ns/persistence"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/persistence
http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd">
	<persistence-unit name="cnectdDAL" transaction-type="JTA">

<provider>org.eclipse.persistence.jpa.PersistenceProvider</provider>
		<jta-data-source>jdbc/cnectd</jta-data-source>
		<class>com.cnectd.dal.MimeType</class> 
		<class>com.cnectd.dal.MimeTypePK</class>
	<exclude-unlisted-classes>false</exclude-unlisted-classes>
		
	</persistence-unit>
</persistence>

This means I am running Container Managed Transactions. So why would it
complain about it not being in a transaction? I have googled this error
and cannot find anything to help me.

I did deploy the eclipselink.jar file to geronimo via the admin console.

Any ideas?

Regards
Neil


On Tue, 2011-03-01 at 09:54 +0100, Michael Simons wrote:
> Hi Neil,
> 
> We faced a similar situation like you a little time ago. We used a JDO-Implementation but there's no AppSrv supporting it. So we had to port to JPA. After some evaluation (and some severe problems with OpenJPA) we decided to use Geronimo with EclipseLink. So far it works quite well. So IMHO you don't need to port code from EL to OpenJPA but just use EL within Geronimo. 
> You say, that you need "to reduce the load on the MySQL servers". We also used a lot of time to reduce the load on the database server as well as on the AppSrv. IMHO you should still take plain old SQL/JDBC into account, as sometimes this might be the best choice to reduce load and improve performance.
> 
> Kind Regards, Michael
> 
> 
> -----Ursprüngliche Nachricht-----
> Von: David Jencks [mailto:david_jencks@yahoo.com] 
> Gesendet: Dienstag, 1. März 2011 09:32
> An: user@geronimo.apache.org
> Betreff: Re: I need to pick your brains....
> 
> Hi Neil,
> 
> As far as I know openJPA and EclipseLink are both really good JPA implementations.  I wasn't aware that either one provided data caching without add on products, but I'm not an expert in either product.  In geronimo you are probably more likely to be able to find help using openjpa because the geronimo developers know it better and openjpa is another apache project.  Other than that guess I don't have much advice on a choice.
> 
> thanks
> david jencks
> 
> On Feb 28, 2011, at 10:53 PM, Neil Franken wrote:
> 
> > Hi All
> > 
> > I need some help to make up my mind about what technologies to use in my
> > project. Now there is going to be some rather newbie questions in here
> > but I need some input from people that work with the technology.
> > 
> > Here is my problem. We are doing a project that requires us to use JPA.
> > Now I need the JPA to be able to cache data to reduce the load on the
> > MySQL servers. So over the last couple of days I have been doing a lot
> > of porting of code from a Glassfish v3 and eclipselink project to
> > Geronimo. 
> > 
> > However going through the documentation I had a look a OpenJPA as well.
> > It seems that openJPA is also a very good product.... so my main
> > question is.
> > 
> > Which one is better to use in Geronimo.I know OpenJPA is allready
> > available in Geronimo and from what I can find on the internet it seems
> > to be a viable alternative to EclipseLink.
> > 
> > So can anyone here shed some light on the choice I have to make? Seems
> > like Java programmers in South Africa just use JDBC so finding someone
> > to have a decent discussion about JPA/ORM Frameworks leads nowhere fast.
> > 
> > Regards
> > Neil
> > 
> 



AW: I need to pick your brains....

Posted by Michael Simons <Mi...@Optitool.DE>.
Hi Neil,

We faced a similar situation like you a little time ago. We used a JDO-Implementation but there's no AppSrv supporting it. So we had to port to JPA. After some evaluation (and some severe problems with OpenJPA) we decided to use Geronimo with EclipseLink. So far it works quite well. So IMHO you don't need to port code from EL to OpenJPA but just use EL within Geronimo. 
You say, that you need "to reduce the load on the MySQL servers". We also used a lot of time to reduce the load on the database server as well as on the AppSrv. IMHO you should still take plain old SQL/JDBC into account, as sometimes this might be the best choice to reduce load and improve performance.

Kind Regards, Michael


-----Ursprüngliche Nachricht-----
Von: David Jencks [mailto:david_jencks@yahoo.com] 
Gesendet: Dienstag, 1. März 2011 09:32
An: user@geronimo.apache.org
Betreff: Re: I need to pick your brains....

Hi Neil,

As far as I know openJPA and EclipseLink are both really good JPA implementations.  I wasn't aware that either one provided data caching without add on products, but I'm not an expert in either product.  In geronimo you are probably more likely to be able to find help using openjpa because the geronimo developers know it better and openjpa is another apache project.  Other than that guess I don't have much advice on a choice.

thanks
david jencks

On Feb 28, 2011, at 10:53 PM, Neil Franken wrote:

> Hi All
> 
> I need some help to make up my mind about what technologies to use in my
> project. Now there is going to be some rather newbie questions in here
> but I need some input from people that work with the technology.
> 
> Here is my problem. We are doing a project that requires us to use JPA.
> Now I need the JPA to be able to cache data to reduce the load on the
> MySQL servers. So over the last couple of days I have been doing a lot
> of porting of code from a Glassfish v3 and eclipselink project to
> Geronimo. 
> 
> However going through the documentation I had a look a OpenJPA as well.
> It seems that openJPA is also a very good product.... so my main
> question is.
> 
> Which one is better to use in Geronimo.I know OpenJPA is allready
> available in Geronimo and from what I can find on the internet it seems
> to be a viable alternative to EclipseLink.
> 
> So can anyone here shed some light on the choice I have to make? Seems
> like Java programmers in South Africa just use JDBC so finding someone
> to have a decent discussion about JPA/ORM Frameworks leads nowhere fast.
> 
> Regards
> Neil
> 


Re: I need to pick your brains....

Posted by Neil Franken <nc...@gmail.com>.
Hi David

Thanks for the reply. I have been having some limited success with
EclipseLink. I dump all queries from mysql into a log file and watch it
with tail -f /var/log/mysql/querylog. Simple technique and I can see all
queries being executed on the server when I run my project using
Eclipselink when I do a entitymanager.find(SomeClass.Class, Value) call
the JPA provider does not execute any SQL on the server. 

If I run it with openJPA I can see SELECT col1,col2 FROM SomeClassTable
WHERE PrimaryKey =Value being executed. Now I am running geronimo 2.2.1
and I think the built in caching is probably a JPA2 specification. I
might be wrong here. However as we are dealing with a system where data
are mostly read only caching would be a great performance booster. I
tried installing the OpenJPA2 plugins for Geronimo but they have some
issue. So I am kind of stuck.

Will let you know what I find out as I progress.

Regards
Neil



On Tue, 2011-03-01 at 00:32 -0800, David Jencks wrote:
> Hi Neil,
> 
> As far as I know openJPA and EclipseLink are both really good JPA implementations.  I wasn't aware that either one provided data caching without add on products, but I'm not an expert in either product.  In geronimo you are probably more likely to be able to find help using openjpa because the geronimo developers know it better and openjpa is another apache project.  Other than that guess I don't have much advice on a choice.
> 
> thanks
> david jencks
> 
> On Feb 28, 2011, at 10:53 PM, Neil Franken wrote:
> 
> > Hi All
> > 
> > I need some help to make up my mind about what technologies to use in my
> > project. Now there is going to be some rather newbie questions in here
> > but I need some input from people that work with the technology.
> > 
> > Here is my problem. We are doing a project that requires us to use JPA.
> > Now I need the JPA to be able to cache data to reduce the load on the
> > MySQL servers. So over the last couple of days I have been doing a lot
> > of porting of code from a Glassfish v3 and eclipselink project to
> > Geronimo. 
> > 
> > However going through the documentation I had a look a OpenJPA as well.
> > It seems that openJPA is also a very good product.... so my main
> > question is.
> > 
> > Which one is better to use in Geronimo.I know OpenJPA is allready
> > available in Geronimo and from what I can find on the internet it seems
> > to be a viable alternative to EclipseLink.
> > 
> > So can anyone here shed some light on the choice I have to make? Seems
> > like Java programmers in South Africa just use JDBC so finding someone
> > to have a decent discussion about JPA/ORM Frameworks leads nowhere fast.
> > 
> > Regards
> > Neil
> > 
> 



Re: I need to pick your brains....

Posted by David Jencks <da...@yahoo.com>.
Hi Neil,

As far as I know openJPA and EclipseLink are both really good JPA implementations.  I wasn't aware that either one provided data caching without add on products, but I'm not an expert in either product.  In geronimo you are probably more likely to be able to find help using openjpa because the geronimo developers know it better and openjpa is another apache project.  Other than that guess I don't have much advice on a choice.

thanks
david jencks

On Feb 28, 2011, at 10:53 PM, Neil Franken wrote:

> Hi All
> 
> I need some help to make up my mind about what technologies to use in my
> project. Now there is going to be some rather newbie questions in here
> but I need some input from people that work with the technology.
> 
> Here is my problem. We are doing a project that requires us to use JPA.
> Now I need the JPA to be able to cache data to reduce the load on the
> MySQL servers. So over the last couple of days I have been doing a lot
> of porting of code from a Glassfish v3 and eclipselink project to
> Geronimo. 
> 
> However going through the documentation I had a look a OpenJPA as well.
> It seems that openJPA is also a very good product.... so my main
> question is.
> 
> Which one is better to use in Geronimo.I know OpenJPA is allready
> available in Geronimo and from what I can find on the internet it seems
> to be a viable alternative to EclipseLink.
> 
> So can anyone here shed some light on the choice I have to make? Seems
> like Java programmers in South Africa just use JDBC so finding someone
> to have a decent discussion about JPA/ORM Frameworks leads nowhere fast.
> 
> Regards
> Neil
> 


I need to pick your brains....

Posted by Neil Franken <nc...@gmail.com>.
Hi All

I need some help to make up my mind about what technologies to use in my
project. Now there is going to be some rather newbie questions in here
but I need some input from people that work with the technology.

Here is my problem. We are doing a project that requires us to use JPA.
Now I need the JPA to be able to cache data to reduce the load on the
MySQL servers. So over the last couple of days I have been doing a lot
of porting of code from a Glassfish v3 and eclipselink project to
Geronimo. 

However going through the documentation I had a look a OpenJPA as well.
It seems that openJPA is also a very good product.... so my main
question is.

Which one is better to use in Geronimo.I know OpenJPA is allready
available in Geronimo and from what I can find on the internet it seems
to be a viable alternative to EclipseLink.

So can anyone here shed some light on the choice I have to make? Seems
like Java programmers in South Africa just use JDBC so finding someone
to have a decent discussion about JPA/ORM Frameworks leads nowhere fast.

Regards
Neil


Re: ClassNotFoundException: org.apache.commons.io.output.DeferredFileOutputStream

Posted by Kevan Miller <ke...@gmail.com>.
On Feb 28, 2011, at 4:55 AM, Ben Adam wrote:

> Hi
> 
> I am getting the following runtime error in geronimo 2.2.1 while trying upload a file using a servlet to activemq.  Any help appriciated.

Are you including commons-fileupload and commons-io in your application?

--kevan

Re: ClassNotFoundException: org.apache.commons.io.output.DeferredFileOutputStream

Posted by Martin Hejl <ma...@guh-software.de>.
Hi Kevan,

Am 16.03.2011 17:08, schrieb Kevan Miller:
>> Is there a way to get around having to add commons-fileupload and commons-io to  WebContent/WEB-INF/lib/ at all? I tried adding a dependency to the deployment plan
>>
>> <dep:dependencies>
>>   <dep:dependency>
>>     <dep:groupId>commons-fileupload</dep:groupId>
>>     <dep:artifactId>commons-fileupload</dep:artifactId>
>>     <dep:version>1.1.1</dep:version>
>>     <dep:type>jar</dep:type>
>>   </dep:dependency>
>>   <dep:dependency>
>>     <dep:groupId>commons-io</dep:groupId>
>>     <dep:artifactId>commons-io</dep:artifactId>
>>     <dep:version>1.2</dep:version>
>>     <dep:type>jar</dep:type>
>>   </dep:dependency>
>> </dep:dependencies>
>>
>> to use the jars that are already on the server (without any jars in WebContent/WEB-INF/lib/) but that resulted in the same java.lang.ClassNotFoundException
>>
>> Should that approach work, or should the WAR or EAR always be self-contained regarding its dependencies?
>
> You have both hidden-classes and the commons dependencies in your deployment plan? I would expect this to work.
you are right - it works. It never occurred to me to actually try 
setting the dependency and also hiding the packages (the way I read the 
docs, the <hidden-classes> are for solving issues between different 
versions of the same library - and since I specifically wanted to use 
the library provided by geronimo, it didn't occur to me to try).

Thank you very much, this helps me a lot to keep the EAR/WAR small and 
not have to include jars that I know are already installed on the server.

Martin

-- 
G & H Softwareentwicklung GmbH    Tel.: {+49|0} 7451 - 53 706 0
Robert-Bosch-Str. 23              Sitz der Gesellschaft: Horb a.N.
D-72160 Horb a.N.                 Amtsgericht Stuttgart HRB 440599
Geschäftsführer:                  Dirk Gfrörer, Martin Hejl

Re: ClassNotFoundException: org.apache.commons.io.output.DeferredFileOutputStream

Posted by Kevan Miller <ke...@gmail.com>.
On Mar 16, 2011, at 5:04 AM, Martin Hejl wrote:

> Hi Kevan,
> 
> thank you for your feedback - as suggested, I've created
> https://issues.apache.org/jira/browse/GERONIMO-5868

Thanks.

> 
> Adding
> <dep:hidden-classes>
>  <dep:filter>org.apache.commons.io</dep:filter>
>  <dep:filter>org.apache.commons.fileupload</dep:filter>
> </dep:hidden-classes>
> does indeed solve the problem (apparently, inverse-classloading doesn't even need to be set).

Oops. I didn't mean to include the inverse-classloading element.

> 
> Is there a way to get around having to add commons-fileupload and commons-io to  WebContent/WEB-INF/lib/ at all? I tried adding a dependency to the deployment plan
> 
> <dep:dependencies>
>  <dep:dependency>
>    <dep:groupId>commons-fileupload</dep:groupId>
>    <dep:artifactId>commons-fileupload</dep:artifactId>
>    <dep:version>1.1.1</dep:version>
>    <dep:type>jar</dep:type>
>  </dep:dependency>
>  <dep:dependency>
>    <dep:groupId>commons-io</dep:groupId>
>    <dep:artifactId>commons-io</dep:artifactId>
>    <dep:version>1.2</dep:version>
>    <dep:type>jar</dep:type>
>  </dep:dependency>
> </dep:dependencies>
> 
> to use the jars that are already on the server (without any jars in WebContent/WEB-INF/lib/) but that resulted in the same java.lang.ClassNotFoundException
> 
> Should that approach work, or should the WAR or EAR always be self-contained regarding its dependencies?

You have both hidden-classes and the commons dependencies in your deployment plan? I would expect this to work.

--kevan

Re: ClassNotFoundException: org.apache.commons.io.output.DeferredFileOutputStream

Posted by Martin Hejl <ma...@guh-software.de>.
Hi Kevan,

thank you for your feedback - as suggested, I've created
https://issues.apache.org/jira/browse/GERONIMO-5868

Adding
<dep:hidden-classes>
   <dep:filter>org.apache.commons.io</dep:filter>
   <dep:filter>org.apache.commons.fileupload</dep:filter>
</dep:hidden-classes>
does indeed solve the problem (apparently, inverse-classloading doesn't 
even need to be set).

Is there a way to get around having to add commons-fileupload and 
commons-io to  WebContent/WEB-INF/lib/ at all? I tried adding a 
dependency to the deployment plan

<dep:dependencies>
   <dep:dependency>
     <dep:groupId>commons-fileupload</dep:groupId>
     <dep:artifactId>commons-fileupload</dep:artifactId>
     <dep:version>1.1.1</dep:version>
     <dep:type>jar</dep:type>
   </dep:dependency>
   <dep:dependency>
     <dep:groupId>commons-io</dep:groupId>
     <dep:artifactId>commons-io</dep:artifactId>
     <dep:version>1.2</dep:version>
     <dep:type>jar</dep:type>
   </dep:dependency>
</dep:dependencies>

to use the jars that are already on the server (without any jars in 
WebContent/WEB-INF/lib/) but that resulted in the same 
java.lang.ClassNotFoundException

Should that approach work, or should the WAR or EAR always be 
self-contained regarding its dependencies?

Thank you for your help

Best regards,
Martin


Am 15.03.2011 19:44, schrieb Kevan Miller:
>
> On Mar 15, 2011, at 1:15 PM, Martin Hejl wrote:
>
>> Hi Kevan,
>>
>> Probably I'm doing something wrong - but I'm seeing the same effect.
>>
>> Here's what I did:
>> 	• create a simple Dynamic Web Project (jsp file containing the form definition, and a servlet that the form-action points to
>> 	• add commons-fileupload.jar and commons-io.jar to WebContent/WEB-INF/lib/
>> 	• Deploy
>
> Even if the deployment plan does work for you, you could still create a Jira -- fileupload probably shouldn't be in the axis2 classloader...
>
> --kevan
>
>

-- 
G & H Softwareentwicklung GmbH    Tel.: {+49|0} 7451 - 53 706 0
Robert-Bosch-Str. 23              Sitz der Gesellschaft: Horb a.N.
D-72160 Horb a.N.                 Amtsgericht Stuttgart HRB 440599
Geschäftsführer:                  Dirk Gfrörer, Martin Hejl

Re: ClassNotFoundException: org.apache.commons.io.output.DeferredFileOutputStream

Posted by Kevan Miller <ke...@gmail.com>.
On Mar 15, 2011, at 1:15 PM, Martin Hejl wrote:

> Hi Kevan,
> 
> Probably I'm doing something wrong - but I'm seeing the same effect. 
> 
> Here's what I did:
> 	• create a simple Dynamic Web Project (jsp file containing the form definition, and a servlet that the form-action points to
> 	• add commons-fileupload.jar and commons-io.jar to WebContent/WEB-INF/lib/
> 	• Deploy

Even if the deployment plan does work for you, you could still create a Jira -- fileupload probably shouldn't be in the axis2 classloader... 

--kevan


Re: ClassNotFoundException: org.apache.commons.io.output.DeferredFileOutputStream

Posted by Kevan Miller <ke...@gmail.com>.
On Mar 15, 2011, at 1:15 PM, Martin Hejl wrote:

> Hi Kevan,
> 
> Probably I'm doing something wrong - but I'm seeing the same effect. 
> 
> Here's what I did:
> 	• create a simple Dynamic Web Project (jsp file containing the form definition, and a servlet that the form-action points to
> 	• add commons-fileupload.jar and commons-io.jar to WebContent/WEB-INF/lib/
> 	• Deploy

Hi Martin,
I expect the problem is being caused because fileupload/io classes are being loaded from a parent classloader. Try deploying your application with a deployment plan. Something like the following:

<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns="http://geronimo.apache.org/xml/ns/j2ee/web-1.1" 
         xmlns:dep="http://geronimo.apache.org/xml/ns/deployment-1.1" 
         xmlns:naming="http://geronimo.apache.org/xml/ns/naming-1.1">
  <dep:environment>
    <dep:moduleId>
      <dep:groupId>org.mygroup</dep:groupId>
      <dep:artifactId>MyApp</dep:artifactId>
      <dep:version>1.1</dep:version>
      <dep:type>car</dep:type>
    </dep:moduleId>
    <!-- 
         Don't load commons-io or fileupload from parent classloaders
      -->
    <dep:hidden-classes>
      <dep:filter>org.apache.commons.io</dep:filter>
      <dep:filter>org.apache.commons.fileupload</dep:filter>
    </dep:hidden-classes>
    <dep:inverse-classloading/>
  </dep:environment>
  <web:context-root>/MyApp</web:context-root>
</web-app>

Save to a file (e.g. mydeploymentplan.xml) and deploy your application:

./deploy.sh deploy myapp.war mydeploymentplan.xml

If that doesn't fix your problem, create a Jira and attach a test WAR that will demonstrate the problem. 

--kevan

Re: ClassNotFoundException: org.apache.commons.io.output.DeferredFileOutputStream

Posted by Martin Hejl <ma...@guh-software.de>.
Hi Kevan,

Probably I'm doing something wrong - but I'm seeing the same effect.

Here's what I did:

    * create a simple Dynamic Web Project (jsp file containing the form
      definition, and a servlet that the form-action points to
    * add commons-fileupload.jar and commons-io.jar to
      WebContent/WEB-INF/lib/
    * Deploy

When posting the form from the jsp, I get this:

ERROR [[PostServlet]] Servlet.service() for servlet PostServlet threw 
exception
java.lang.ClassNotFoundException: 
org.apache.commons.io.output.DeferredFileOutputStream in classloader 
org.apache.geronimo.configs/axis2/2.2.1/car
     at 
org.apache.geronimo.kernel.config.MultiParentClassLoader.loadOptimizedClass(MultiParentClassLoader.java:407)
     at 
org.apache.geronimo.kernel.config.MultiParentClassLoader.loadClass(MultiParentClassLoader.java:257)
     at java.lang.ClassLoader.loadClass(ClassLoader.java:248)
     at 
org.apache.commons.fileupload.disk.DiskFileItemFactory.createItem(DiskFileItemFactory.java:179)
     at 
org.apache.commons.fileupload.FileUploadBase.createItem(FileUploadBase.java:500)
     at 
org.apache.commons.fileupload.FileUploadBase.parseRequest(FileUploadBase.java:367)
     at 
org.apache.commons.fileupload.servlet.ServletFileUpload.parseRequest(ServletFileUpload.java:116)
     at de.guhsoft.test.PostServlet.doPost(PostServlet.java:38)
     at javax.servlet.http.HttpServlet.service(HttpServlet.java:713)
     at javax.servlet.http.HttpServlet.service(HttpServlet.java:806)
     at 
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
     at 
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
     at 
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
     at 
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
     at 
org.apache.geronimo.tomcat.GeronimoStandardContext$SystemMethodValve.invoke(GeronimoStandardContext.java:420)
     at 
org.apache.geronimo.tomcat.valve.GeronimoBeforeAfterValve.invoke(GeronimoBeforeAfterValve.java:47)
     at 
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
     at 
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
     at 
org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:555)
     at 
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
     at 
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:298)
     at 
org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:857)
     at 
org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:588)
     at 
org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:396)
     at org.apache.geronimo.pool.ThreadPool$1.run(ThreadPool.java:214)
     at 
org.apache.geronimo.pool.ThreadPool$ContextClassLoaderRunnable.run(ThreadPool.java:344)
     at 
java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
     at 
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
     at java.lang.Thread.run(Thread.java:662)

Any help is appreciated

Best regards,
Martin

Am 28.02.2011 10:55, schrieb Ben Adam:
>
> Hi
>
> I am getting the following runtime error in geronimo 2.2.1 while 
> trying upload a file using a servlet to activemq.  Any help appriciated.
>
> Regards,
> Adam
>
> java.lang.NoClassDefFoundError: 
> org/apache/commons/io/output/DeferredFileOutputStream
>  org.apache.commons.fileupload.disk.DiskFileItemFactory.createItem(DiskFileItemFactory.java:179)
>  org.apache.commons.fileupload.FileUploadBase.createItem(FileUploadBase.java:500)
>  org.apache.commons.fileupload.FileUploadBase.parseRequest(FileUploadBase.java:367)
>  org.apache.commons.fileupload.servlet.ServletFileUpload.parseRequest(ServletFileUpload.java:116)
>  com.hcl.stpa.simulator.FileUploadServlet.doPost(FileUploadServlet.java:74)
>  javax.servlet.http.HttpServlet.service(HttpServlet.java:713)
>  javax.servlet.http.HttpServlet.service(HttpServlet.java:806)
>
>
> root cause
>
> java.lang.ClassNotFoundException: 
> org.apache.commons.io.output.DeferredFileOutputStream in classloader 
> org.apache.geronimo.configs/axis2/2.2.1/car
>  org.apache.geronimo.kernel.config.MultiParentClassLoader.loadOptimizedClass(MultiParentClassLoader.java:407)
>  org.apache.geronimo.kernel.config.MultiParentClassLoader.loadClass(MultiParentClassLoader.java:257)
>  java.lang.ClassLoader.loadClass(ClassLoader.java:248)
>  org.apache.commons.fileupload.disk.DiskFileItemFactory.createItem(DiskFileItemFactory.java:179)
>  org.apache.commons.fileupload.FileUploadBase.createItem(FileUploadBase.java:500)
>  org.apache.commons.fileupload.FileUploadBase.parseRequest(FileUploadBase.java:367)
>  org.apache.commons.fileupload.servlet.ServletFileUpload.parseRequest(ServletFileUpload.java:116)
>  com.hcl.stpa.simulator.FileUploadServlet.doPost(FileUploadServlet.java:74)
>  javax.servlet.http.HttpServlet.service(HttpServlet.java:713)
>  javax.servlet.http.HttpServlet.service(HttpServlet.java:806)
>

-- 
G&  H Softwareentwicklung GmbH    Tel.: {+49|0} 7451 - 53 706 0
Robert-Bosch-Str. 23              Sitz der Gesellschaft: Horb a.N.
D-72160 Horb a.N.                 Amtsgericht Stuttgart HRB 440599
Geschäftsführer:                  Dirk Gfrörer, Martin Hejl