This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 208747

Summary: Cannot deploy PetCatalog on GlassFish 3.1.2: "WebappClassLoader unable to load resource"
Product: javaee Reporter: Vladimir Riha <vriha>
Component: SamplesAssignee: Martin Janicek <mjanicek>
Status: VERIFIED FIXED    
Severity: normal CC: marfous, mjanicek, mmirilovic, pjiricka, sj-nb, TomasKraus, vkraemer, vriha
Priority: P1 Keywords: REGRESSION
Version: 7.1.1   
Hardware: PC   
OS: All   
Issue Type: DEFECT Exception Reporter:
Attachments: server log
full log

Description Vladimir Riha 2012-02-22 12:57:14 UTC
Created attachment 116023 [details]
server log

When trying to run PetCatalog sample on GF 3.1.2, it results in 

WARNING: java.lang.IllegalStateException: WEB9031: WebappClassLoader unable to load resource [com.mysql.jdbc.EscapeProcessor], because it has not yet been started, or was already stopped
	at org.glassfish.web.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1401)
	at org.glassfish.web.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1359)
	at com.mysql.jdbc.ConnectionImpl.nativeSQL(ConnectionImpl.java:3962)

(see server attached server log)


It works on GF 3.0.1. I've done nothing special, only create project, add mysql connector library, configure database and run the project.


Product Version: NetBeans IDE 7.1.1 RC1 (Build 201202141941)
Java: 1.7.0_03; Java HotSpot(TM) Client VM 22.1-b02
System: Linux version 2.6.38-13-generic running on i386; UTF-8; en_US (nb)

mysql-connector-java-5.1.18
Comment 1 Vladimir Riha 2012-02-22 12:58:32 UTC
Maybe related to issue #198022
Comment 2 Martin Janicek 2012-02-23 15:37:45 UTC
Is this a stopper for 7.1.1 ?
Comment 3 Vladimir Riha 2012-02-23 16:04:49 UTC
I'm not sure.  If it is similar to the #198022 then it's a bit old and it could probably wait to 7.2
Comment 4 Marian Mirilovic 2012-02-23 17:08:01 UTC
Lada, are you able to reproduce it in 7.1 ? If not, it's a stopper.
Comment 5 Vladimir Riha 2012-02-23 22:01:11 UTC
I can reproduce it in 7.1 but it depends on version of GlassFish.

So reproduced on:
- NB 7.1 + GF 3.1.2 (b23) 
- NB 7.1.1RC1 + GF 3.1.2 (b23) 

GlassFish 3.1.1 (the one bundled with 7.1) works fine with both RC1 and 7.1 (and as mentioned GF 3.0.1 and RC1 also works). 


Java: 1.7.0_03; Java HotSpot(TM) Client VM 22.1-b02
System: Linux version 2.6.38-13-generic running on i386; UTF-8; en_US (nb)
Comment 6 Marian Mirilovic 2012-02-23 23:16:44 UTC
So it's regression while working with newly bundled version of Glassfish - stopper for 7.1.1
Comment 7 Martin Janicek 2012-02-24 08:46:32 UTC
CCing also to Martin and Sergey. From the server log it seems that it might be Ejb/Persistence related issue. Guys, any ideas what could be the problem?
Comment 8 Martin Fousek 2012-02-24 09:17:40 UTC
At the quick look it doesn't look to me like ejb (even if NetBeans) troubles - create some paginator -> get count of items -> execute query for getting that information from database. 

Anyway I'm afraid that the exception is not known to me at all. Martin, you can probably try to take a look on issue #198022, looks to be related to similar troubles.
Comment 9 Martin Janicek 2012-02-24 09:47:49 UTC
Ok, thanks for a quick response Martin.
Regarding issue 198022 comment 10, I believe that this is rather Glassfish problem --> reassigning to Vince for evaluation.
Comment 10 Sergey Petrov 2012-02-24 11:04:09 UTC
As it differ from gf version, it's unlikely something with persistence support, especially if once created application works on gf 3.1 and doesn't work on gf3.1.2.
Comment 11 Vince Kraemer 2012-02-24 13:57:45 UTC
Tomas... please look into this.
Comment 12 Vince Kraemer 2012-02-24 14:00:11 UTC
Please attach the full server log... that includes starting the server and deploying the app as well as the run-time exception if available.
Comment 13 Vince Kraemer 2012-02-24 14:02:28 UTC
is this really on 'all' OSes?  What OS were you using when you encountered this issue?
Comment 14 Vladimir Riha 2012-02-24 14:15:53 UTC
Created attachment 116087 [details]
full log

I reproduced it on WinXP (32b) and Ubuntu 11.04 (64b), both systems are running the same jdk. All logs here are from ubuntu and 


Java: 1.7.0_03; Java HotSpot(TM) Client VM 22.1-b02
Comment 15 Petr Jiricka 2012-02-24 14:27:38 UTC
I am trying to reproduce with Mac OS X, and I must say I am hitting a different issue - the JDBC driver is not deployed. Any ideas?

