Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Error in accessing database.. Please help me..

38 views
Skip to first unread message

Ang Thiam Guan, Billy

unread,
Feb 7, 2005, 5:57:41 AM2/7/05
to
hi,

i'm trying to create my own login page flow but there seems to have some problem in trying to access my database.
I have create a connection pool with the following details:

Name: [b]MyJDBC Connection Pool[/b]
URL: [b]jdbc:mysql://localhost/eLogbook[/b]
Driver Classname: [b]com.mysql.jdbc.Driver[/b]

i tried to test the configuration and its successful.
and so i carry on by creating the datasource..

Name: [b]testing[/b]
JNDI Name: [b]jdbc:odbc:eLogbook[/b]
Pool Name: [b]MyJDBC Connection Pool[/b]

and so i've created the above datasource...

aft creating the above connection pool and datasource, i tried to test whether i can retrieve something from my database.. so i came out with a login page flow.. in which i will compare the username and password given by user.. if same password i'll forward him to success.jsp.. if its not i'lll forward him to fail.jsp.


and yet when i tried to login.. it gives me the following error..

An error has occurred:

EJB Exception: ; nested exception is:
weblogic.jws.control.ControlException: Exception in onAcquirecontext event handler[Context failure: onAcquire[Unable to resolve 'jdbc:odbc:eLogbook' Resolved ]]

caused by: : weblogic.jws.control.ControlException: Exception in onAcquirecontext event handler[Context failure: onAcquire[Unable to resolve 'jdbc:odbc:eLogbook' Resolved ]]

In mysql, i have created a db schema called eLogbook with a table called users.. i wonder has it got anything to di with the error?

I'm sorry if the above are some newbie errors.. cause i'm still trying to learn the use of weblogic and in rush of time to come out with a proj on this..
I will be thankful for any help given..
Please help me..
Thanks.. =)


Regards,
Billy

Anders Mathisen

unread,
Feb 7, 2005, 6:07:39 AM2/7/05
to
hi,

seems like the datasource is not deployed on the server you are using.

Please verify the following:

- datasource exists in the weblogic console
- datasource is deployed on the server

- look closely in the log for failed connection attempts to the MYSQL DB, a datasource not being able to initialize connection on startup will not be deployed.

If the connection pool failed to connect to the MySql DB, there are a number of reasons for this, post error message if this is the case.

See:

http://e-docs.bea.com/wls/docs81/jdbc/programming.html#1056955

for details.

- Anders M.

Hussein Badakhchani

unread,
Feb 7, 2005, 8:25:49 AM2/7/05
to
Hello,

Just to add to Anders suggestions:

Check the jndi name of your datasource

you have jdbc:odbc:eLogbook

try jdbc.odbc.eLogbook

and check if it is on your server jndi tree -> on the console right click server and view the JNDI tree. You should be able to see it.

Cheers,
Hoos

Ang Thiam Guan, Billy

unread,
Feb 7, 2005, 10:22:07 PM2/7/05
to
Hi,

i had check that my datasource exists in the weblogic console with the Name called "testing" and JNDI Name now changed to "jdbc.odbc.eLogbook" instead of "jdbc:odbc:eLogbook"..
but when i tried to test it out..
it gives me the following error instead of the previous one..

[b]


EJB Exception: ; nested exception is:

