Caching of JNDI lookup'ed DataSources???
What is the recommened pratice, using bean-managed Entity Beans, in regards to
looking up the DataSource object from the JNDI tree?
Is the best way to store the DataSource object in the session context when setEntityContext
is called and release it on unsetEntityContext?
or
is it best if we lookup the DataSource object in every method and returns it back
to the pool at the end of the same method? Like in the PETStore example from SUN.
In a article from SUN "Seven Rules for Optimizing Entity Beans" they recommend
to cache even DataSource objects. What is BEA's recommendation on this?
http://developer.java.sun.com/developer/technicalArticles/ebeans/sevenrules
Regards,
Steen
http://developer.java.sun.com/developer/technicalArticles/ebeans/sevenrules/
I recommend doing the JNDI look-up in the setEntityContext method and
storing the DataSource in a member variable.
You should get the JDBC connection from the DataSource in each method
and return it in each method.
-- Rob
Steen Laursen wrote:
>
What is the recommened pratice, using bean-managed Entity Beans, in regards to
looking up the DataSource object from the JNDI tree?
Is the best way to store the DataSource object in the session context when setEntityContext
is called and release it on unsetEntityContext?
or
is it best if we lookup the DataSource object in every method and returns it back
to the pool at the end of the same method? Like in the PETStore example from SUN.
In a article from SUN "Seven Rules for Optimizing Entity Beans" they recommend
to cache even DataSource objects. What is BEA's recommendation on this?
http://developer.java.sun.com/developer/technicalArticles/ebeans/sevenrules
Regards,
Steen
http://developer.java.sun.com/developer/technicalArticles/ebeans/sevenrules/
AVAILABLE NOW!: Building J2EE Applications & BEA WebLogic Server
by Michael Girdley, Rob Woollen, and Sandra Emerson
http://learnWebLogic.com
Similar Messages
-
JNDI lookup of DataSource fails
I'm trying to create a DataSource as follows:
Connection connection = null;
String ACCOUNT_DATASOURCE = "weblogic.jdbc.AccountDB";
try {
Context ctx = new InitialContext(System.getProperties());
DataSource ds = (DataSource)ctx.lookup(ACCOUNT_DATASOURCE);
connection = ds.getConnection();
catch (Exception e) {
The client window reveals:
javax.ejb.CreateException: java.lang.NullPointerException
at weblogic.rmi.internal.BasicOutboundRequest.sendReceive(BasicOutboundR
equest.java:85)
at weblogic.rmi.cluster.ReplicaAwareRemoteRef.invoke(ReplicaAwareRemoteR
ef.java:274)
at weblogic.rmi.cluster.ReplicaAwareRemoteRef.invoke(ReplicaAwareRemoteR
ef.java:243)
at weblogic.rmi.internal.ProxyStub.invoke(ProxyStub.java:90)
at $Proxy1.create(Unknown Source)
at helloWorld.Client.main(Client.java:22)
Destroying account..
The server window reveals:
javax.naming.NameNotFoundException: Unable to resolve weblogic.jdbc.AccountDB.
R
esolved: 'weblogic.jdbc' Unresolved:'AccountDB' ; remaining name ''
<<no stack trace available>>
Via the console GUI I created a connection pool, which frequently disappears -
I do not understand at all why this pool seems so transient but it doesn't sound
good, and a data source, which does seem to persist, whose JNDI name corresponds
exactly to the name used for the lookup above. I've seen some usage of the form
java:comp/env/jdbc/... is this simply an arbitrary and therefore optional prefix,
or does it have some arcance meaning of which I am unaware?
Finally, the weblogic-ejb-jar.xml file defines the BMP entity bean and its associated
JNDI name for the database connection.
I've also created the cloudscape database via a .ddl file and copied it across
to the ~/wlserver6.1_beta/samples/eval/cloudscape/data directory (this might not
be the correct place)
Any ideas or suggestions most welcome - I've currently come to a grinding halt
with this.Did you make sure the DataSource (and the underlying connection pool were
actually "deployed" to a target server after you created them? That bit me
for a while...
If you open up the console and open up the "Servers" folder on the left and
right click on your server (myserver) and select "View JNDI Tree", do you
see your DataSource under the jdbc node?
greg
"David Franklin" <[email protected]> wrote in message
news:[email protected]...
>
I'm trying to create a DataSource as follows:
Connection connection = null;
String ACCOUNT_DATASOURCE = "weblogic.jdbc.AccountDB";
try {
Context ctx = new InitialContext(System.getProperties());
DataSource ds = (DataSource)ctx.lookup(ACCOUNT_DATASOURCE);
connection = ds.getConnection();
catch (Exception e) {
The client window reveals:
javax.ejb.CreateException: java.lang.NullPointerException
atweblogic.rmi.internal.BasicOutboundRequest.sendReceive(BasicOutboundR
equest.java:85)
atweblogic.rmi.cluster.ReplicaAwareRemoteRef.invoke(ReplicaAwareRemoteR
ef.java:274)
atweblogic.rmi.cluster.ReplicaAwareRemoteRef.invoke(ReplicaAwareRemoteR
ef.java:243)
at weblogic.rmi.internal.ProxyStub.invoke(ProxyStub.java:90)
at $Proxy1.create(Unknown Source)
at helloWorld.Client.main(Client.java:22)
Destroying account..
The server window reveals:
javax.naming.NameNotFoundException: Unable to resolveweblogic.jdbc.AccountDB.
R
esolved: 'weblogic.jdbc' Unresolved:'AccountDB' ; remaining name ''
<<no stack trace available>>
Via the console GUI I created a connection pool, which frequentlydisappears -
I do not understand at all why this pool seems so transient but it doesn'tsound
good, and a data source, which does seem to persist, whose JNDI namecorresponds
exactly to the name used for the lookup above. I've seen some usage ofthe form
java:comp/env/jdbc/... is this simply an arbitrary and therefore optionalprefix,
or does it have some arcance meaning of which I am unaware?
Finally, the weblogic-ejb-jar.xml file defines the BMP entity bean and itsassociated
JNDI name for the database connection.
I've also created the cloudscape database via a .ddl file and copied itacross
to the ~/wlserver6.1_beta/samples/eval/cloudscape/data directory (thismight not
be the correct place)
Any ideas or suggestions most welcome - I've currently come to a grindinghalt
with this. -
EJB3 - where to perform JMS JNDI lookups?
Hi, I was reading about how the WebLogic jms wrappers work at:
http://download.oracle.com/docs/cd/E12840_01/wls/docs103/jms/j2ee.html
and noticed this section:
"The JNDI lookups of the Connection Factory and Destination objects can be expensive in terms of performance. This is particularly true if the Destination object points to a Foreign JMS Destination MBean, and therefore, is a lookup on a non-local JNDI provider.". I am using Sonic MQ as my foreign JMS Provider hence this is of particular interest to me.
The document recommends caching these lookups in the ejbCreate() method of an EJB. I'm new to EJB3 but notice there is no concept of an ejbCreate() method there so where should I cache the lookups and how do I ensure they get re-looked up in the case of a connection failure?
Many thanks
MandyThanks very much Tom, this helps a lot. I think my confusion lay in the fact that this document talks about caching the JNDI lookups in the ejbCreate and gives the example PoolTestBean.java which uses EJB2 style code. I've made your recommended changes to my code, would you mind just casting your eye over to see if looks ok? I have chosen to cache on create of the bean rather than on first invocation as I want clients to fail on startup rather than during their processing.
Sorry about code layout, not sure how to use HTML in posts to make it verbatim..
@Stateless
@TransactionAttribute(NEVER)
//@ExcludeDefaultInterceptors
public class ServiceWrapperBean implements ServiceWrapper {
// injected resources
@Resource
private SessionContext sctx; // inject the bean context
@Resource(name = "sonicConnectionFactory", mappedName = "sonic.connFactory", shareable = true)
private ConnectionFactory connectionFactory;
@Resource(name = "LegacyAccessIn", mappedName = "queue/LegacyIn", shareable = true)
private Destination sendQueue;
public void sendMessage(String msg) {
if (connectionFactory == null)
connectionFactory = (javax.jms.ConnectionFactory) sctx
.lookup("sonicConnectionFactory");
if (sendQueue == null)
sendQueue = (javax.jms.Destination) sctx.lookup("LegacyAccessIn");
if (msg == null)
throw new IllegalArgumentException("object cannot be null!");
Connection con = null;
Session session = null;
MessageProducer sender = null;
try {
con = connectionFactory.createConnection();
session = con.createSession(true, Session.AUTO_ACKNOWLEDGE);
sender = session.createProducer(null);
Message message = session.createTextMessage("do stuff");
sender.send(sendQueue, message);
} catch (JMSException e) {
// Invalidate the JNDI objects if there is a failure
// this is necessary because the destination object
// may become invalid if the destination server has
// been shut down
connectionFactory = null;
sendQueue = null;
throw new RuntimeException(e);
} finally {
if (con != null) {
try {
// Return JMS resources to the resource reference pool for later re-use.
// Closing a connection automatically also closes its sessions, etc.
con.close(); // also closes other objects
} catch (JMSException je) {
// ignore
} -
JMS Wrappers can't cache JNDI lookups when using secured queues
Hi All!
We are working on a jms client, inside a webapp(servlets), using Weblogic 9.2 and Weblogic 10.3.
As we want to use secured queues and keep being efficient we tryed to use Weblogic JMS Wrappers, that should work according to the docs:
Enhanced Support for Using WebLogic JMS with EJBs and Servlets
http://download.oracle.com/docs/cd/E12840_01/wls/docs103/jms/j2ee.html
But we are facing a problem:
When we define a JMS Wrapper and try to cache JNDI lookups for the QueueConnectionFactory and Queue, as the docs recommend for efficiency, the connection to the queue is ignoring the user/pwd.
The JMS Wrapper is using <res-auth>Application</res-auth>.
We are creating the connection using createQueueConnection(user, pwd) from QueueConnectionFactory and after several tests it seems that the user and password are ingored unless a jndi lookup is made in the same thread, as if when there are not any thread credentials present user and password are ignored for the connection...
so the question is:
That behaviour goes against Weblogic JMS Wrapper documentation, doesn't it?
Is there then any other way to access efficiently secured queues using a servlet as a client? (iit's not an option for us to use mdbs, or ejbs).
If it helps, this seems related to this still opened spring-weblogic issue: SPR-2941 --> http://jira.springframework.org/browse/SPR-2941 and SPR-4720 --> http://jira.springframework.org/browse/SPR-4720
Thanxs
And here goes our DDs and code to reproduce:
First in pretty format:
web.xml --> http://pastebin.com/f5f85e8d4
weblogic.xml --> http://pastebin.com/f2fbe10cc
Client code --> http://pastebin.com/f586d32d9
And now emmebded in the msg:
web.xml
<?xml version="1.0" encoding="UTF-8"?>
<weblogic-web-app
xmlns="http://www.bea.com/ns/weblogic/90"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.bea.com/ns/weblogic/90
http://www.bea.com/ns/weblogic/90/weblogic-web-app.xsd">
<description>WebLogic Descriptor</description>
<resource-description>
<res-ref-name>jms/QCF</res-ref-name>
<jndi-name>weblogic.jms.ConnectionFactory</jndi-name>
</resource-description>
</weblogic-web-app>weblogic.xml
<?xml version="1.0" encoding="UTF-8"?>
<web-app version="2.4" xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">
<display-name> QCFWrapperCredentialsTest </display-name>
<description> QCFWrapperCredentialsTest </description>
<servlet id="Servlet_1">
<servlet-name>QCFWrapperCredentialsTest</servlet-name>
<servlet-class>QCFWrapperCredentialsTest</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping id="ServletMapping_1">
<servlet-name>QCFWrapperCredentialsTest</servlet-name>
<url-pattern>/Test</url-pattern>
</servlet-mapping>
<resource-ref>
<res-ref-name>jms/QCF</res-ref-name>
<res-type>javax.jms.QueueConnectionFactory</res-type>
<res-auth>Application</res-auth>
<res-sharing-scope>Shareable</res-sharing-scope>
</resource-ref>
</web-app>And our test client:
import java.io.*;
import java.util.Properties;
import javax.jms.*;
import javax.naming.*;
import javax.servlet.http.*;
public class QCFWrapperCredentialsTest extends HttpServlet {
QueueConnectionFactory factory = null;
Queue queue = null;
String jndiName = "java:comp/env/jms/QCF";
String queueName= "jms/ColaEntradaConsultas";
String user = "usuarioColas";
String pwd = "12345678";
String userjndi = "usuarioColas";
String pwdjndi = "12345678";
String serverT3URL="t3://127.0.0.1:7007";
public void init() {
setupJNDIResources();
private void setupJNDIResources(){
try {
Properties props = new Properties();
props.put("java.naming.factory.initial",
"weblogic.jndi.WLInitialContextFactory");
props.put("java.naming.provider.url",serverT3URL );
props.put("java.naming.security.principal", userjndi);// usr
props.put("java.naming.security.credentials", pwdjndi);// pwd
InitialContext ic = new InitialContext(props);
factory = (QueueConnectionFactory) ic.lookup(jndiName);
queue = (Queue) ic.lookup(queueName);
} catch (NamingException e) {
e.printStackTrace();
public void service(HttpServletRequest req, HttpServletResponse res) {
res.setContentType("text/html");
Writer wr = null;
try {
wr = res.getWriter();
//Comment this out, do a lookup for each request and it will work
//setupJNDIResources();
String user = this.user;
String pwd = this.pwd;
//read users and passwords from the request in case they are present
if (req.getParameter("user") != null) {
user = req.getParameter("user");
if (req.getParameter("pwd") != null) {
pwd = req.getParameter("pwd");
wr.write("JNDI User: *" + userjndi + "* y pwd: *" + pwdjndi + "*<p>");
wr.write("Queue User: *" + user + "* y pwd: *" + pwd + "*<p>");
//Obtain a connection using user/pwd
QueueConnection conn = factory.createQueueConnection(user, pwd);
QueueSession ses = conn.createQueueSession(true,
Session.SESSION_TRANSACTED);
QueueSender sender = ses.createSender(queue);
TextMessage msg = ses.createTextMessage();
msg.setText("Hi there!");
conn.start();
sender.send(msg);
ses.commit();
sender.close();
ses.close();
conn.close();
} catch (Exception e) {
e.printStackTrace();
try {
wr.write(e.toString());
} catch (Exception e2) {
e2.printStackTrace();
finally{
try {
wr.close();
} catch (IOException e) {
e.printStackTrace();
}Edited by: user2525402 on Feb 9, 2010 7:14 PMThanks Tom,
Quite a useful response .-)
Leaving aside the fact that weblogic behaviour with jms wrappers and secured queues seems to not be working as the docs says...
Talking about workarounds:
Both workarounds you suggest works, but as you already noted, creating a new JNDI context just to inject credentials into the threads is overkill when high performance is needed.
I also found more information about the same issue here: http://sleeplessinslc.blogspot.com/2009/04/weblogic-jms-standalone-multi-threaded.html
And he suggest the same workaround, injecting credentials
So I tried the second approach, successfully, injecting credentials into the thread using the security API.
This way, using JMS wrappers and injecting credentials into the thread we get the best performance available, caching resource using wrappers and using credentials in a somewhat efficient way.
Now the test snippet looks like this:
import java.io.*;
import java.security.PrivilegedAction;
import java.util.Properties;
import javax.jms.*;
import javax.naming.*;
import javax.security.auth.Subject;
import javax.security.auth.login.LoginException;
import javax.servlet.http.*;
import weblogic.jndi.Environment;
import weblogic.security.auth.Authenticate;
public class JMSWrapperCredentialsTest extends HttpServlet {
QueueConnectionFactory factory = null;
Queue queue = null;
String jndiName = "java:comp/env/jms/QCF";
String queueName= "jms/ColaEntradaConsultas";
String user = "usuarioColas";
String pwd = "12345678";
String userjndi = "usuarioColas";
String pwdjndi = "12345678";
String serverT3URL="t3://127.0.0.1:7007";
public void init() {
setupJNDIResources();
private void setupJNDIResources(){
try {
Properties props = new Properties();
props.put("java.naming.factory.initial",
"weblogic.jndi.WLInitialContextFactory");
props.put("java.naming.provider.url",serverT3URL );
props.put("java.naming.security.principal", userjndi);// usr
props.put("java.naming.security.credentials", pwdjndi);// pwd
InitialContext ic = new InitialContext(props);
factory = (QueueConnectionFactory) ic.lookup(jndiName);
queue = (Queue) ic.lookup(queueName);
} catch (NamingException e) {
e.printStackTrace();
public void service(HttpServletRequest req, HttpServletResponse res) {
final HttpServletRequest fReq=req;
final HttpServletResponse fRes=res;
PrivilegedAction action = new java.security.PrivilegedAction() {
public java.lang.Object run() {
performRequest(fReq,fRes);
return null;
try {
Subject subject=createSingleSubject(serverT3URL,user,pwd);
weblogic.security.Security.runAs(subject, action);
} catch (Exception e) {
e.printStackTrace();
public void performRequest(HttpServletRequest req, HttpServletResponse res) {
res.setContentType("text/html");
Writer wr = null;
try {
wr = res.getWriter();
//Comment this out, do a lookup for each request and it will work
//setupJNDIResources();
String user = this.user;
String pwd = this.pwd;
//read users and passwords from the request in case they are present
if (req.getParameter("user") != null) {
user = req.getParameter("user");
if (req.getParameter("pwd") != null) {
pwd = req.getParameter("pwd");
wr.write("JNDI User: *" + userjndi + "* y pwd: *" + pwdjndi + "*<p>");
wr.write("Queue User: *" + user + "* y pwd: *" + pwd + "*<p>");
//Obtain a connection using user/pwd
QueueConnection conn = factory.createQueueConnection(user, pwd);
QueueSession ses = conn.createQueueSession(true,
Session.SESSION_TRANSACTED);
QueueSender sender = ses.createSender(queue);
TextMessage msg = ses.createTextMessage();
msg.setText("Hi there!");
conn.start();
sender.send(msg);
ses.commit();
sender.close();
ses.close();
conn.close();
} catch (Exception e) {
e.printStackTrace();
try {
wr.write(e.toString());
} catch (Exception e2) {
e2.printStackTrace();
finally{
try {
wr.close();
} catch (IOException e) {
e.printStackTrace();
private Subject createSingleSubject(String providerUrl, String userName, String password) {
Subject subject = new Subject();
// Weblogic env class
Environment env = new Environment();
if(providerUrl!=null)
env.setProviderUrl(providerUrl);
env.setSecurityPrincipal(userName);
env.setSecurityCredentials(password);
try {
// Weblogic Authenticate class will populate and Seal the subject
Authenticate.authenticate(env, subject);
return subject;
catch (LoginException e) {
throw new RuntimeException("Unable to Authenticate User", e);
catch (Exception e) {
throw new RuntimeException("Error authenticating user", e);
}Thanks a lot for the help -
Format of the JNDI name for lookup in DataSource
Hi
a) I have made a datasource in Weblogic 10.3 called SQL and its JNDI name as jdbc/SQLDS.
The driver was BEA'S Type 4 Driver for MS SQL Server
Now I am trying to lookup the datasource through an application. I have used the following
lines of code:
InitialContext context = new InitialContext();
DataSource ds = context.lookup("jdbc/SQLDS");
Connection conn = ds.getConnection();
The Application was a success.
I saw in some articles that you can refer to the datasource by even java:comp/env/jdbc/SQLDS,
instead of just jdbc/SQLDS. I tried both ways and I was able to run the application.
b) Then I made another datasource in Weblogic 10.3 called SQL1 and its JNDI name as jdbc/SQL1.
The driver was MS SQL Server Type 4 Driver for versions 2000, 2005
Now I am trying to lookup the datasource through an application. I have used the following
lines of code:
InitialContext context = new InitialContext();
DataSource ds = context.lookup("jdbc/SQL1");
Connection conn = ds.getConnection();
The Application was a success.
I saw in some articles that you can refer to the datasource by even java:comp/env/jdbc/SQL1,
instead of just jdbc/SQL1. I tried the first way and it didnt work. It gave me a NullPointerException
at the line Connection conn = ds.getConnection();
c)Then I made a 3rd datasource in Weblogic 10.3 called SQL2 and its JNDI name as jdbc/SQL2DS.
The driver was MS SQL Server Type 4 Driver for versions 2000, 2005
Now I am trying to lookup the datasource through an application. I have used the following
lines of code:
InitialContext context = new InitialContext();
DataSource ds = context.lookup("jdbc/SQL2DS");
Connection conn = ds.getConnection();
The Application was a success.
I saw in some articles that you can refer to the datasource by even java:comp/env/jdbc/SQL2DS,
instead of just jdbc/SQL2DS. I tried the first way and it didnt work. Again, it gave me a NullPointerException
at the line Connection conn = ds.getConnection();
I was confused why the 2nd and 3rd way didnt work . Is it becaue I used Microsoft's MS SQL Server Type 4 Driver?
I have added the jar file in the WEBLOGIC_CLASSPATH. Why is it not recognising java:comp/env/jdbc/SQL2DS ?
I would be grateful if somebody could give me ideas on this...
Thanks
NeetiTo use application scoped or indirect JNDI lookups (i.e. java:comp/env/...) you usually need to define a <resource-ref> entry in your deployment descriptor(s). Not sure what type of application you are using to test (web-app, EJB,) but for java:comp/env/ lookups to work, you need to define resource references. The fact that your first test succeeded is somewhat strange. Without the resource reference definitions, I would have expected your JNDI lookups to fail with a NamingException instead of the lookup returning NULL for the datasource.
Assuming you are doing your test from a web-app, you need to add <resource-ref> definitions to your web.xml file similar to the following:
<resource-ref>
<res-ref-name>*jdbc/SQL2DS*</res-ref-name>
<res-type>java.sql.DataSource</res-type>
<res-auth>Container</res-auth>
</resource-ref>
and then add <reference-descriptor> definitions to your weblogic.xml file similar to the following:
<reference-descriptor>
<resource-description>
<res-ref-name>*jdbc/SQL2DS*</res-ref-name>
<jndi-name>*jdbc/SQL2DS*</jndi-name>
</resource-description>
</reference-descriptor>
Once you do these steps your lookup("java:comp/env/jdbc/SQL2DS") should function properly from within your web-app. -
Hi all,
I have 3 ear projects and 1 utility project.
1- utility jar
1- EJB
1- Web UI client for ejb
1 - MDB client for ejb
i am able to compile with out errors and started the server successfully.
As i go through the application and when i look up for the ejb bean i am getting the following error.
[10/12/07 16:41:27:035 CDT] 00000021 ServiceLogger I com.ibm.ws.ffdc.IncidentStreamImpl initialize FFDC0009I: FFDC opened incident stream file C:\Program Files\ibm\SDP70\runtimes\base_v61\profiles\AppSrv02\logs\ffdc\server1_7dc27dc2_07.10.12_16.41.27_0.txt
[10/12/07 16:41:27:051 CDT] 00000021 ServiceLogger I com.ibm.ws.ffdc.IncidentStreamImpl resetIncidentStream FFDC0010I: FFDC closed incident stream file C:\Program Files\ibm\SDP70\runtimes\base_v61\profiles\AppSrv02\logs\ffdc\server1_7dc27dc2_07.10.12_16.41.27_0.txt
[10/12/07 16:41:27:066 CDT] 00000021 BeanMetaData E CNTR0075E: The user-provided class "com.bcbsmn.claims.perconf.ejb.EJSStatelessPerConfinementServiceHomeBean_fcba446f" needed by the EnterpriseBean could not be found or loaded.
[10/12/07 16:41:27:332 CDT] 00000021 ServiceLogger I com.ibm.ws.ffdc.IncidentStreamImpl open FFDC0009I: FFDC opened incident stream file C:\Program Files\ibm\SDP70\runtimes\base_v61\profiles\AppSrv02\logs\ffdc\server1_7dc27dc2_07.10.12_16.41.27_1.txt
[10/12/07 16:41:27:379 CDT] 00000021 ServiceLogger I com.ibm.ws.ffdc.IncidentStreamImpl resetIncidentStream FFDC0010I: FFDC closed incident stream file C:\Program Files\ibm\SDP70\runtimes\base_v61\profiles\AppSrv02\logs\ffdc\server1_7dc27dc2_07.10.12_16.41.27_1.txt
[10/12/07 16:41:27:691 CDT] 00000021 ServiceLogger I com.ibm.ws.ffdc.IncidentStreamImpl open FFDC0009I: FFDC opened incident stream file C:\Program Files\ibm\SDP70\runtimes\base_v61\profiles\AppSrv02\logs\ffdc\server1_7dc27dc2_07.10.12_16.41.27_2.txt
[10/12/07 16:41:27:707 CDT] 00000021 ServiceLogger I com.ibm.ws.ffdc.IncidentStreamImpl resetIncidentStream FFDC0010I: FFDC closed incident stream file C:\Program Files\ibm\SDP70\runtimes\base_v61\profiles\AppSrv02\logs\ffdc\server1_7dc27dc2_07.10.12_16.41.27_2.txt
[10/12/07 16:41:27:723 CDT] 00000021 EJBContainerI E WSVR0068E: Attempt to start EnterpriseBean PerConfinementEARProject#PerConfinementEJBProject.jar#PerConfinementService failed with exception: com.ibm.ejs.container.ContainerException: Failed to initialize BeanMetaData instance; nested exception is:
java.lang.ClassNotFoundException: com.bcbsmn.claims.perconf.ejb.EJSStatelessPerConfinementServiceHomeBean_c3c0b315
at com.ibm.ejs.container.BeanMetaData.<init>(BeanMetaData.java:1433)
at com.ibm.ws.runtime.component.EJBContainerImpl.createBeanMetaData(EJBContainerImpl.java:1956)
at com.ibm.ws.runtime.component.EJBContainerImpl.createDeferredBeanMetaData(EJBContainerImpl.java:4600)
at com.ibm.ws.runtime.component.EJBContainerImpl.access$000(EJBContainerImpl.java:435)
at com.ibm.ws.runtime.component.EJBContainerImpl$3.run(EJBContainerImpl.java:4399)
at com.ibm.ws.security.util.AccessController.doPrivileged(AccessController.java:118)
at com.ibm.ws.runtime.component.EJBContainerImpl.initializeDeferredEJB(EJBContainerImpl.java:4396)
at com.ibm.ejs.container.HomeOfHomes.getHome(HomeOfHomes.java:345)
at com.ibm.ejs.container.HomeOfHomes.internalCreateWrapper(HomeOfHomes.java:481)
at com.ibm.ejs.container.EJSContainer.createWrapper(EJSContainer.java:4278)
at com.ibm.ejs.container.WrapperManager.faultOnKey(WrapperManager.java:528)
at com.ibm.ejs.util.cache.Cache.findAndFault(Cache.java:496)
at com.ibm.ejs.container.WrapperManager.keyToObject(WrapperManager.java:481)
at com.ibm.ejs.oa.EJSOAImpl.keyToObject(EJSOAImpl.java:553)
at com.ibm.ejs.oa.EJSRootOAImpl.keyToObject(EJSRootOAImpl.java:271)
at com.ibm.rmi.corba.ObjectManager.lookupServant(ObjectManager.java:104)
at com.ibm.CORBA.iiop.ServerDelegate.getServant(ServerDelegate.java:302)
at com.ibm.rmi.iiop.ORB.lookupLocalObject(ORB.java:591)
at com.ibm.CORBA.iiop.ORB.lookupLocalObject(ORB.java:1446)
at com.ibm.rmi.iiop.CDRInputStream.newObjRef(CDRInputStream.java:1298)
at com.ibm.rmi.iiop.CDRInputStream.read_Object(CDRInputStream.java:1275)
at com.ibm.rmi.iiop.CDRInputStream.read_Object(CDRInputStream.java:1239)
at com.ibm.rmi.corba.IorURL.iorbytesToObjref(IorURL.java:107)
at com.ibm.rmi.corba.IorURL.resolve(IorURL.java:95)
at com.ibm.rmi.corba.ORB.objectURLToObject(ORB.java:3677)
at com.ibm.CORBA.iiop.ORB.objectURLToObject(ORB.java:3227)
at com.ibm.rmi.corba.ORB.string_to_object(ORB.java:3578)
at com.ibm.ws.naming.ipcos.WsnOptimizedNamingImpl.resolveUnresolvedBinding(WsnOptimizedNamingImpl.java:2154)
at com.ibm.ws.naming.ipcos.WsnOptimizedNamingImpl.resolve_binding(WsnOptimizedNamingImpl.java:1895)
at com.ibm.ws.naming.ipcos.WsnOptimizedNamingImpl.do_resolve_complete_info(WsnOptimizedNamingImpl.java:599)
at com.ibm.ws.naming.cosbase.WsnOptimizedNamingImplBase.resolve_complete_info(WsnOptimizedNamingImplBase.java:2215)
at com.ibm.WsnOptimizedNaming._NamingContextStub.resolve_complete_info(_NamingContextStub.java:536)
at com.ibm.ws.naming.jndicos.CNContextImpl.cosResolve(CNContextImpl.java:4351)
at com.ibm.ws.naming.jndicos.CNContextImpl.doLookup(CNContextImpl.java:1901)
at com.ibm.ws.naming.jndicos.CNContextImpl.doLookup(CNContextImpl.java:1862)
at com.ibm.ws.naming.jndicos.CNContextImpl.lookupExt(CNContextImpl.java:1552)
at com.ibm.ws.naming.jndicos.CNContextImpl.lookup(CNContextImpl.java:1354)
at com.ibm.ws.naming.util.WsnInitCtx.lookup(WsnInitCtx.java:172)
at javax.naming.InitialContext.lookup(InitialContext.java:363)
at com.bcbsmn.claims.perconf.managedbean.SearchBean.search(SearchBean.java:315)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:64)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:615)
at com.sun.faces.el.MethodBindingImpl.invoke(MethodBindingImpl.java:127)
at com.sun.faces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:73)
at javax.faces.component.UICommand.broadcast(UICommand.java:312)
at javax.faces.component.UIViewRoot.broadcastEvents(UIViewRoot.java:298)
at javax.faces.component.UIViewRoot.processApplication(UIViewRoot.java:412)
at com.sun.faces.lifecycle.InvokeApplicationPhase.execute(InvokeApplicationPhase.java:77)
at com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.java:220)
at com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:91)
at javax.faces.webapp.FacesServlet.service(FacesServlet.java:197)
at com.ibm.ws.webcontainer.servlet.ServletWrapper.service(ServletWrapper.java:966)
at com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:478)
at com.ibm.ws.wswebcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:463)
at com.ibm.ws.webcontainer.webapp.WebApp.handleRequest(WebApp.java:3129)
at com.ibm.ws.webcontainer.webapp.WebGroup.handleRequest(WebGroup.java:238)
at com.ibm.ws.webcontainer.WebContainer.handleRequest(WebContainer.java:811)
at com.ibm.ws.wswebcontainer.WebContainer.handleRequest(WebContainer.java:1433)
at com.ibm.ws.webcontainer.channel.WCChannelLink.ready(WCChannelLink.java:93)
at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleDiscrimination(HttpInboundLink.java:465)
at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleNewInformation(HttpInboundLink.java:394)
at com.ibm.ws.http.channel.inbound.impl.HttpICLReadCallback.complete(HttpICLReadCallback.java:102)
at com.ibm.ws.tcp.channel.impl.AioReadCompletionListener.futureCompleted(AioReadCompletionListener.java:152)
at com.ibm.io.async.AbstractAsyncFuture.invokeCallback(AbstractAsyncFuture.java:213)
at com.ibm.io.async.AbstractAsyncFuture.fireCompletionActions(AbstractAsyncFuture.java:195)
at com.ibm.io.async.AsyncFuture.completed(AsyncFuture.java:136)
at com.ibm.io.async.ResultHandler.complete(ResultHandler.java:194)
at com.ibm.io.async.ResultHandler.runEventProcessingLoop(ResultHandler.java:741)
at com.ibm.io.async.ResultHandler$2.run(ResultHandler.java:863)
at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:1510)
Caused by: java.lang.ClassNotFoundException: com.bcbsmn.claims.perconf.ejb.EJSStatelessPerConfinementServiceHomeBean_c3c0b315
at com.ibm.ws.classloader.CompoundClassLoader.findClass(CompoundClassLoader.java:472)
at com.ibm.ws.classloader.CompoundClassLoader.loadClass(CompoundClassLoader.java:373)
at java.lang.ClassLoader.loadClass(ClassLoader.java:561)
at com.ibm.ejs.container.BeanMetaData.loadExistedClass(BeanMetaData.java:3763)
at com.ibm.ejs.container.BeanMetaData.<init>(BeanMetaData.java:1329)
... 71 more
[10/12/07 16:41:27:973 CDT] 00000021 ServiceLogger I com.ibm.ws.ffdc.IncidentStreamImpl open FFDC0009I: FFDC opened incident stream file C:\Program Files\ibm\SDP70\runtimes\base_v61\profiles\AppSrv02\logs\ffdc\server1_7dc27dc2_07.10.12_16.41.27_3.txt
[10/12/07 16:41:27:988 CDT] 00000021 ServiceLogger I com.ibm.ws.ffdc.IncidentStreamImpl resetIncidentStream FFDC0010I: FFDC closed incident stream file C:\Program Files\ibm\SDP70\runtimes\base_v61\profiles\AppSrv02\logs\ffdc\server1_7dc27dc2_07.10.12_16.41.27_3.txt
[10/12/07 16:41:28:238 CDT] 00000021 ServiceLogger I com.ibm.ws.ffdc.IncidentStreamImpl open FFDC0009I: FFDC opened incident stream file C:\Program Files\ibm\SDP70\runtimes\base_v61\profiles\AppSrv02\logs\ffdc\server1_7dc27dc2_07.10.12_16.41.28_0.txt
[10/12/07 16:41:28:254 CDT] 00000021 ServiceLogger I com.ibm.ws.ffdc.IncidentStreamImpl resetIncidentStream FFDC0010I: FFDC closed incident stream file C:\Program Files\ibm\SDP70\runtimes\base_v61\profiles\AppSrv02\logs\ffdc\server1_7dc27dc2_07.10.12_16.41.28_0.txt
[10/12/07 16:41:28:504 CDT] 00000021 ServiceLogger I com.ibm.ws.ffdc.IncidentStreamImpl open FFDC0009I: FFDC opened incident stream file C:\Program Files\ibm\SDP70\runtimes\base_v61\profiles\AppSrv02\logs\ffdc\server1_7dc27dc2_07.10.12_16.41.28_1.txt
[10/12/07 16:41:28:519 CDT] 00000021 ServiceLogger I com.ibm.ws.ffdc.IncidentStreamImpl resetIncidentStream FFDC0010I: FFDC closed incident stream file C:\Program Files\ibm\SDP70\runtimes\base_v61\profiles\AppSrv02\logs\ffdc\server1_7dc27dc2_07.10.12_16.41.28_1.txt
[10/12/07 16:41:28:754 CDT] 00000021 ServiceLogger I com.ibm.ws.ffdc.IncidentStreamImpl open FFDC0009I: FFDC opened incident stream file C:\Program Files\ibm\SDP70\runtimes\base_v61\profiles\AppSrv02\logs\ffdc\server1_7dc27dc2_07.10.12_16.41.28_2.txt
[10/12/07 16:41:28:848 CDT] 00000021 ServiceLogger I com.ibm.ws.ffdc.IncidentStreamImpl resetIncidentStream FFDC0010I: FFDC closed incident stream file C:\Program Files\ibm\SDP70\runtimes\base_v61\profiles\AppSrv02\logs\ffdc\server1_7dc27dc2_07.10.12_16.41.28_2.txt
[10/12/07 16:41:29:066 CDT] 00000021 ServiceLogger I com.ibm.ws.ffdc.IncidentStreamImpl open FFDC0009I: FFDC opened incident stream file C:\Program Files\ibm\SDP70\runtimes\base_v61\profiles\AppSrv02\logs\ffdc\server1_7dc27dc2_07.10.12_16.41.29_0.txt
[10/12/07 16:41:29:113 CDT] 00000021 ServiceLogger I com.ibm.ws.ffdc.IncidentStreamImpl resetIncidentStream FFDC0010I: FFDC closed incident stream file C:\Program Files\ibm\SDP70\runtimes\base_v61\profiles\AppSrv02\logs\ffdc\server1_7dc27dc2_07.10.12_16.41.29_0.txt
[10/12/07 16:41:29:113 CDT] 00000021 Helpers W NMSV0610I: A NamingException is being thrown from a javax.naming.Context implementation. Details follow:
Context implementation: com.ibm.ws.naming.jndicos.CNContextImpl
Context method: lookupExt
Context name: BCBSMN79477Node02Cell/nodes/BCBSMN79477Node02/servers/server1
Target name: com/bcbsmn/claims/perconf/PerConfinementService
Other data: ""
Exception stack trace: javax.naming.NamingException: Error during resolve [Root exception is org.omg.CORBA.portable.UnknownException: vmcid: 0x0 minor code: 0 completed: Maybe]
at com.ibm.ws.naming.jndicos.CNContextImpl.doLookup(CNContextImpl.java:1939)
at com.ibm.ws.naming.jndicos.CNContextImpl.doLookup(CNContextImpl.java:1862)
at com.ibm.ws.naming.jndicos.CNContextImpl.lookupExt(CNContextImpl.java:1552)
at com.ibm.ws.naming.jndicos.CNContextImpl.lookup(CNContextImpl.java:1354)
at com.ibm.ws.naming.util.WsnInitCtx.lookup(WsnInitCtx.java:172)
at javax.naming.InitialContext.lookup(InitialContext.java:363)
at com.bcbsmn.claims.perconf.managedbean.SearchBean.search(SearchBean.java:315)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:64)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:615)
at com.sun.faces.el.MethodBindingImpl.invoke(MethodBindingImpl.java:127)
at com.sun.faces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:73)
at javax.faces.component.UICommand.broadcast(UICommand.java:312)
at javax.faces.component.UIViewRoot.broadcastEvents(UIViewRoot.java:298)
at javax.faces.component.UIViewRoot.processApplication(UIViewRoot.java:412)
at com.sun.faces.lifecycle.InvokeApplicationPhase.execute(InvokeApplicationPhase.java:77)
at com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.java:220)
at com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:91)
at javax.faces.webapp.FacesServlet.service(FacesServlet.java:197)
at com.ibm.ws.webcontainer.servlet.ServletWrapper.service(ServletWrapper.java:966)
at com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:478)
at com.ibm.ws.wswebcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:463)
at com.ibm.ws.webcontainer.webapp.WebApp.handleRequest(WebApp.java:3129)
at com.ibm.ws.webcontainer.webapp.WebGroup.handleRequest(WebGroup.java:238)
at com.ibm.ws.webcontainer.WebContainer.handleRequest(WebContainer.java:811)
at com.ibm.ws.wswebcontainer.WebContainer.handleRequest(WebContainer.java:1433)
at com.ibm.ws.webcontainer.channel.WCChannelLink.ready(WCChannelLink.java:93)
at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleDiscrimination(HttpInboundLink.java:465)
at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleNewInformation(HttpInboundLink.java:394)
at com.ibm.ws.http.channel.inbound.impl.HttpICLReadCallback.complete(HttpICLReadCallback.java:102)
at com.ibm.ws.tcp.channel.impl.AioReadCompletionListener.futureCompleted(AioReadCompletionListener.java:152)
at com.ibm.io.async.AbstractAsyncFuture.invokeCallback(AbstractAsyncFuture.java:213)
at com.ibm.io.async.AbstractAsyncFuture.fireCompletionActions(AbstractAsyncFuture.java:195)
at com.ibm.io.async.AsyncFuture.completed(AsyncFuture.java:136)
at com.ibm.io.async.ResultHandler.complete(ResultHandler.java:194)
at com.ibm.io.async.ResultHandler.runEventProcessingLoop(ResultHandler.java:741)
at com.ibm.io.async.ResultHandler$2.run(ResultHandler.java:863)
at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:1510)
Caused by: org.omg.CORBA.portable.UnknownException: vmcid: 0x0 minor code: 0 completed: Maybe
at com.ibm.ws.naming.ipcos.WsnOptimizedNamingImpl.resolveUnresolvedBinding(WsnOptimizedNamingImpl.java:2193)
at com.ibm.ws.naming.ipcos.WsnOptimizedNamingImpl.resolve_binding(WsnOptimizedNamingImpl.java:1895)
at com.ibm.ws.naming.ipcos.WsnOptimizedNamingImpl.do_resolve_complete_info(WsnOptimizedNamingImpl.java:599)
at com.ibm.ws.naming.cosbase.WsnOptimizedNamingImplBase.resolve_complete_info(WsnOptimizedNamingImplBase.java:2215)
at com.ibm.WsnOptimizedNaming._NamingContextStub.resolve_complete_info(_NamingContextStub.java:536)
at com.ibm.ws.naming.jndicos.CNContextImpl.cosResolve(CNContextImpl.java:4351)
at com.ibm.ws.naming.jndicos.CNContextImpl.doLookup(CNContextImpl.java:1901)
... 38 moreCan any body tell me what's wrong with it? i have seen all the stubs generated it is looking for but not able to load/recognize it? And also i need to mention other problem is that everytime i compile, deploy and start the server i am getting open failure exception and server not recognizing the ejb jar and if i close and restart the RSA server starts well.
Pls help me in solving this issue.Hi All
Two separate webapps, have different names for
Datasources, on the same host and port. Both
application work fine independently.
When we deploy both applications on the same app
server(websphere), whichever we executes first gets
its datasource from JNDI lookup and works fine, but
when we try second application it have problem in
finding its data source from JNDI lookup. If we start
this second application first, it will work fine, but
now another will have the same problem in its JNDI
lookup.
Any idea why.
Thanks
....RanvirHi Ranvir,
Do you mean you try to reach the same datasource with different names or do you try to reach different datasources over the same port?
If you try the first issue you shouldn't get any trouble. At least it works fine with JBOSS for example.
But if you try to do the latter in my oppinion you don't have a JNDI problem but a problem with socket binding: the two different databases must be contacted over different ports.
What do WebSphere's logs tell?
Best regards
Andy -
EJB 3.0 and jndi lookup (simple question)
hi all,
i am newbie on Weblogic Application Server and i have some issues,
i have weblogic application server 10.0, also i have oracle timesten in-memory database, i have configured datasource and deploy my ejb 3.0 application, but i could not done jndi lookup?
here is my example:
1. one stateless session bean :
import javax.ejb.Remote;
@Remote
public interface InsertSubscriber {
public void insertSubscriber(SubscriberT subscriberT);
} 2. here is it's implementation :
@Remote(InsertSubscriber.class)
@Stateless
public class InsertSubscriberBean implements InsertSubscriber {
@PersistenceContext(unitName = "TimesTenDS")
private EntityManager oracleManager;
public void insertSubscriber(SubscriberT subscriber)
try {
System.out.println("started");
oracleManager.persist(subscriber);
System.out.println("end");
} catch (Exception e) {
e.printStackTrace();
}3 and my test client :
public class Client {
public static void main(String[] args) {
Context ctx = null;
Hashtable ht = new Hashtable();
ht.put(Context.INITIAL_CONTEXT_FACTORY,
"weblogic.jndi.WLInitialContextFactory");
ht.put(Context.PROVIDER_URL, "t3://192.9.200.222:7001");
try {
ctx = new InitialContext(ht);
InsertSubscriber usagefasade = (InsertSubscriber) ctx
.lookup("ejb.InsertSubscriberBean");
} catch (NamingException e) {
e.printStackTrace();
} finally {
try {
ctx.close();
} catch (Exception e) {
e.printStackTrace();
}what i did incorrect ???
i got error like this : Name not fount exception
when i tried to view jndi tree on weblogic server application console i found this :
Binding Name:
TimestenExampleTimestenExample_jarInsertSubscriberBean_InsertSubscriber
Class:
test.InsertSubscriberBean_o7jk9u_InsertSubscriberImpl_1000_WLStub
Hash Code:
286
toString Results:
weblogic.rmi.internal.CollocatedRemoteRef - hostID: '2929168367193491522S::billing_domain:AdminServer', oid: '286', channel: 'null'what does it mean how i can done lookup to jndi ?
Regards,
Paata Lominadze,
Magticom LTD.
Georgia.Hi All,
I am using the weblogic cluster with session replication and EJB 2.0 with Local entity beans.
for fail-over session should be replicated to another server so we can achive the same session if 1st server fails.
Suppose i m using two managed server(server1,server2) in the cluster.I am storing the object of class ABC into session and object contains the instance of Local-EntityBean home but i put that as a transient.I have also override the readObject and write object method.
when write object is called on 1st server,readObject method should be called on second server so we will be sure that session is replicating properly.
pleaase find the code below : -
public IssuerPageBean() {
initEJB();
private void readObject(java.io.ObjectInputStream stream) throws IOException, ClassNotFoundException {
stream.defaultReadObject();
initEJB();
initializeCommonObject();
private void writeObject(java.io.ObjectOutputStream stream) throws IOException {
stream.defaultWriteObject();
private void initEJB() {
try {
ic = new InitialContext();
issuerHome = (LocalIssuerHome) ic.lookup("java:comp/env/Issuer");
} catch (NamingException e) {
e.printStackTrace();
in my case if i am calling the constructor IssuerPageBean(),it calls the initEJB() method and lookeup the entity local home properly but when readObject method is called on another server only initEJB() method is called directly and getting the exception below :
WARNING: Error during create -
javax.naming.NameNotFoundException: remaining name: env/ejb/Client
at weblogic.j2eeclient.SimpleContext.resolve(Ljavax/naming/Name;Z)Ljavax/naming/Context;(SimpleContext.java:35)
at weblogic.j2eeclient.SimpleContext.resolve(Ljavax/naming/Name;)Ljavax/naming/Context;(SimpleContext.java:39)
at weblogic.j2eeclient.SimpleContext.lookup(Ljavax/naming/Name;)Ljava/lang/Object;(SimpleContext.java:57)
at weblogic.j2eeclient.SimpleContext.lookup(Ljavax/naming/Name;)Ljava/lang/Object;(SimpleContext.java:57)
at weblogic.j2eeclient.SimpleContext.lookup(Ljava/lang/String;)Ljava/lang/Object;(SimpleContext.java:62)
at weblogic.jndi.factories.java.ReadOnlyContextWrapper.lookup(Ljava/lang/String;)Ljava/lang/Object;(ReadOnlyCont
extWrapper.java:45)
at weblogic.jndi.internal.AbstractURLContext.lookup(Ljava/lang/String;)Ljava/lang/Object;(AbstractURLContext.jav
a:130)
at javax.naming.InitialContext.lookup(Ljava/lang/String;)Ljava/lang/Object;(InitialContext.java:347)
at com.lb.equities.veda.tools.salesvault.jsp.ClientPageBean.initEJB()V(ClientPageBean.java:218)
at com.lb.equities.veda.tools.salesvault.jsp.ClientPageBean.readObject(Ljava/io/ObjectInputStream;)V(ClientPageB
ean.java:191)
at java.lang.LangAccessImpl.readObject(Ljava/lang/Class;Ljava/lang/Object;Ljava/io/ObjectInputStream;)V(Unknown
Source)
at java.io.ObjectStreamClass.invokeReadObject(Ljava/lang/Object;Ljava/io/ObjectInputStream;)V(Unknown Source)
at java.io.ObjectInputStream.readSerialData(Ljava/lang/Object;Ljava/io/ObjectStreamClass;)V(Unknown Source)
at java.io.ObjectInputStream.readOrdinaryObject(Z)Ljava/lang/Object;(Unknown Source)
at java.io.ObjectInputStream.readObject0(Z)Ljava/lang/Object;(Unknown Source)
at java.io.ObjectInputStream.readObject()Ljava/lang/Object;(Unknown Source)
at java.util.HashMap.readObject(Ljava/io/ObjectInputStream;)V(Unknown Source)
at java.lang.LangAccessImpl.readObject(Ljava/lang/Class;Ljava/lang/Object;Ljava/io/ObjectInputStream;)V(Unknown
Source)
at java.io.ObjectStreamClass.invokeReadObject(Ljava/lang/Object;Ljava/io/ObjectInputStream;)V(Unknown Source)
at java.io.ObjectInputStream.readSerialData(Ljava/lang/Object;Ljava/io/ObjectStreamClass;)V(Unknown Source)
at java.io.ObjectInputStream.readOrdinaryObject(Z)Ljava/lang/Object;(Unknown Source)
at java.io.ObjectInputStream.readObject0(Z)Ljava/lang/Object;(Unknown Source)
at java.io.ObjectInputStream.defaultReadFields(Ljava/lang/Object;Ljava/io/ObjectStreamClass;)V(Unknown Source)
at java.io.ObjectInputStream.readSerialData(Ljava/lang/Object;Ljava/io/ObjectStreamClass;)V(Unknown Source)
at java.io.ObjectInputStream.readOrdinaryObject(Z)Ljava/lang/Object;(Unknown Source)
at java.io.ObjectInputStream.readObject0(Z)Ljava/lang/Object;(Unknown Source)
at java.io.ObjectInputStream.readObject()Ljava/lang/Object;(Unknown Source)
at weblogic.common.internal.ChunkedObjectInputStream.readObject()Ljava/lang/Object;(ChunkedObjectInputStream.jav
a:120)
at weblogic.rjvm.MsgAbbrevInputStream.readObject(Ljava/lang/Class;)Ljava/lang/Object;(MsgAbbrevInputStream.java:
121)
at weblogic.cluster.replication.ReplicationManager_WLSkel.invoke(ILweblogic/rmi/spi/InboundRequest;Lweblogic/rmi
/spi/OutboundResponse;Ljava/lang/Object;)Lweblogic/rmi/spi/OutboundResponse;(Unknown Source)
at weblogic.rmi.internal.BasicServerRef.invoke(Lweblogic/rmi/extensions/server/RuntimeMethodDescriptor;Lweblogic
/rmi/spi/InboundRequest;Lweblogic/rmi/spi/OutboundResponse;)V(BasicServerRef.java:492)
Please help .
Thanks in Advance.
Edited by hforever at 03/04/2008 7:28 AM -
JNDI lookup issue in weblogic 10 server
Hi all,
I have a serious problem in getting the datasource lookup. My application uses EJB3 and JPA and it is deployed in weblogic10. I configured datasource in the domain (ex:mydomain) using weblogic 10 admin console. Now when i try to call from a client program, it is giving me javax.naming.NameNotFoundException. I use eclipse IDE to deploy the application. From the IDE, i can start the oracle 10.3 server and it automatically deploys the application into the server in mydomain. The admin console shows that the application deployed fine. And i can see the webcontent WAR file and EJB jar deployed. Coming back to the issue.... I verified user_projects\domains\mydomain\config\jdbc\datasource-jdbc.xml and user_projects\domains\mydomain\config\config.xml file enteries. My entries are present in those files.
When i start the server i am getting below error...
<< Stacktrace >>
javax.naming.NameNotFoundException: While trying to look up jdbc in /app.; remaining name 'jdbc'
at weblogic.jndi.internal.BasicNamingNode.newNameNotFoundException(BasicNamingNode.java:1139)
at weblogic.jndi.internal.ApplicationNamingNode.lookup(ApplicationNamingNode.java:144)
at weblogic.jndi.internal.WLEventContextImpl.lookup(WLEventContextImpl.java:254)
at weblogic.jndi.internal.WLContextImpl.lookup(WLContextImpl.java:380)
at weblogic.deployment.PersistenceUnitInfoImpl.lookUpAppScopedDataSource(PersistenceUnitInfoImpl.java:529)
at weblogic.deployment.PersistenceUnitInfoImpl.reconfig(PersistenceUnitInfoImpl.java:549)
at weblogic.ejb.container.deployer.EJBModule.reconfigPersistenceUnits(EJBModule.java:529)
at weblogic.ejb.container.deployer.EJBModule.activate(EJBModule.java:515)
at weblogic.application.internal.flow.ModuleListenerInvoker.activate(ModuleListenerInvoker.java:107)
at weblogic.application.internal.flow.DeploymentCallbackFlow$2.next(DeploymentCallbackFlow.java:411)
at weblogic.application.utils.StateMachineDriver.nextState(StateMachineDriver.java:37)
at weblogic.application.internal.flow.DeploymentCallbackFlow.activate(DeploymentCallbackFlow.java:74)
at weblogic.application.internal.flow.DeploymentCallbackFlow.activate(DeploymentCallbackFlow.java:66)
at weblogic.application.internal.BaseDeployment$2.next(BaseDeployment.java:635)
at weblogic.application.utils.StateMachineDriver.nextState(StateMachineDriver.java:37)
at weblogic.application.internal.BaseDeployment.activate(BaseDeployment.java:212)
at weblogic.application.internal.EarDeployment.activate(EarDeployment.java:16)
at weblogic.application.internal.DeploymentStateChecker.activate(DeploymentStateChecker.java:162)
at weblogic.deploy.internal.targetserver.AppContainerInvoker.activate(AppContainerInvoker.java:79)
at weblogic.deploy.internal.targetserver.operations.AbstractOperation.activate(AbstractOperation.java:569)
at weblogic.deploy.internal.targetserver.operations.ActivateOperation.activateDeployment(ActivateOperation.java:140)
at weblogic.deploy.internal.targetserver.operations.ActivateOperation.doCommit(ActivateOperation.java:106)
at weblogic.deploy.internal.targetserver.operations.AbstractOperation.commit(AbstractOperation.java:323)
at weblogic.deploy.internal.targetserver.DeploymentManager.handleDeploymentCommit(DeploymentManager.java:820)
at weblogic.deploy.internal.targetserver.DeploymentManager.activateDeploymentList(DeploymentManager.java:1227)
at weblogic.deploy.internal.targetserver.DeploymentManager.handleCommit(DeploymentManager.java:436)
at weblogic.deploy.internal.targetserver.DeploymentServiceDispatcher.commit(DeploymentServiceDispatcher.java:163)
at weblogic.deploy.service.internal.targetserver.DeploymentReceiverCallbackDeliverer.doCommitCallback(DeploymentReceiverCallbackDeliverer.java:181)
at weblogic.deploy.service.internal.targetserver.DeploymentReceiverCallbackDeliverer.access$100(DeploymentReceiverCallbackDeliverer.java:12)
at weblogic.deploy.service.internal.targetserver.DeploymentReceiverCallbackDeliverer$2.run(DeploymentReceiverCallbackDeliverer.java:67)
at weblogic.work.SelfTuningWorkManagerImpl$WorkAdapterImpl.run(SelfTuningWorkManagerImpl.java:516)
at weblogic.work.ExecuteThread.execute(ExecuteThread.java:201)
at weblogic.work.ExecuteThread.run(ExecuteThread.java:173)
<< Client program snippet >>
Hashtable ht = new Hashtable();
ht.put(Context.INITIAL_CONTEXT_FACTORY,"weblogic.jndi.WLInitialContextFactory");
ht.put(Context.PROVIDER_URL, "t3://10.237.76.132:7001");
InitialContext ctx = null;
ctx = new InitialContext(ht);
Object obj = (Object)ctx.lookup(EmployeeBean.RemoteJNDIName);
EmployeeRemote empRemote = (EmployeeRemote)PortableRemoteObject.narrow(obj,com.acs.test.emp.EmployeeRemote.class);
List empList = empRemote.getEmployeeDetails(1);
System.out.println("SUCCESS"+empList.size());
<< Persistence.xml >>
<?xml version="1.0" encoding="UTF-8"?>
<!-- Persistence deployment descriptor for dev profile -->
<persistence xmlns="http://java.sun.com/xml/ns/persistence"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd"
version="1.0">
<persistence-unit name="cmsepool">
<jta-data-source>java:/mydatasource</jta-data-source>
<class>com.acs.test.emp.EmployeeVO</class>
<properties>
<property name="hibernate.dialect" value="org.hibernate.dialect.HSQLDialect"/>
<property name="hibernate.transaction.manager_lookup_class" value="org.hibernate.transaction.WeblogicTransactionManagerLookup"/>
</properties>
</persistence-unit>
</persistence>Make sure that this Datasource you created is Targetted to Admin Server and full Cluster (incase of cluster domain). From Admin Console, select your datasource and check for the Targets tab. Since its JNDI lookup error, most probably it may not be deployed properly.
HTH
Ravi Jegga -
JNDI Lookup in OC4J *AND* Tomcat 5 (not either/or)
I've been struggling to get a web application to deploy and run correctly on Tomcat 5.x. I couldn't ADF to look up the Datasource I'd set up in the Tomcat configs. After reading this forum post:
Problem deploying BC4J Toy Store app on Tomcat 4
I was able to run my test app successfully on Tomcat by prepending 'java:comp/env/' to the JNDI name of my Datasource in bc4j.xcfg. Unfortunately, specifying the JNDI name in this way breaks the JNDI lookup in the embedded OC4J container. The impression I got from the above forum post was that OC4J should be able to look up the data source when the name is specified as either jndi/myDataSource or java:comp/env/jndi/myDataSource. I can only get it to work with the former.
Is there a way to specify the JNDI name of a datasource in bc4j.xcfg such that both Tomcat AND the embedded OC4J container within JDeveloper will be able to look it up?
Thanks,
-MattTo answer my own question, a fairly straight-forward way of achieving this is to use two configurations for the application module: one for testing locally (the supplied configuration), and another one for deployment that is a copy of the first except for the JNDI name. I can switch between the configurations via the Databindings depending on whether I want to test locally or deploy to Tomcat.
This is certainly a useable solution, but I'm bothered by the fact that I need to reference the JNDI name in two different ways. Shouldn't this be container-independent?
-Matt -
JNDI lookup for Crystal Reports at runtime
How to run a rpt to fetch data from database connection defined in Tomcat's JNDI resources ? We are using JDBC(JNDI) Data source while designing the report in the Crystal Report designer and we want to use 'Connection Name' at runtime for jndi lookup to Tomcats JNDI resources.
Hi,
Thanks, this helped in resolving the JNDI lookup problem. But we are not having an issue in connecting to DS as it fails with error "Unsupported JNDI Object".
Tried suggestions on this link: "http://www.theserverside.com/discussions/thread.tss?thread_id=37430", but no luck.
Here are the configuration files:
context.xml:
<Context>
<Resource name="jdbc/remedy" auth="Container" type="javax.sql.DataSource" driverClassName="oracle.jdbc.OracleDriver" url="jdbc:oracle:thin:@10.76.85.68:1521:dtv" maxActive="20" maxIdle="10" maxWait="-1" />
</Context>
web.xml:
<resource-ref>
<description>DB Connection</description>
<res-ref-name>jdbc/remedy</res-ref-name>
<res-type>javax.sql.DataSource</res-type>
<res-auth>Container</res-auth>
</resource-ref>
Log:
2009-10-30 06:38:05,804 DEBUG [com.crystaldecisions.reports.formatter.a.c] - Export Supervisor: number of destination exporters:1
2009-10-30 06:38:05,804 DEBUG [com.crystaldecisions.reports.formatter.a.c] - Export Supervisor: number of format exporters:4
2009-10-30 06:38:05,865 INFO [com.businessobjects.reports.sdk.JRCCommunicationAdapter] - JRCAgent1 received request: fetchReportPageRequest
2009-10-30 06:38:05,865 INFO [com.businessobjects.reports.sdk.JRCCommunicationAdapter] - JRCAgent1 attempting to acquire license
2009-10-30 06:38:05,865 INFO [com.businessobjects.reports.sdk.JRCCommunicationAdapter] - JRCAgent1 successfully acquired license
2009-10-30 06:38:05,867 DEBUG [com.businessobjects.reports.sdk.JRCCommunicationAdapter] - Requesting page 1
2009-10-30 06:38:05,879 INFO [com.crystaldecisions.reports.queryengine.driverImpl] - Logon: Connecting to database using local JNDI server ...
2009-10-30 06:38:05,888 DEBUG [com.crystaldecisions.reports.reportdefinition.datainterface] - Failed to open connection (Connection: databaseType=JDBC (JNDI) serverName=jdbc:oracle:thin:@10.76.85.68:1521:dtv state=closed databaseDriverName=crdb_jdbc.dll).
com.crystaldecisions.reports.queryengine.al: Unsupported JNDI Object (remedy)
at com.crystaldecisions.reports.queryengine.driverImpl.o.if(Unknown Source)
at com.crystaldecisions.reports.queryengine.av.new(Unknown Source)
at com.crystaldecisions.reports.queryengine.av.byte(Unknown Source)
at com.crystaldecisions.reports.reportdefinition.datainterface.b.a(Unknown Source)
at com.crystaldecisions.reports.reportdefinition.datainterface.b.a(Unknown Source)
at com.crystaldecisions.reports.reportdefinition.datainterface.b.a(Unknown Source)
at com.crystaldecisions.reports.reportdefinition.datainterface.b.if(Unknown Source)
at com.crystaldecisions.reports.reportdefinition.datainterface.j.a(Unknown Source)
at com.businessobjects.reports.sdk.b.i.if(Unknown Source)
at com.businessobjects.reports.sdk.b.i.a(Unknown Source)
at com.businessobjects.reports.sdk.b.i.byte(Unknown Source)
at com.businessobjects.reports.sdk.JRCCommunicationAdapter.request(Unknown Source)
at com.crystaldecisions.proxy.remoteagent.y.a(Unknown Source)
at com.crystaldecisions.proxy.remoteagent.r.a(Unknown Source)
at com.crystaldecisions.sdk.occa.report.application.cf.a(Unknown Source)
at com.crystaldecisions.sdk.occa.report.application.ReportSource.a(Unknown Source)
at com.crystaldecisions.sdk.occa.report.application.ReportSource.getPage(Unknown Source)
at com.crystaldecisions.sdk.occa.report.application.AdvancedReportSource.getPage(Unknown Source)
at com.crystaldecisions.sdk.occa.report.application.NonDCPAdvancedReportSource.getPage(Unknown Source)
at com.crystaldecisions.report.web.event.ac.a(Unknown Source)
at com.crystaldecisions.report.web.event.ac.a(Unknown Source)
at com.crystaldecisions.report.web.event.b2.a(Unknown Source)
at com.crystaldecisions.report.web.event.b7.broadcast(Unknown Source)
at com.crystaldecisions.report.web.event.av.a(Unknown Source)
at com.crystaldecisions.report.web.WorkflowController.do(Unknown Source)
Edited by: MuralidharS on Oct 30, 2009 8:46 AM -
Weblogic JNDI lookup in Applet
Hi
We are facing problem in JNDI lookup inside the applet
here is the scenario
We have two weblogic servers(port 7001)
one server is main server where the Applet1 , weblogic.jar and app.htm
are in C:\bea\wlserver6.0sp1\config\mydomain\applications\DefaultWebApp_myserver
and another is proxy server where HTTPProxyServlet is running and one
web.xml file ( wall these files are provided by weblogic and the port
of proxy server is 448)
Both the servers are running on different machines
and when we run the client browser and put the folloing url
http://proxyServer IP Address:448/app.htm
we get the following exception
Java(TM) Plug-in: Version 1.3.0-C
Using JRE version 1.3.0 Java HotSpot(TM) Client VM
User home directory = C:\Documents and Settings\kkumar
Proxy Configuration: no proxy
JAR cache enabled.
In Init.1..:
In Init.after ..doClassLoaderWorkaround
In Init.after setText:
In Init.before initjms:
In initjms begin
In initjms hostName...:10.1.10.211
In initjms before initialcontext...:
In initjms after initialcontext...:
javax.naming.ConfigurationException. Root exception is
java.rmi.MarshalException: failed to marshal public abstract
java.lang.Object
weblogic.jndi.internal.NamingNode.lookup(java.lang.String,java.util.Hashtable)
throws javax.naming.NamingException,java.rmi.RemoteException; nested
exception is:
java.io.NotSerializableException: javax.naming.InitialContext
java.io.NotSerializableException: javax.naming.InitialContext
at java.io.ObjectOutputStream.outputObject(Unknown Source)
at java.io.ObjectOutputStream.writeObject(Unknown Source)
at java.io.ObjectOutputStream.outputClassFields(Unknown Source)
at java.io.ObjectOutputStream.defaultWriteObject(Unknown Source)
at java.io.ObjectOutputStream.outputObject(Unknown Source)
at java.io.ObjectOutputStream.writeObject(Unknown Source)
at java.util.Hashtable.writeObject(Unknown Source)
at java.lang.reflect.Method.invoke(Native Method)
at java.io.ObjectOutputStream.invokeObjectWriter(Unknown Source)
at java.io.ObjectOutputStream.outputObject(Unknown Source)
at java.io.ObjectOutputStream.writeObject(Unknown Source)
at
weblogic.common.internal.ChunkedObjectOutputStream.writeObject(ChunkedObjectOutputStream.java:102)
at
weblogic.common.internal.ChunkedObjectOutputStream.writeObject(ChunkedObjectOutputStream.java:108)
at weblogic.rmi.internal.ObjectIO.writeObject(ObjectIO.java:19)
at
weblogic.rmi.internal.BasicRemoteRef.marshalArgs(BasicRemoteRef.java:121)
at
weblogic.rmi.cluster.ReplicaAwareRemoteRef.invoke(ReplicaAwareRemoteRef.java:246)
at
weblogic.rmi.cluster.ReplicaAwareRemoteRef.invoke(ReplicaAwareRemoteRef.java:225)
at
weblogic.jndi.internal.ServerNamingNode_WLStub.lookup(ServerNamingNode_WLStub.java:121)
at weblogic.jndi.internal.WLContextImpl.lookup(WLContextImpl.java:323)
at javax.naming.InitialContext.lookup(Unknown Source)
at Applet1.initJMS(Applet1.java:128)
at Applet1.init(Applet1.java:46)
at sun.applet.AppletPanel.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
Initialization failed
In Init.end of initjms:
the files are here
app.htm
<OBJECT classid="clsid:8AD9C840-044E-11D1-B3E9-00805F499D93"
width="650" height="300" align="baseline"
codebase="http://java.sun.com/products/plugin/1.2.2/jinstall-1_2_2-win.cab#Version=1,2,2,0"
>
<PARAM NAME="code" VALUE="Applet1">
<PARAM NAME="codebase" VALUE=".">
<PARAM NAME="AppletName" VALUE="Applet1">
<PARAM NAME="archive" VALUE="weblogic.jar">
<PARAM NAME="MAYSCRIPT" VALUE="true">
<PARAM NAME="type"
VALUE="application/x-java-applet;version=1.2.2">
<PARAM NAME="model" VALUE="models/HyaluronicAcid.xyz">
<PARAM NAME="scriptable" VALUE="true">
<!--
<COMMENT>
<EMBED type="application/x-java-applet;version=1.2.2" width="650"
height="300" align="baseline"
code="ANZPopupApplet.class" codebase="../"
model="models/HyaluronicAcid.xyz"
pluginspage="http://java.sun.com/products/plugin/1.2/plugin-install.html"
MAYSCRIPT="true">
<NOEMBED>
</COMMENT>
-->
No JDK 1.2 support for APPLET!!
</NOEMBED>
</EMBED>
</OBJECT>
</html>
Applet1.java
import java.awt.*;
import java.applet.*;
import java.net.*;
import java.util.*;
import javax.naming.*;
import javax.jms.*;
import java.lang.reflect.*;
public class Applet1 extends Applet implements MessageListener {
private boolean started = false;
// JMS Stuff
private InitialContext jmsContext = null;
private QueueConnectionFactory jmsConnFactory = null;
private QueueConnection jmsConnection = null;
private Queue jmsQueue = null;
private QueueSession jmsSession = null;
private QueueSender jmsSender = null;
private QueueReceiver jmsReceiver = null;
// init - called to inform this applet that it has been
// loaded into the system
public void init() {
//{{INIT_CONTROLS
System.out.println("In Init.1..:");
//doClassLoaderWorkaround();
System.out.println("In Init.after ..doClassLoaderWorkaround");
setLayout(null);
setSize(426,266);
jmslabel.setText("JMS Applet");
System.out.println("In Init.after setText:");
add(jmslabel);
jmslabel.setBounds(144,12,148,24);
textArea1.setEnabled(false);
add(textArea1);
textArea1.setBounds(24,36,375,100);
jmsleaveButton.setLabel("Leave");
add(jmsleaveButton);
jmsleaveButton.setBackground(java.awt.Color.lightGray);
jmsleaveButton.setBounds(312,240,78,20);
add(jmsMessageField);
jmsMessageField.setBounds(24,168,367,38);
System.out.println("In Init.before initjms:");
initJMS();
System.out.println("In Init.end of initjms:");
//{{DECLARE_CONTROLS
java.awt.Label jmslabel = new java.awt.Label();
java.awt.TextArea textArea1 = new java.awt.TextArea();
java.awt.Button jmsleaveButton = new java.awt.Button();
java.awt.TextField jmsMessageField = new java.awt.TextField();
// getAppletInfo - Returns information about this applet.
public String getAppletInfo() {
return "JMS Applet\r\n";
// destroy - called to inform this applet that it is being
// reclaimed and that it should destroy any resources that
// it has allocated.
public void destroy() {
try {
if(started) {
if (jmsConnection != null) {
jmsConnection.stop();
jmsConnection = null;
started = false;
stop();
catch(Exception e) {
// start - called to inform this applet that it should start its
execution
public void start() {
if(!started) {
started = true;
// stop - Called to inform this applet that it should stop its
execution
public void stop() {
textArea1.setEnabled(false);
jmsMessageField.setEnabled(false);
// action - handles entering message, Leave button clicked
public boolean action(Event evt, Object obj) {
System.out.println("In action begin:");
if(evt.id == Event.ACTION_EVENT) {
if(obj.equals(jmsMessageField.getText())) {
System.out.println("In action before sendData:");
sendData(jmsMessageField.getText());
System.out.println("In action after sendData:");
jmsMessageField.setText("");
return true;
if(obj.equals(jmsleaveButton.getLabel())) {
destroy();
return true;
// initJMS - initialize all of the JMS stuff
private void initJMS() {
try {
System.out.println("In initjms begin");
String hostName = this.getCodeBase().getHost();
System.out.println("In initjms hostName...:"+hostName);
Hashtable env = new Hashtable();
env.put(Context.APPLET,this);
env.put(Context.PROVIDER_URL,
"t3://" + hostName + ":448");
env.put(Context.INITIAL_CONTEXT_FACTORY,
"weblogic.jndi.WLInitialContextFactory");
System.out.println("In initjms before initialcontext...:");
jmsContext = new InitialContext(env);
System.out.println("In initjms after initialcontext...:");
jmsConnFactory
=(QueueConnectionFactory)jmsContext.lookup("javax.jms.QueueConnectionFactory");
System.out.println("In initjms after initialcontext..lookup.:");
jmsConnection = jmsConnFactory.createQueueConnection();
System.out.println("In initjms after initialcontext..lookup1.:");
jmsSession = jmsConnection.createQueueSession(false,Session.AUTO_ACKNOWLEDGE);
System.out.println("In initjms before lookup...:");
jmsQueue =(Queue)jmsContext.lookup("jms.queue.TestQueue1");
jmsConnection.start();
jmsSender = jmsSession.createSender(jmsQueue);
jmsReceiver = jmsSession.createReceiver(jmsQueue);
jmsReceiver.setMessageListener(this);
System.out.println("In initjms before setMessageListener...end of the
const:");
catch(Exception e) {
e.printStackTrace();
System.out.println("Initialization failed");
// sendData - sends a message
void sendData(String data) {
try {
System.out.println("In sendData before createTextMessage:");
TextMessage message = jmsSession.createTextMessage();
message.setText(data);
jmsSender.send(message);
System.out.println("In sendData end data:"+data);
catch(Exception e) {
System.out.println("Failed to send message");
// onMessage - asynchronously receives a message
public void onMessage(Message message) {
String data;
try {
System.out.println("In onMessage:");
data = ((TextMessage)message).getText();
System.out.println("In onMessage data:"+data);
textArea1.append(data + "\n");
repaint();
System.out.println("In onMessage end:");
catch(Exception e) {
System.out.println("Failed to receive message");
private void doClassLoaderWorkaround(){
boolean didit = false;
// Get the ClassLoader of this applet:
ClassLoader cloader = this.getClass().getClassLoader();
if (cloader == null){
System.out.println("### getClassLoader() returned null");
else
// We might call this handy utility routine:
// boolean didit =
Thread.currentThread().setContextClassLoader(cloader);
Method setContextClassLoaderMeth = null;
try {
Method [] allMethods = Thread.class.getMethods();
for ( int i = 0; i < allMethods.length; i++ ) {
if (allMethods.getName().equals("setContextClassLoader")) {
setContextClassLoaderMeth = allMethods[i];
break;
catch(Exception e) {
System.out.println("---Exception " + e);
// but we don't because we need more visibility about what goes
wrong.
// Rather, reproduce that logic here, with extra error messages:
//Method setContextClassLoaderMeth = null;
try{
// Class params = ClassLoader.class ;
// setContextClassLoaderMeth =
//Thread.class.getMethod("setContextClassLoader", params);
catch (NoSuchMethodException ne) {
setContextClassLoaderMeth = null;
System.out.println("--- This java version does not have the
method 'setContextClassLoader'. Not a problem.");
return;
catch (Exception ae){
setContextClassLoaderMeth = null;
System.out.println("### Thread.class.getMethod() threw
unexpected exception: " + ae.getMessage());
if (setContextClassLoaderMeth != null){
Object[] args = { cloader };
try{
setContextClassLoaderMeth.invoke(Thread.currentThread(),
args);
didit = true;
catch (InvocationTargetException ite){
Throwable be = ite.getTargetException();
System.out.println("### Thread.setContextClassLoader() failed:
InvocationTargetException: " + be.getMessage());
catch (Exception ie){
System.out.println("### Thread.setContextClassLoader() threw
unexpected exception: " + ie.getMessage());
if (didit){
System.out.println("--- Succeeded in setting the
ContextClassLoader of this thread to be this applet's own
ClassLoader");
else{
System.out.println("### Could not set ContextClassLoader,
additional threads may not be able");
System.out.println("### to get a JNDI Context in java 122 or
greater.");
any clue or thought. please help
regards
mohanIt looks like the object that you have placed into the JNDO tree is not serializable or doesnt implement exernalizable!
java.io.NotSerializableException
0rrc
On 26 Jul 2001 16:10:35 -0700, [email protected] (Mohan Raj) wrote:
Hi
We are facing problem in JNDI lookup inside the applet
here is the scenario
We have two weblogic servers(port 7001)
one server is main server where the Applet1 , weblogic.jar and app.htm
are in C:\bea\wlserver6.0sp1\config\mydomain\applications\DefaultWebApp_myserver
and another is proxy server where HTTPProxyServlet is running and one
web.xml file ( wall these files are provided by weblogic and the port
of proxy server is 448)
Both the servers are running on different machines
and when we run the client browser and put the folloing url
http://proxyServer IP Address:448/app.htm
we get the following exception
Java(TM) Plug-in: Version 1.3.0-C
Using JRE version 1.3.0 Java HotSpot(TM) Client VM
User home directory = C:\Documents and Settings\kkumar
Proxy Configuration: no proxy
JAR cache enabled.
In Init.1..:
In Init.after ..doClassLoaderWorkaround
In Init.after setText:
In Init.before initjms:
In initjms begin
In initjms hostName...:10.1.10.211
In initjms before initialcontext...:
In initjms after initialcontext...:
javax.naming.ConfigurationException. Root exception is
java.rmi.MarshalException: failed to marshal public abstract
java.lang.Object
weblogic.jndi.internal.NamingNode.lookup(java.lang.String,java.util.Hashtable)
throws javax.naming.NamingException,java.rmi.RemoteException; nested
exception is:
java.io.NotSerializableException: javax.naming.InitialContext
java.io.NotSerializableException: javax.naming.InitialContext
at java.io.ObjectOutputStream.outputObject(Unknown Source)
at java.io.ObjectOutputStream.writeObject(Unknown Source)
at java.io.ObjectOutputStream.outputClassFields(Unknown Source)
at java.io.ObjectOutputStream.defaultWriteObject(Unknown Source)
at java.io.ObjectOutputStream.outputObject(Unknown Source)
at java.io.ObjectOutputStream.writeObject(Unknown Source)
at java.util.Hashtable.writeObject(Unknown Source)
at java.lang.reflect.Method.invoke(Native Method)
at java.io.ObjectOutputStream.invokeObjectWriter(Unknown Source)
at java.io.ObjectOutputStream.outputObject(Unknown Source)
at java.io.ObjectOutputStream.writeObject(Unknown Source)
at
weblogic.common.internal.ChunkedObjectOutputStream.writeObject(ChunkedObjectOutputStream.java:102)
at
weblogic.common.internal.ChunkedObjectOutputStream.writeObject(ChunkedObjectOutputStream.java:108)
at weblogic.rmi.internal.ObjectIO.writeObject(ObjectIO.java:19)
at
weblogic.rmi.internal.BasicRemoteRef.marshalArgs(BasicRemoteRef.java:121)
at
weblogic.rmi.cluster.ReplicaAwareRemoteRef.invoke(ReplicaAwareRemoteRef.java:246)
at
weblogic.rmi.cluster.ReplicaAwareRemoteRef.invoke(ReplicaAwareRemoteRef.java:225)
at
weblogic.jndi.internal.ServerNamingNode_WLStub.lookup(ServerNamingNode_WLStub.java:121)
at weblogic.jndi.internal.WLContextImpl.lookup(WLContextImpl.java:323)
at javax.naming.InitialContext.lookup(Unknown Source)
at Applet1.initJMS(Applet1.java:128)
at Applet1.init(Applet1.java:46)
at sun.applet.AppletPanel.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
Initialization failed
In Init.end of initjms:
the files are here
app.htm
<OBJECT classid="clsid:8AD9C840-044E-11D1-B3E9-00805F499D93"
width="650" height="300" align="baseline"
codebase="http://java.sun.com/products/plugin/1.2.2/jinstall-1_2_2-win.cab#Version=1,2,2,0"
>
<PARAM NAME="code" VALUE="Applet1">
<PARAM NAME="codebase" VALUE=".">
<PARAM NAME="AppletName" VALUE="Applet1">
<PARAM NAME="archive" VALUE="weblogic.jar">
<PARAM NAME="MAYSCRIPT" VALUE="true">
<PARAM NAME="type"
VALUE="application/x-java-applet;version=1.2.2">
<PARAM NAME="model" VALUE="models/HyaluronicAcid.xyz">
<PARAM NAME="scriptable" VALUE="true">
<!--
<COMMENT>
<EMBED type="application/x-java-applet;version=1.2.2" width="650"
height="300" align="baseline"
code="ANZPopupApplet.class" codebase="../"
model="models/HyaluronicAcid.xyz"
pluginspage="http://java.sun.com/products/plugin/1.2/plugin-install.html"
MAYSCRIPT="true">
<NOEMBED>
</COMMENT>
-->
No JDK 1.2 support for APPLET!!
</NOEMBED>
</EMBED>
</OBJECT>
</html>
Applet1.java
import java.awt.*;
import java.applet.*;
import java.net.*;
import java.util.*;
import javax.naming.*;
import javax.jms.*;
import java.lang.reflect.*;
public class Applet1 extends Applet implements MessageListener {
private boolean started = false;
// JMS Stuff
private InitialContext jmsContext = null;
private QueueConnectionFactory jmsConnFactory = null;
private QueueConnection jmsConnection = null;
private Queue jmsQueue = null;
private QueueSession jmsSession = null;
private QueueSender jmsSender = null;
private QueueReceiver jmsReceiver = null;
// init - called to inform this applet that it has been
// loaded into the system
public void init() {
//{{INIT_CONTROLS
System.out.println("In Init.1..:");
//doClassLoaderWorkaround();
System.out.println("In Init.after ..doClassLoaderWorkaround");
setLayout(null);
setSize(426,266);
jmslabel.setText("JMS Applet");
System.out.println("In Init.after setText:");
add(jmslabel);
jmslabel.setBounds(144,12,148,24);
textArea1.setEnabled(false);
add(textArea1);
textArea1.setBounds(24,36,375,100);
jmsleaveButton.setLabel("Leave");
add(jmsleaveButton);
jmsleaveButton.setBackground(java.awt.Color.lightGray);
jmsleaveButton.setBounds(312,240,78,20);
add(jmsMessageField);
jmsMessageField.setBounds(24,168,367,38);
System.out.println("In Init.before initjms:");
initJMS();
System.out.println("In Init.end of initjms:");
//{{DECLARE_CONTROLS
java.awt.Label jmslabel = new java.awt.Label();
java.awt.TextArea textArea1 = new java.awt.TextArea();
java.awt.Button jmsleaveButton = new java.awt.Button();
java.awt.TextField jmsMessageField = new java.awt.TextField();
// getAppletInfo - Returns information about this applet.
public String getAppletInfo() {
return "JMS Applet\r\n";
// destroy - called to inform this applet that it is being
// reclaimed and that it should destroy any resources that
// it has allocated.
public void destroy() {
try {
if(started) {
if (jmsConnection != null) {
jmsConnection.stop();
jmsConnection = null;
started = false;
stop();
catch(Exception e) {
// start - called to inform this applet that it should start its
execution
public void start() {
if(!started) {
started = true;
// stop - Called to inform this applet that it should stop its
execution
public void stop() {
textArea1.setEnabled(false);
jmsMessageField.setEnabled(false);
// action - handles entering message, Leave button clicked
public boolean action(Event evt, Object obj) {
System.out.println("In action begin:");
if(evt.id == Event.ACTION_EVENT) {
if(obj.equals(jmsMessageField.getText())) {
System.out.println("In action before sendData:");
sendData(jmsMessageField.getText());
System.out.println("In action after sendData:");
jmsMessageField.setText("");
return true;
if(obj.equals(jmsleaveButton.getLabel())) {
destroy();
return true;
// initJMS - initialize all of the JMS stuff
private void initJMS() {
try {
System.out.println("In initjms begin");
String hostName = this.getCodeBase().getHost();
System.out.println("In initjms hostName...:"+hostName);
Hashtable env = new Hashtable();
env.put(Context.APPLET,this);
env.put(Context.PROVIDER_URL,
"t3://" + hostName + ":448");
env.put(Context.INITIAL_CONTEXT_FACTORY,
"weblogic.jndi.WLInitialContextFactory");
System.out.println("In initjms before initialcontext...:");
jmsContext = new InitialContext(env);
System.out.println("In initjms after initialcontext...:");
jmsConnFactory
=(QueueConnectionFactory)jmsContext.lookup("javax.jms.QueueConnectionFactory");
System.out.println("In initjms after initialcontext..lookup.:");
jmsConnection = jmsConnFactory.createQueueConnection();
System.out.println("In initjms after initialcontext..lookup1.:");
jmsSession = jmsConnection.createQueueSession(false,Session.AUTO_ACKNOWLEDGE);
System.out.println("In initjms before lookup...:");
jmsQueue =(Queue)jmsContext.lookup("jms.queue.TestQueue1");
jmsConnection.start();
jmsSender = jmsSession.createSender(jmsQueue);
jmsReceiver = jmsSession.createReceiver(jmsQueue);
jmsReceiver.setMessageListener(this);
System.out.println("In initjms before setMessageListener...end of the
const:");
catch(Exception e) {
e.printStackTrace();
System.out.println("Initialization failed");
// sendData - sends a message
void sendData(String data) {
try {
System.out.println("In sendData before createTextMessage:");
TextMessage message = jmsSession.createTextMessage();
message.setText(data);
jmsSender.send(message);
System.out.println("In sendData end data:"+data);
catch(Exception e) {
System.out.println("Failed to send message");
// onMessage - asynchronously receives a message
public void onMessage(Message message) {
String data;
try {
System.out.println("In onMessage:");
data = ((TextMessage)message).getText();
System.out.println("In onMessage data:"+data);
textArea1.append(data + "\n");
repaint();
System.out.println("In onMessage end:");
catch(Exception e) {
System.out.println("Failed to receive message");
private void doClassLoaderWorkaround(){
boolean didit = false;
// Get the ClassLoader of this applet:
ClassLoader cloader = this.getClass().getClassLoader();
if (cloader == null){
System.out.println("### getClassLoader() returned null");
else
// We might call this handy utility routine:
// boolean didit =
Thread.currentThread().setContextClassLoader(cloader);
Method setContextClassLoaderMeth = null;
try {
Method [] allMethods = Thread.class.getMethods();
for ( int i = 0; i < allMethods.length; i++ ) {
if (allMethods.getName().equals("setContextClassLoader")) {
setContextClassLoaderMeth = allMethods[i];
break;
catch(Exception e) {
System.out.println("---Exception " + e);
// but we don't because we need more visibility about what goes
wrong.
// Rather, reproduce that logic here, with extra error messages:
//Method setContextClassLoaderMeth = null;
try{
// Class params = ClassLoader.class ;
// setContextClassLoaderMeth =
//Thread.class.getMethod("setContextClassLoader", params);
catch (NoSuchMethodException ne) {
setContextClassLoaderMeth = null;
System.out.println("--- This java version does not have the
method 'setContextClassLoader'. Not a problem.");
return;
catch (Exception ae){
setContextClassLoaderMeth = null;
System.out.println("### Thread.class.getMethod() threw
unexpected exception: " + ae.getMessage());
if (setContextClassLoaderMeth != null){
Object[] args = { cloader };
try{
setContextClassLoaderMeth.invoke(Thread.currentThread(),
args);
didit = true;
catch (InvocationTargetException ite){
Throwable be = ite.getTargetException();
System.out.println("### Thread.setContextClassLoader() failed:
InvocationTargetException: " + be.getMessage());
catch (Exception ie){
System.out.println("### Thread.setContextClassLoader() threw
unexpected exception: " + ie.getMessage());
if (didit){
System.out.println("--- Succeeded in setting the
ContextClassLoader of this thread to be this applet's own
ClassLoader");
else{
System.out.println("### Could not set ContextClassLoader,
additional threads may not be able");
System.out.println("### to get a JNDI Context in java 122 or
greater.");
any clue or thought. please help
regards
mohan -
I want to use JNDi lookup for DB. Where should i specify them. Rigtnow i have given the hibernate connections in persistance xml file with user name pwd etc. But i dont want to do this. I want to use JNDI lookup and configure my weblogic for the JNDI. What are the changes I need to make in the application context and persistance xml files. Pls help?
my persistance .xml file looks like this,
<?xml version="1.0" encoding="UTF-8"?>
<persistence xmlns="http://java.sun.com/xml/ns/persistence"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
version="1.0"
xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd">
<persistence-unit name="jpaPersistance" transaction-type="RESOURCE_LOCAL">
<provider>org.hibernate.ejb.HibernatePersistence</provider>
<class>com.ggg.jp.model.bo.individual</class>
<exclude-unlisted-classes/>
<properties>
<property name="hibernate.archive.autodetection" value="class, hbm"/>
<property name="hibernate.show_sql" value="true"/>
<property name="hibernate.connection.driver_class" value="oracle.jdbc.driver.OracleDriver"/>
<property name="hibernate.connection.password" value="test"/>
<property name="hibernate.connection.url" value="jdbc:oracle:thin:@localhost:1521:xe"/>
<property name="hibernate.connection.username" value="test"/>
<property name="hibernate.dialect" value="org.hibernate.dialect.Oracle10gDialect"/>
</properties>
</persistence-unit>
</persistence>
Application context looks like this,
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:jee="http://www.springframework.org/schema/jee"
xmlns:aop="http://www.springframework.org/schema/aop"
xmlns:tx="http://www.springframework.org/schema/tx"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
http://www.springframework.org/schema/jee http://www.springframework.org/schema/jee/spring-jee-3.0.xsd
http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-3.0.xsd
http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-3.0.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.0.xsd">
<!-- <bean/> definitions here -->
<context:annotation-config/>
<bean id="demoDataServiceImpl" class="com.gg.jp.model.services.impl.DemoDataServiceImpl" />
<bean id="recordGeneratorWebServiceHandler" class="com.gg.jp.webservice.RecordGeneratorWebServiceHandler">
<property name="service" ref="demoDataServiceImpl"/>
</bean>
<bean id="entityManagerFactory"
class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean">
<property name="persistenceUnitName" value="jpaPersistance"/>
</bean>
<tx:annotation-driven/>
<bean id="transactionManager"
class="org.springframework.orm.jpa.JpaTransactionManager" >
<property name="entityManagerFactory" ref="entityManagerFactory"/>
</bean>
</beans>Me again!
So I found that I can't do jndi lookup (NamingException) for the datasource as mentioned, in the init method.
However, the very same jndi lookup was successful in the overridden authenticate method, called by oc4j when trying to authenticate the user.
Go figure!
TIA,
- nik. -
Hi All
Two separate webapps, have different names for Datasources, on the same host and port. Both application work fine independently.
When we deploy both applications on the same app server(websphere), whichever we executes first gets its datasource from JNDI lookup and works fine, but when we try second application it have problem in finding its data source from JNDI lookup. If we start this second application first, it will work fine, but now another will have the same problem in its JNDI lookup.
Any idea why.
Thanks
....RanvirHi All
Two separate webapps, have different names for
Datasources, on the same host and port. Both
application work fine independently.
When we deploy both applications on the same app
server(websphere), whichever we executes first gets
its datasource from JNDI lookup and works fine, but
when we try second application it have problem in
finding its data source from JNDI lookup. If we start
this second application first, it will work fine, but
now another will have the same problem in its JNDI
lookup.
Any idea why.
Thanks
....RanvirHi Ranvir,
Do you mean you try to reach the same datasource with different names or do you try to reach different datasources over the same port?
If you try the first issue you shouldn't get any trouble. At least it works fine with JBOSS for example.
But if you try to do the latter in my oppinion you don't have a JNDI problem but a problem with socket binding: the two different databases must be contacted over different ports.
What do WebSphere's logs tell?
Best regards
Andy -
WLPI: business operations JNDI lookup & service pack
Hello,
I ran into a problem attempting to define a business operation in the Studio application
using WLPI 1.2.1 (without service pack 1). Everything works up to the point where
I press the Done button and Studio attempts to create a new business operation
object. I am getting a JNDI lookup exception. It appearsejb-name of method in
isolation-level must be the same name as that of the weblogic-enterprise-bean
Studio is looking up the name 'com.bea.wlpi.businessoperation' while the business
operation bean is bound under 'com.bea.wlpi.BusinessOperation'.
In an attempt to fix this problem I upgraded to service pack 1, but am now unable
to deploy wlpi-ejb.jar because of the following error: "ejb-name of method in
isolation-level must be the same name as that of the weblogic-enterprise-bean".
Can anyone help me create a business operation?
Thanks,
MartinMake sure that this Datasource you created is Targetted to Admin Server and full Cluster (incase of cluster domain). From Admin Console, select your datasource and check for the Targets tab. Since its JNDI lookup error, most probably it may not be deployed properly.
HTH
Ravi Jegga -
JNDI lookup name in a standalone oc4j instance
Hi,
Could you please let me know how to create a JNDI lookup name for a database in a stanalone OC4j Instance?
Both OC4J and oracle 9i database are in the same server.
Thanks in advance,
SukonyaHi,
I have the oracle 9i database as well as the oc4j instance in my local machine.I am trying to deploy a J2ee Application on the OC4j instance,using eclipse IDE.I have not created any connection pool or datasource in the oc4j instance but after i build the application I see that the connection pool and datasource instance have been created in the OC4j instance.
following are the contents of the build.xml file(for the ant build tool)
<?xml version="1.0" encoding="UTF-8" ?>
- <project name="TicketLoggingSystem" default="bind-web-app" basedir="../">
<property name="app.server" value="D:/oc4j/j2ee/home" />
<property name="dest.dir" value="${basedir}/dest" />
<property name="war.file" value="${dest.dir}/TicketLoggingSystem.war" />
<property name="ear.file" value="${dest.dir}/TicketLoggingSystem.ear" />
<property name="web.inf" value="${basedir}/WEB-INF" />
<property name="web.classes" value="${dest.dir}/classes" />
<property name="app.xml" value="${basedir}/application.xml" />
<property name="src.dir" value="${basedir}/src" />
<property name="oc4j.host" value="localhost" />
<property name="oc4j.admin.port" value="23791" />
<property name="oracle.home" value="D:/oc4j" />
<property name="j2ee.home" value="${oracle.home}/j2ee/home" />
<property name="oc4j.admin.username" value="oc4jadmin" />
<property name="oc4j.admin.password" value="welcome" />
<property name="oc4j.ormi" value="ormi://${oc4j.host}:${oc4j.admin.port}" />
<property name="app.name" value="TicketLoggingSystem" />
<property name="jdbc.url" value="jdbc:oracle:thin:@localhost:1521:80" />
<property name="jdbc.username" value="scott" />
<property name="jdbc.password" value="tiger" />
<property name="connection.driver" value="oracle.jdbc.driver.OracleDriver" />
<property name="connection.datasource" value="oracle.jdbc.pool.OracleDataSource" />
<property name="xa.location" value="jdbc/xa/MpsiDS" />
- <!-- Delete dest folder
-->
- <target name="init">
<delete dir="${dest.dir}" includeemptydirs="true" />
<mkdir dir="${dest.dir}" />
<mkdir dir="${web.classes}" />
</target>
- <!-- Compile all Java files
-->
- <target name="wscompile">
- <javac srcdir="${src.dir}" destdir="${web.classes}" deprecation="on" debug="on">
<exclude name="**/*.properties,**/*.xml" />
- <classpath>
<fileset dir="${web.inf}/lib" includes="*.jar" />
<fileset dir="${app.server}/lib" includes="servlet.jar" />
</classpath>
</javac>
</target>
- <!-- Build Web archive file
-->
- <target name="buildWar" depends="init,wscompile">
- <war destfile="${war.file}" webxml="${web.inf}/web.xml">
- <fileset dir="${basedir}">
<include name="content*/**" />
</fileset>
<webinf dir="${web.inf}" includes="*.xml,*.tld" excludes="web.xml" />
<classes dir="${web.inf}/classes" />
<lib dir="${web.inf}/lib" includes="*.jar" />
</war>
</target>
- <!-- Build Enterprsie Archive
-->
- <target name="buildEar" depends="buildWar">
- <ear destfile="${ear.file}" appxml="${app.xml}">
<fileset dir="${dest.dir}" includes="*.war" />
</ear>
</target>
- <!-- Checking availability of oc4j
-->
- <target name="check-oc4j-available">
<echo message="------> Checking to see if OC4J is started ." />
<echo message="[checking oc4j on machine =${oc4j.host}]" />
<echo message="[port=${oc4j.admin.port}]" />
- <condition property="oc4j.started">
<socket server="${oc4j.host}" port="${oc4j.admin.port}" />
</condition>
</target>
- <!-- Remove data source
-->
- <target name="remove-data-source" depends="check-oc4j-available" if="oc4j.started">
<echo message="Removing DataSource" />
- <java jar="${j2ee.home}/admin.jar" fork="true">
<arg value="${oc4j.ormi}" />
<arg value="${oc4j.admin.username}" />
<arg value="${oc4j.admin.password}" />
<arg value="-application" />
<arg value="${app.name}" />
<arg value="-removeDataSource" />
<arg value="-location" />
<arg value="jdbc/TicketLoggingSystem" />
</java>
<echo message="Removed DataSource Successfully" />
</target>
- <!-- Undeploy
-->
- <target name="undeploy" depends="remove-data-source" description="Undeploying the application" if="oc4j.started">
<echo message="Undeploying the Application ${app.name}" />
- <java jar="${j2ee.home}/admin.jar" fork="true">
<arg value="${oc4j.ormi}" />
<arg value="${oc4j.admin.username}" />
<arg value="${oc4j.admin.password}" />
<arg value="-undeploy" />
<arg value="${app.name}" />
</java>
<echo message="Undeploying the Application ${app.name} is Successful" />
</target>
- <!-- Deploy
-->
- <target name="deploy" depends="undeploy,buildEar" if="oc4j.started">
<echo message="Deploying the Application ${app.name}" />
- <java jar="${j2ee.home}/admin.jar" fork="true">
<arg value="${oc4j.ormi}" />
<arg value="${oc4j.admin.username}" />
<arg value="${oc4j.admin.password}" />
<arg value="-deploy" />
<arg value="-file" />
<arg value="${ear.file}" />
<arg value="-deploymentName" />
<arg value="${app.name}" />
</java>
<echo message="Deploying the Application ${app.name} is Successful" />
</target>
- <!-- Create data source
-->
- <target name="create-data-source" depends="check-oc4j-available" if="oc4j.started">
<echo message="Creating DataSource for Application ${app.name}" />
- <java jar="${j2ee.home}/admin.jar" fork="true">
<arg value="${oc4j.ormi}" />
<arg value="${oc4j.admin.username}" />
<arg value="${oc4j.admin.password}" />
<arg value="-application" />
<arg value="${app.name}" />
<arg value="-installDataSource" />
<arg value="-jar" />
<arg value="${oracle.home}/jdbc/lib/ojdbc14dms.jar" />
<arg value="-url" />
<arg value="${jdbc.url}" />
<arg value="-connectionDriver" />
<arg value="${connection.driver}" />
<arg value="-location" />
<arg value="jdbc/TicketLoggingSystem" />
<arg value="-username" />
<arg value="${jdbc.username}" />
<arg value="-password" />
<arg value="${jdbc.password}" />
<arg value="-className" />
<arg value="${connection.datasource}" />
</java>
<echo message="Created DataSource Successfully for Application ${app.name}" />
</target>
- <!-- Binding web-app
-->
- <target name="bind-web-app" depends="deploy,create-data-source" if="oc4j.started">
<echo message="executing bind web app" />
- <java jar="${j2ee.home}/admin.jar" fork="true">
<arg value="${oc4j.ormi}" />
<arg value="${oc4j.admin.username}" />
<arg value="${oc4j.admin.password}" />
<arg value="-bindWebApp" />
<arg value="${app.name}" />
- <!-- app deployname
-->
<arg value="${app.name}" />
- <!-- web module name
-->
<arg value="default-web-site" />
- <!-- web site name
-->
<arg value="/${app.name}" />
- <!-- context root
-->
</java>
<echo message="Access the application using: http://${oc4j.host}:8888/${app.name}" />
</target>
</project>
Following are the contents of Oc4J home->services->jdbc resources:
Datasource:
Name jdbc/TicketLoggingSystem
Application TicketLoggingSystem
JNDI Location jdbc/TicketLoggingSystem
Connection Pool
Managed by OC4j
Test
when i click the datasource name,I see that its type is Native datasource with no related connection pool.
Whereas for the default datasource oracleDS,
Type Managed Data Source
Connection Pool Example Connection Pool
However on deployment a connection pool is also created along with the datasource
Name jdbc/TicketLoggingSystem_connectionPool
Application TicketLoggingSystem
ConnectionFactory class : oracle.jdbc.pool.OracleDataSource
Do we need to bind this connection pool to our datasource?If yes how is it done.And if that is not required,why is this connection pool created?Are the datasource and connection pool already bound to each other?
Also when I test either the datasource or connection pool,it says
Confirmation
Connection to "jdbc/TicketLoggingSystem_connectionPool" established successfully
or
Connection to "jdbc/TicketLoggingSystem" established successfully.
and displays both the connection pool and datasource details together for both the tests.
In my java code,while trying to establish connection to the database what should I mention in lookup i.e,
InitialContext context = new InitialContext();
DataSource dataSource = (DataSource) context.lookup(" jdbc/TicketLoggingSystem or jdbc/TicketLoggingSystem_connectionPool");
con = dataSource.getConnection();
Sorry if I am sounding novice.Thanks a lot in advance,
Sukanya
Maybe you are looking for
-
I have a song that shows in my itunes but when I click to play it, it says file is lost?
I recently went to click on a song in my itunes and an error message came up and said file not found. I have searched everywhere for the song and have had no luck. Is there any way to re-download the song from itunes?
-
How to create an email link with auto message?
Hello, I have a "mailto:emailaddress" link in an html file, and when the recipient clicks the link, I'd like the body of the email to automatically contain copy. For example, when the recipient clicks the email link, it takes them to a new message wi
-
How to connect BODS with sales force adapter
Hi all, I want to connect my BODS to sales force.com using the adapter. Please help me in connecting and loading the data from sales force.com Please help me in this issue. Experts help is highly needed. Thank You, Junaid BO Developer.
-
ORA-32051: mapping service not available
Hi, According to the instructions in "Oracle9i Database Administrator Guide Release 2(9.2)", chapter 12, for Mapping files, there should be a file named "filemap.ora" under $ORACLE_HOME/rdbms/filemap/etc. The file nor the folders 'filemap/etc' exit.
-
US7ASCII Characterset - Need to support Special Characters & Symbols
Dear All, My database characterset is 'US7ASCII' Some of Special Characters / Symbols are not supported by 'US7ASCII'. But those symbols need to be supported by 'US7ASCII'. Do we have any option to make 'US7ASCII' Characterset to support such Symbols