BTW, Vlado, why are you using mysql-connector-java-5.1.18? The IDE includes 5.1.13, why don't you just use that?
Comment 16 Vince Kraemer 2012-02-24 14:34:44 UTC
(In reply to comment #11)
> Tomas... please look into this.

Couple things to check...

1. can this issue be reproduced if the server is started from the command line
before deployment?

2. can this issue be reproduced if the app is deployed using asadmin deploy
XYZ.jar

3. can this issue be reproduced if the app is directory deployed with asadmin?
Comment 17 Vladimir Riha 2012-02-24 14:37:46 UTC
Petr: Yes, I had the same problem. I thought that you have to add the connector to your classpath to make it work so instead of that I added it manually to the project. I didn't know that NetBeans have some connector included...
Comment 18 Petr Jiricka 2012-02-24 14:43:33 UTC
After copying the driver manually to domain1/lib, I must say I am not able to reproduce, works fine for me on Mac OS X. 

> I thought that you have to add the connector to your classpath to make it work so instead of that
> I added it manually to the project.

That explains it, when I do this, I also get the same error. Can you please try to remove it from the project and put it to domains/domain1/lib instead? (You need to also restart the server after that.)
Comment 19 Vladimir Riha 2012-02-24 14:55:52 UTC
Yes, after that it works for me too.
Comment 20 Petr Jiricka 2012-02-24 14:58:11 UTC
Ok, I am closing this bug as invalid.

I created a new bug 208830 for the JDBC driver deployment problem.
Comment 21 Marian Mirilovic 2012-02-24 15:02:57 UTC
(In reply to comment #20)
> Ok, I am closing this bug as invalid.
> 
> I created a new bug 208830 for the JDBC driver deployment problem.

Hmm, so why is this working in 3.1.1 ?
Comment 22 Petr Jiricka 2012-02-24 15:08:59 UTC
Vlada says it works in 3.0.1, not 3.1.1. Either way, adding JDBC drivers to the application archive is not supported in general, so if that approach works, then that's an added bonus, but not a requirement. The important question is whether the supported usecase (driver jar inside domain lib directory) works consistently.
Comment 23 Vladimir Riha 2012-02-24 15:18:49 UTC
Just correction, it does work with 3.1.1 (comment #5)
Comment 24 Vince Kraemer 2012-02-24 15:23:07 UTC
(In reply to comment #23)
> Just correction, it does work with 3.1.1 (comment #5)

Was the 3.1.1 a clean install of 3.1.1 or was it a domain that you had been using in the past... that might have the driver jar in the lib directory already?
Comment 25 Vladimir Riha 2012-02-24 15:43:25 UTC
It was cleaned (I've just retested it). I added manually mysql connector to the project and it works. Also the driver is not in domains/domain1/lib dir after running/deploying the application
Comment 26 TomasKraus 2012-02-24 16:16:41 UTC
I tested the same scenario with GF 4 (trunk) while I was waiting for 3.1.2 to build and there is the same problem like in 3.1.2.
Also adding driver manually into domain1/lib resolved the problem.
Comment 27 TomasKraus 2012-02-29 15:31:17 UTC
Please fix following things in PetCatalog sample:

1) Rename sun-resources.xml to glassfish-resources.xml

2) Add information about jdbc:mysql://127.0.0.1:3306/petcatalog database connection that is required for MySQL JDBC driver deployment into setup/SETUP_INSTRUCTIONS.html
Comment 28 TomasKraus 2012-02-29 15:40:29 UTC
Assigning to Petr to pass it to owner of PetCatalog sample.
Comment 29 Petr Jiricka 2012-03-28 09:10:41 UTC
Martin is the owner of the samples.
Comment 30 Martin Janicek 2012-03-29 13:25:36 UTC
PetCatalog changes implemented in: web-main #c476129fdf7e
Comment 31 Vladimir Riha 2012-04-03 07:53:23 UTC
verified

Product Version: NetBeans IDE Dev (Build 201204021038)
Comment 32 Marian Mirilovic 2012-04-03 13:07:51 UTC
Martin, can we add this into Patch2 ? Is it risky ?
Comment 33 Martin Janicek 2012-04-03 13:18:49 UTC
Well I can only say that changes on sample side aren't risky at all. But they are more or less cosmetic changes without any significant impact on behavior. The real fix has been done as a fix for issue 208830, so it's up to Tomas if he think the same about glassfish changes.
Comment 34 TomasKraus 2012-04-03 13:29:10 UTC
Bug# 208830 fix is already in  release71_fixes branch.
Comment 35 Martin Janicek 2012-04-04 13:38:40 UTC
Patch transplanted in: releases #a5bb29cda5bd
Comment 36 Martin Janicek 2012-04-04 13:49:51 UTC
Specification number increased and long description changed in: releases #c218f56a3fd4
Comment 37 Quality Engineering 2012-04-05 01:20:00 UTC
Integrated into 'releases', will be available in build *201204042205* or newer. Wait for official and publicly available build.
Changeset: http://hg.netbeans.org/releases/rev/a5bb29cda5bd
User: Martin Janicek <mjanicek@netbeans.org>
Log: #208747 - Cannot deploy PetCatalog on GlassFish 3.1.2: "WebappClassLoader unable to load resource"
(transplanted from c476129fdf7e9b15f2642fef43c40d939b58947c)
Comment 38 Vladimir Riha 2012-04-05 05:57:34 UTC
7.1.2 verified

NetBeans IDE 7.1.2 (Build 201204042205)