weblogic.jws.control.ControlException: Exception in onAcquirecontext event handler[Context failure: onAcquire[While trying to lookup 'jdbc.odbc.eLogbook' didn't find subcontext 'jdbc' Resolved ]]

caused by: : weblogic.jws.control.ControlException: Exception in onAcquirecontext event handler[Context failure: onAcquire[While trying to lookup 'jdbc.odbc.eLogbook' didn't find subcontext 'jdbc' Resolved ]]
[/b]

my previous error was...

[b]


EJB Exception: ; nested exception is:
weblogic.jws.control.ControlException: Exception in onAcquirecontext event handler[Context failure: onAcquire[Unable to resolve 'jdbc:odbc:eLogbook' Resolved ]]

caused by: : weblogic.jws.control.ControlException: Exception in onAcquirecontext event handler[Context failure: onAcquire[Unable to resolve 'jdbc:odbc:eLogbook' Resolved ]]

[/b]


the error says that while trying lookup 'jdbc.odbc.eLogbook' didn't find subcontext 'jdbc'

is there anything wrong here? Did i manage to give u a clearer idea of the error?
thanks for the help your giving me =)

Regards,
Billy

Ang Thiam Guan, Billy

unread,
Feb 7, 2005, 10:45:24 PM2/7/05
to
oh yes btw..
when i take a look at my config.xml
i notice the following somewhere in the middle of my config.xml..

[b]
<JDBCConnectionPool CapacityIncrement="1" DriverName="com.pointbase.jdbc.jdbcUniversalDriver" InitialCapacity="5" MaxCapacity="50" Name="cgPool" Password="{3DES}w9L5ZHMHVwgtQnbYHhXGMA==" Properties="user=weblogic" RefreshMinutes="0" ShrinkPeriodMinutes="15" ShrinkingEnabled="true" SupportsLocalTransaction="true" Targets="portalServer" TestConnectionsOnRelease="false" TestConnectionsOnReserve="false" URL="jdbc:pointbase:server://localhost:9093/workshop" />
<JDBCDataSource JNDIName="p13n.trackingDataSource" Name="p13n_trackingDataSource" PoolName="cgPool" Targets="portalServer" />
<JDBCDataSource JNDIName="p13n.sequencerDataSource" Name="p13n_sequencerDataSource" PoolName="cgPool" Targets="portalServer" />
<JDBCDataSource JNDIName="p13n.dataSyncDataSource" Name="p13n_dataSyncDataSource" PoolName="cgPool" Targets="portalServer" />
<JDBCTxDataSource EnableTwoPhaseCommit="true" JNDIName="cgDataSource" Name="cgDataSource" PoolName="cgPool" Targets="portalServer" />
<JDBCTxDataSource EnableTwoPhaseCommit="true" JNDIName="weblogic.jdbc.jts.commercePool" Name="commercePool" PoolName="cgPool" Targets="portalServer" />
<JDBCTxDataSource EnableTwoPhaseCommit="true" JNDIName="contentDataSource" Name="contentDataSource" PoolName="cgPool" Targets="portalServer" />
<JDBCTxDataSource EnableTwoPhaseCommit="true" JNDIName="weblogic.jdbc.jts.ebusinessPool" Name="ebusinessPool" PoolName="cgPool" Targets="portalServer" />
<JDBCTxDataSource EnableTwoPhaseCommit="true" JNDIName="portalFrameworkPool" Name="portalFrameworkPool" PoolName="cgPool" Targets="portalServer" />
<JTA Name="eLogbookDomain" TimeoutSeconds="500" />
[/b]

i notice there's cgPool, p13n_sequencerDataSource, eBusinessPool, cgDataSource etc..
all these connection pools and DataSource can be found in my console.. why am i having the above in mt config.xml when i dont think i'm using them?

then at the very end of my config.xml..
i have these..

[b]
JDBCConnectionPool DriverName="com.mysql.jdbc.Driver" Name="MyJDBC Connection Pool" Password="{3DES}1RW0KddIoPE=" Properties="user=root" Targets="portalServer" TestTableName="SQL SELECT 1" URL="jdbc:mysql://localhost/eLogbook" />
<JDBCTxDataSource JNDIName="jdbc.odbc.eLogbook" Name="testing" PoolName="MyJDBC Connection Pool" Targets="portalServer" />
[/b]

is there anything wrong with my config.xml as well?

Pardon me for the questions asked.. i'm still a teen trying to learn Weblogic..
thanks!

Regards
Billy

Anders Mathisen

unread,
Feb 8, 2005, 2:58:00 AM2/8/05
to
hi,

my previous hypothesis is still valid. The datasource is for some reason not deployed on your server.

The change in error message is due to the meaning of '.' in JNDI as opposed to ':', '.' is a separation mark for contexts, meaning your names root context is 'jdbc'.

I would try the following, in the order below

( 1 ) remove the '.' from the pool name, replacing it with eg. '_'

If the above does not work

( 2 ) look into portalServer.log, I would guess there is a few error lines there saying something like "could not create connection for pool MyJDBC ..."

If you do not fancy reading those logs, post them om the forum or to my mail and I will look through it.

- Anders M.

Hussein Badakhchani

unread,
Feb 8, 2005, 10:58:26 AM2/8/05
to
RedTinCan,

I suggest you start from scratch, zap your datasource, zap your connection pool then try recreating them but don't use JNDI names like ejb, jdbc etc that may conflict with real contexts try:

Name: MyConnectionPool
URL: jdbc:mysql://localhost/eLogbook
Driver Classname: com.mysql.jdbc.Driver

Make sure you target and deploy this pool before creating your datasource

Name: MyDatasource
JNDI Name: mydomain.eLogbook
Pool Name: MyConnectionPool

Target and deploy it then update your ejb to use this pool. Shutdown your server and restart.


Good luck,
Hoos

Message was edited by hoos at Feb 8, 2005 7:58 AM

Ang Thiam Guan, Billy

unread,
Feb 8, 2005, 12:44:55 PM2/8/05
to
Yup thanks..

i am really grateful for the help give by both of you..
Well my school will be closed on the 9th to 10 Feb due to the Chinese New Year, which means i cant have access to the machine till 11feb.. i'll try out the solution given by both of u asap when my school re-opens..

Am really grateful to the help given by you..

Thanks.

Regards,
Billy

Ang Thiam Guan, Billy

unread,
Feb 10, 2005, 11:35:55 PM2/10/05
to
Sir,

i gpt back to school this morning and this is what i had retrieved form the portalServer.log
i had only copied a small portion which i think is what you're looking for?
Please take a look.. thanks =)

####<Feb 11, 2005 12:15:23 PM GMT+08:00> <Info> <HTTP> <cairo> <portalServer> <main> <<WLS Kernel>> <> <BEA-101051> <[HTTP portalServer] started>
####<Feb 11, 2005 12:15:23 PM GMT+08:00> <Info> <WebService> <cairo> <portalServer> <main> <<WLS Kernel>> <> <BEA-220027> <Web Service reliable agents are started on the server.>
####<Feb 11, 2005 12:15:23 PM GMT+08:00> <Info> <Deployer> <cairo> <portalServer> <main> <<WLS Kernel>> <> <BEA-149209> <Resuming.>
####<Feb 11, 2005 12:15:23 PM GMT+08:00> <Info> <Common> <cairo> <portalServer> <main> <<WLS Kernel>> <> <BEA-000625> [b]<The application has disabled periodic testing of free resources in pool "MyJDBC Connection Pool".>[/b]
####<Feb 11, 2005 12:15:23 PM GMT+08:00> <Error> <JDBC> <cairo> <portalServer> <main> <<WLS Kernel>> <> <BEA-001150> [b]<Connection Pool "MyJDBC Connection Pool" deployment failed with the following error: Cannot load driver class: com.mysql.jdbc.Driver.> [/b]
####<Feb 11, 2005 12:15:23 PM GMT+08:00> <Info> <JDBC> <cairo> <portalServer> <main> <<WLS Kernel>> <> <BEA-001156> <Stack trace associated with message 001150 follows:

weblogic.common.resourcepool.ResourceSystemException: Cannot load driver class: com.mysql.jdbc.Driver
at weblogic.jdbc.common.internal.JDBCUtil.parseException(JDBCUtil.java:197)
at weblogic.jdbc.common.internal.ConnectionEnvFactory.loadDriver(ConnectionEnvFactory.java:50)
at weblogic.jdbc.common.internal.ConnectionEnvFactory.<init>(ConnectionEnvFactory.java:79)
at weblogic.jdbc.common.internal.ConnectionPool.initPooledResourceFactory(ConnectionPool.java:514)
at weblogic.common.resourcepool.ResourcePoolImpl.start(ResourcePoolImpl.java:165)
at weblogic.jdbc.common.internal.ConnectionPool.doStart(ConnectionPool.java:880)
at weblogic.jdbc.common.internal.ConnectionPool.start(ConnectionPool.java:133)
at weblogic.jdbc.common.internal.ConnectionPoolManager.createAndStartPool(ConnectionPoolManager.java:291)
at weblogic.jdbc.common.internal.JDBCService.addDeployment(JDBCService.java:178)
at weblogic.management.mbeans.custom.DeploymentTarget.addDeployment(DeploymentTarget.java:330)
at weblogic.management.mbeans.custom.DeploymentTarget.addDeployments(DeploymentTarget.java:590)
at weblogic.management.mbeans.custom.DeploymentTarget.updateServerDeployments(DeploymentTarget.java:568)
at weblogic.management.mbeans.custom.DeploymentTarget.updateDeployments(DeploymentTarget.java:240)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:324)
at weblogic.management.internal.DynamicMBeanImpl.invokeLocally(DynamicMBeanImpl.java:711)
at weblogic.management.internal.DynamicMBeanImpl.invoke(DynamicMBeanImpl.java:690)
at weblogic.management.internal.ConfigurationMBeanImpl.invoke(ConfigurationMBeanImpl.java:476)
at com.sun.management.jmx.MBeanServerImpl.invoke(MBeanServerImpl.java:1557)
at com.sun.management.jmx.MBeanServerImpl.invoke(MBeanServerImpl.java:1525)
at weblogic.management.internal.RemoteMBeanServerImpl.private_invoke(RemoteMBeanServerImpl.java:947)
at weblogic.management.internal.RemoteMBeanServerImpl.invoke(RemoteMBeanServerImpl.java:908)
at weblogic.management.internal.MBeanProxy.invoke(MBeanProxy.java:946)
at weblogic.management.internal.MBeanProxy.invokeForCachingStub(MBeanProxy.java:481)
at weblogic.management.configuration.ServerMBean_Stub.updateDeployments(ServerMBean_Stub.java:7271)
at weblogic.management.deploy.slave.SlaveDeployer.updateServerDeployments(SlaveDeployer.java:1210)
at weblogic.management.deploy.slave.SlaveDeployer.resume(SlaveDeployer.java:362)
at weblogic.management.deploy.DeploymentManagerServerLifeCycleImpl.resume(DeploymentManagerServerLifeCycleImpl.java:229)
at weblogic.t3.srvr.SubsystemManager.resume(SubsystemManager.java:131)
at weblogic.t3.srvr.T3Srvr.resume(T3Srvr.java:964)
at weblogic.t3.srvr.T3Srvr.run(T3Srvr.java:359)
at weblogic.Server.main(Server.java:32)

is the above(in bold) the main problem for the error?
What is going wrong?

Thanks.. =)

