DataSource and JNDI

Hi all!

I searched but did not find a solution for my problem. I have JSC installed and everything is working. I need a database connection, creating one from Creator works also with bundled AS.

But how can I use JNDI names as source for my RowSets? I read that I could use the data source from deployment servers view, but I have an AS 9 to depoly to and adding this one simply doesn't work.

So how can I manage this the right way? I have setup two working JDBC ressouces on both the bundled and the standalone AS - but what now?

Thanks for any input,

Jan

[596 byte] By [JanKesten] at [2007-11-26 8:48:00]
# 1
Hi!Did you read this tutorial: http://developers.sun.com/prodtech/javatools/jscreator/learning/tutorials/2/app serverdeploy.htmlMaybe it will be helpful for you.Thanks,Roman.
Grif at 2007-7-6 22:35:53 > top of Java-index,Development Tools,Java Tools...
# 2

Hi Roman!

Thanks for your reply. I've read this before - and I have something like

<ressource-ref>

<res-ref-name>jdbc/TechData</res-ref-name>

<jndi-name>jdbc/TechData</jndi-name>

</ressource-ref>

This seems to work on both systems, as I fetch a database connection from InitialContext from my application and use this to make inserts to my database tables. These work fine.

I added a Data Source first in Creator (for PostgreSQL) with TechData as name. I can see any tables, issue queries and so on. After deploying to the bundled AppServer there is a ressource jdbc/TechData created.

Now I use some table components to display some data - dropped one on my page. Dropped a table on my page, creating a DataProvider. Used this DataProvider for the tableRowGroup.

Deploying this to the bundled AppServer results in the page displayed correct with a filled table. Deploying to an stand-alone AppServer (version 9) results in my inserts working like before but the table is empty ("No items found.").

What could be the reason for this behaviour?

Thanks,

Jan

JanKesten at 2007-7-6 22:35:53 > top of Java-index,Development Tools,Java Tools...
# 3
Hi Jan!Is there any exception in server.log?Thanks,Roman,
Grif at 2007-7-6 22:35:53 > top of Java-index,Development Tools,Java Tools...
# 4

Hi!

Indeed there are - and only in the standalone AS9. Just noticed that I was always looking at the wrong one and was wondering that no new entries arrive (obviously not enough coffee today). Here is the exeception:

Log Entry Detail

Details

Timestamp: 19.07.2006 14:42:08.392

Log Level: SEVERE

Logger: javax.enterprise.system.container.web

Name-Value Pairs: _ThreadID=12;_ThreadName=httpWorkerThread-4848-0;_RequestID=07ca16f3-10d1-4deb-8f31-2055b64cae1c;

Record Number: 444

Message ID: StandardWrapperValve[RemoteJmxConnectorServlet]

Complete Message

Servlet.service() for servlet RemoteJmxConnectorServlet threw exception

java.lang.ClassCastException: javax.management.remote.message.MBeanServerRequestMessage

at com.sun.enterprise.admin.jmx.remote.server.servlet.RemoteJmxConnectorServlet.readRequestMessage(RemoteJmxConnectorServlet.java:195)

at com.sun.enterprise.admin.jmx.remote.server.servlet.RemoteJmxConnectorServlet.processRequest(RemoteJmxConnectorServlet.java:108)

at com.sun.enterprise.admin.jmx.remote.server.servlet.RemoteJmxConnectorServlet.doPost(RemoteJmxConnectorServlet.java:180)

at javax.servlet.http.HttpServlet.service(HttpServlet.java:727)

at javax.servlet.http.HttpServlet.service(HttpServlet.java:820)

at org.apache.catalina.core.ApplicationFilterChain.servletService(ApplicationFilterChain.java:397)

at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:278)

at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:566)

at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:536)

at org.apache.catalina.core.StandardContextValve.invokeInternal(StandardContextValve.java:240)

at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:179)

at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:566)

at com.sun.enterprise.web.WebPipeline.invoke(WebPipeline.java:73)

at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:182)

at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:566)

at com.sun.enterprise.web.VirtualServerPipeline.invoke(VirtualServerPipeline.java:120)

at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:939)

at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:137)

at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:566)

at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:536)

at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:939)

at org.apache.coyote.tomcat5.CoyoteAdapter.service(CoyoteAdapter.java:231)

at com.sun.enterprise.web.connector.grizzly.ProcessorTask.invokeAdapter(ProcessorTask.java:667)

at com.sun.enterprise.web.connector.grizzly.ProcessorTask.processNonBlocked(ProcessorTask.java:574)

at com.sun.enterprise.web.connector.grizzly.ProcessorTask.process(ProcessorTask.java:844)

at com.sun.enterprise.web.connector.grizzly.ReadTask.executeProcessorTask(ReadTask.java:287)

at com.sun.enterprise.web.connector.grizzly.ReadTask.doTask(ReadTask.java:212)

at com.sun.enterprise.web.connector.grizzly.TaskBase.run(TaskBase.java:252)

at com.sun.enterprise.web.connector.grizzly.WorkerThread.run(WorkerThread.java:75)

This message shows up every 10 seconds in the log and only on AS9 but not at the bundled one.

Is this a problem with my application or is there anything wrong with the AppServer?

Thanks,

Jan

JanKesten at 2007-7-6 22:35:53 > top of Java-index,Development Tools,Java Tools...
# 5

Did you try to add the AS PE 9 as a remote server to the Creator IDE? I believe that would cause such exceptions:-( If you did, please remove that remote server from the IDE. (The IDE would try every n seconds to ask the server for it's status but the server does not understand that request)

Overall for your DB problem with AS PE 9, try to latest GlassFish build. The released version has a problem where it will not execute the init() call in our Page beans as we expect. That causes the DB statements not to be executed:-(

Search this forum for GlassFish and or _init for more information.

Thanks,

-- Marco

mw46 at 2007-7-6 22:35:53 > top of Java-index,Development Tools,Java Tools...
# 6

Hi Marco!

Indeed I tried to do that - but not successfully, I can't access anything on that server then, so I think I removed it after that. I'll check that tomorrow :-)

I removed AS PE 9 from my Sun system and installed GlassFish v2 build 09. Worked! Many thanks for that hint - I already have one GlassFish on one of my servers but did not try my application there so far.

But my other issue with error and validation messages is still there, hope someone knows how to solve.

So thanks again and really a great community!

Cheers,

Jan

JanKesten at 2007-7-6 22:35:53 > top of Java-index,Development Tools,Java Tools...