Skip to main content

JDBC Settings + connection pool settings get reset

11 replies [Last post]
giesen
Offline
Joined: 2006-06-18

I'm using Glassfish from NetBeans 5.5 beta 2. Every time I run my application from the NetBeans IDE, my JDBC settings and connection pool settings get reset to an older version and recent changes are lost.

I am manually restoring the settings every time I do this, but it is very laborious. I've tried restarting glassfish, restarting the IDE, and upgrading to the latest glassfish ur1_b05.

This was with both ur1_b04 and url_b05.

Any ideas? Thanks!

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
vbkraemer
Offline
Joined: 2003-09-03

Kedar is partially right here.

The files that have the resource definitions are in the Server Resources folder at the top level of the project....

They have the extension '.sun-resource'.

Use NetBeans to edit these files. The resources that they define are registered EVERY TIME you use NetBeans to deploy.

If you change the values in the admin gui, there is no mechanism to tell NetBeans that the values it has are now obsolete...

vbk

stemarco
Offline
Joined: 2005-02-24

You can configure your build to ignore the sun-resource files. The ant build script checks for a directory named [b]setup[/b] to run server config targets. You can change the sun-resource files there or you can change you [b]project.properties[/b] file so it does not find the setup directory. I've found the simplest way to do this is to change the the value of [b]resource.dir[/b] from [i]setup[/i] to [i]no-setup[/i].

Note. The file path is Project-EJBModule/nbproject/project.properties. You will need to open the Files view to find it.

[b]Correction: [/b] changes to the project.properties file above also get over-written. The change should be made in your build.xml file like this:

...

smc

Message was edited by: stemarco

Message was edited by: stemarco

vbkraemer
Offline
Joined: 2003-09-03

Look in your project's 'Server Resources' directory.

You probably have some files with the extension '.sun-resource'. These files were probably created when you created your EJB3 entities, I am guessing.

They are referenced when you use NetBeans to deploy your web-app. This is why you did not have to use asadmin or the admin console to create the resource when you did your first deployment.

If you right-click on one of them, you can edit the property values for the resource.

If you update these files with the values that you applied to the resources via tha admin gui, you probably won't have this issue any more.

vbk

PS: you may want to join the nbj2ee@netbeans.org mailing list.

km105526
Offline
Joined: 2005-04-04

This looks strikingly similar to what is covered in:

http://forums.java.net/jive/thread.jspa?forumID=56&threadID=16066&messag...

If you can check the contents of your application, you'll
most likely find a sun-resources.xml which contains the
resources definitions that is available along with the
application.

Running application in NetBeans results in redeployment of
this application and that in turn "overwrites" the
resource definitions.

I am under the impression that you are changing the
configuration of these resources from admin console.

A workaround is to actually not use admin console and
use the NetBeans IDE itself to edit the resource and/or
connection pool properties.

Hope this helps.

Regards,
Kedar

giesen
Offline
Joined: 2006-06-18

That sounds exactly like what is happening. I am configuring the connection pool and JDBC through the admin console and redeploying through NetBeans.

However, there is no sun-resources.xml file anywhere in my directory structure.

I have:
web.xml
sub-web.xml
persistence.xml (empty)

Do I need an extra XML file somewhere? Where does the connection pool info go? Where does the JDBC resource that references the connection pool go?

km105526
Offline
Joined: 2005-04-04

That confuses me. Are you using NetBeans 5 or 5.5 Beta?
Is it possible for you to share the EJB-jar or .ear that you
are deploying (redeploying)?

Thanks,
Kedar

giesen
Offline
Joined: 2006-06-18

NetBeans 5.5 Beta 2
JSF 1.2/Servlet 2.5 spec
Glassfish UR1_b05 (with embedded JSF)
I created the project via New Web Application

This is a WAR not an EAR. I'd rather not share code if I can avoid.

km105526
Offline
Joined: 2005-04-04

Oh, not a problem if you can't share.
I am having a hard time accepting the fact that there is
no resource xml in your archive. That was my only hope to
explain sudden changes to your resources on redeployment!

At least, can you please check again in the archive if you
have anything suspicious :)?

Another possibility:
- start domain
- back the domain.xml up.
- deploy this web app.
- see the difference in the domain.xml.

It should only show the application entry if there are
no resources being registered. If there is any other
difference, it is because of these resources being
deployed.

Kedar

giesen
Offline
Joined: 2006-06-18

I followed the steps that you outlined.

One line in domain.xml is changed after deployment:

From the correct setting that I set manually in the web admin tool:

To this:

I unzipped my war file, and did a file search for *resource* (nothing) and *.xml (just web.xml, sun-web.xml, and faces-config.xml). I also did a find in files for mysqlpool and found nothing relevant.

Any other ideass?

km105526
Offline
Joined: 2005-04-04

OK, I am stumped. Let me look around for possible
explanations.

Kedar

sivakumart
Offline
Joined: 2004-01-30

> OK, I am stumped. Let me look around for possible
> explanations.
Yes me too :) The only thing I can think of is that NetBeans or some other script you use to deploy your app deletes the existing JDBC resource and wires it to use the new pool.

Thanks
--Siva.