Regards,
Billy

Anders Mathisen

unread,
Feb 11, 2005, 4:05:42 AM2/11/05
to
well, basically the driver class for your MySql connection is not found. This leads to the connection pool not being initialized. This in turn leads to the datasource not being initialized and deployed. Therefor the DS is not found in JNDI.

I have never used the MySql driver with BEA myself, but this post pretty much sums up what needs to be done.

http://forums.bea.com/bea/message.jspa?messageID=202440767

Hope you had a wonderful celebration of new year I hope this posting solves your problem.

- Anders M.

Hussein Badakhchani

unread,
Feb 11, 2005, 7:41:48 AM2/11/05
to
Yep

Ang Thiam Guan, Billy

unread,
Feb 13, 2005, 12:01:56 AM2/13/05
to
hi,

i have tried the method mentioned in the url you had given me and it gives me another error.. which i dont know what is it about?

An error has occurred:


EJB Exception: ; nested exception is:

weblogic.jws.control.ControlException: Exception in onAcquirecontext event handler[Context failure: onAcquire[Failed to Generate Wrapper Class.
Nested Exception: java.lang.RuntimeException: Failed to Generate Wrapper Class
at weblogic.utils.wrapper.WrapperFactory.createWrapper(WrapperFactory.java:154)
at weblogic.jdbc.wrapper.JDBCWrapperFactory.getWrapper(JDBCWrapperFactory.java:154)
at weblogic.jdbc.jts.Driver.newConnection(Driver.java:674)
at weblogic.jdbc.jts.Driver.createLocalConnection(Driver.java:196)
at weblogic.jdbc.jts.Driver.connect(Driver.java:154)
at weblogic.jdbc.common.internal.RmiDataSource.getConnection(RmiDataSource.java:305)
at com.bea.wlw.runtime.core.control.DatabaseControlImpl.getConnection(DatabaseControlImpl.jcs:1430)
at com.bea.wlw.runtime.core.control.DatabaseControlImpl.context_onAcquire(DatabaseControlImpl.jcs:1322)

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:324)

at com.bea.wlw.runtime.core.dispatcher.DispMethod.invoke(DispMethod.java:367)

and the error code goes on...


what is the wrapper class error about?
What can i do to solve it?


Regards,
Billy

Anders Mathisen

unread,
Feb 14, 2005, 3:59:31 AM2/14/05
to
hi,

in the datasource configuration, try to set "Honor Global Transactions" to false. I suspect that this error comes from a transactional reason.

You might have to recreate the datasource, I am not sure if the "Honor .." flag can be modified on an already created datasource.

Please be aware of the implications of turning the flag off, refer to the documentation below for details.

http://e-docs.bea.com/workshop/docs81/doc/en/workshop/guide/howdoi/howConnectDatabaseControlSQLServerOracle.html

- Anders M.

0 new messages