You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@geronimo.apache.org by rysiek <ry...@menel.com> on 2010/12/17 20:18:49 UTC

Utility Project/Library (Geronimo + Eclipse) - how to?

Hello,

I have a problem with making a utility library for Geronimo 2.2 in Eclipse
(newest Eclipse Java EE).

I idea is to create a project (New Project -> Utility Project) make few
shared classes for other projects and then use it in other applications
(Dynamic Web Project). I add the utility project to dependency (Project ->
Properties -> Java Build Path -> Projects). Eclipse seems to see the library
but when I start the web application I got a message that class is not
found:
Caused by: java.lang.ClassNotFoundException: com.test.TestUtil in
classloader default/webtest/1.0/car
TestUtil class is very simple:
	public static void TestMethod(String arg1) {
		System.out.println("Hello world: "+arg1);
	}
And the web application is also simple:
	protected void doGet(HttpServletRequest request, HttpServletResponse
response) throws ServletException, IOException {
		TestUtil.TestMethod(request.getRequestURI());
	}

The projects is published without error, but when I do a get request I got
ClassNotFoundException.

What can I do to fix this?

(I'm new at J2EE programming and Geronimo)

Thanks
-- 
View this message in context: http://apache-geronimo.328035.n3.nabble.com/Utility-Project-Library-Geronimo-Eclipse-how-to-tp2106871p2106871.html
Sent from the Users mailing list archive at Nabble.com.

Re: Utility Project/Library (Geronimo + Eclipse) - how to?

Posted by dsh <da...@googlemail.com>.
Yep I suspect that adds the required JARs to the lib directory during
deployment time as David Jencks suggested.

Cheers
Daniel

On Sun, Dec 19, 2010 at 9:33 PM, rysiek <ry...@menel.com> wrote:
>
> adding "Project" in "Deployment Assembly" did the trick when working with
> Eclipse.
>
> Thanks,
> Rysiek
> --
> View this message in context: http://apache-geronimo.328035.n3.nabble.com/Utility-Project-Library-Geronimo-Eclipse-how-to-tp2106871p2117020.html
> Sent from the Users mailing list archive at Nabble.com.
>

Re: Utility Project/Library (Geronimo + Eclipse) - how to?

Posted by rysiek <ry...@menel.com>.
adding "Project" in "Deployment Assembly" did the trick when working with
Eclipse.

Thanks,
Rysiek
-- 
View this message in context: http://apache-geronimo.328035.n3.nabble.com/Utility-Project-Library-Geronimo-Eclipse-how-to-tp2106871p2117020.html
Sent from the Users mailing list archive at Nabble.com.

Re: Utility Project/Library (Geronimo + Eclipse) - how to?

Posted by David Jencks <da...@yahoo.com>.
if your project is a war do not use the manifest class-path, just get your utility jar into WEB-INF/lib

if its an ear, still don't use the manifest class-path but put it in lib/ in the ear (this is an javaee 5 feature that works better than manifest class-path)

Or use a geronimo plan, install the jar in the geronimo repository, and have a geronimo dependency from the ee project to the utility jar.  This will result in the utility jar being loaded in a single separate classloader so the jar is shared across all uses.  The first two choices well give you a separate copy per war or ear.

david jencks

On Dec 17, 2010, at 12:56 PM, dsh wrote:

> Hi,
> 
> I would suspect that one needs to add utility JARs via "Deployment
> Assembly" under Eclipse Helios and via "J2EE Module Dependencies"
> under pre Eclipse Helios versions. The "Java Build Path" does NOT do
> the trick cause it is a development time setting rather than a runtime
> setting.
> 
> Technically your web modules MANIFEST.MF file should contain a
> classpath entry via Class-Path listing the utility module.
> 
> Cheers
> Daniel
> 
> On Fri, Dec 17, 2010 at 8:18 PM, rysiek <ry...@menel.com> wrote:
>> 
>> Hello,
>> 
>> I have a problem with making a utility library for Geronimo 2.2 in Eclipse
>> (newest Eclipse Java EE).
>> 
>> I idea is to create a project (New Project -> Utility Project) make few
>> shared classes for other projects and then use it in other applications
>> (Dynamic Web Project). I add the utility project to dependency (Project ->
>> Properties -> Java Build Path -> Projects). Eclipse seems to see the library
>> but when I start the web application I got a message that class is not
>> found:
>> Caused by: java.lang.ClassNotFoundException: com.test.TestUtil in
>> classloader default/webtest/1.0/car
>> TestUtil class is very simple:
>>        public static void TestMethod(String arg1) {
>>                System.out.println("Hello world: "+arg1);
>>        }
>> And the web application is also simple:
>>        protected void doGet(HttpServletRequest request, HttpServletResponse
>> response) throws ServletException, IOException {
>>                TestUtil.TestMethod(request.getRequestURI());
>>        }
>> 
>> The projects is published without error, but when I do a get request I got
>> ClassNotFoundException.
>> 
>> What can I do to fix this?
>> 
>> (I'm new at J2EE programming and Geronimo)
>> 
>> Thanks
>> --
>> View this message in context: http://apache-geronimo.328035.n3.nabble.com/Utility-Project-Library-Geronimo-Eclipse-how-to-tp2106871p2106871.html
>> Sent from the Users mailing list archive at Nabble.com.
>> 


Re: Utility Project/Library (Geronimo + Eclipse) - how to?

Posted by dsh <da...@googlemail.com>.
Hi,

I would suspect that one needs to add utility JARs via "Deployment
Assembly" under Eclipse Helios and via "J2EE Module Dependencies"
under pre Eclipse Helios versions. The "Java Build Path" does NOT do
the trick cause it is a development time setting rather than a runtime
setting.

Technically your web modules MANIFEST.MF file should contain a
classpath entry via Class-Path listing the utility module.

Cheers
Daniel

On Fri, Dec 17, 2010 at 8:18 PM, rysiek <ry...@menel.com> wrote:
>
> Hello,
>
> I have a problem with making a utility library for Geronimo 2.2 in Eclipse
> (newest Eclipse Java EE).
>
> I idea is to create a project (New Project -> Utility Project) make few
> shared classes for other projects and then use it in other applications
> (Dynamic Web Project). I add the utility project to dependency (Project ->
> Properties -> Java Build Path -> Projects). Eclipse seems to see the library
> but when I start the web application I got a message that class is not
> found:
> Caused by: java.lang.ClassNotFoundException: com.test.TestUtil in
> classloader default/webtest/1.0/car
> TestUtil class is very simple:
>        public static void TestMethod(String arg1) {
>                System.out.println("Hello world: "+arg1);
>        }
> And the web application is also simple:
>        protected void doGet(HttpServletRequest request, HttpServletResponse
> response) throws ServletException, IOException {
>                TestUtil.TestMethod(request.getRequestURI());
>        }
>
> The projects is published without error, but when I do a get request I got
> ClassNotFoundException.
>
> What can I do to fix this?
>
> (I'm new at J2EE programming and Geronimo)
>
> Thanks
> --
> View this message in context: http://apache-geronimo.328035.n3.nabble.com/Utility-Project-Library-Geronimo-Eclipse-how-to-tp2106871p2106871.html
> Sent from the Users mailing list archive at Nabble.com.
>