Use DataSource of weblogic in a standalone Java file
Hi,
We have a requirement to run a java file at a scheduled time in a day using cron scheduler on our linux server.
We need to fetch data from the database & perform some business logic in this standalone JAVA file.
Our application has an EAR which is deployed on Weblogic 10.3 server & in our application, we are utilizing the datasource created in that domain using Hibernate.
Now, can we create a standealone Java file & use exisitng datasource (without Hibernate) instead of legacy JDBC code to connect to DB.
Also, do we need to keep this JAVA file a part of this EAR, WAR or can we put the class file in anylocation outside this EAR & then utilize datasource feature.
Please help on the same in implementation.
Thanks,
Uttam
Hi Ravi,
I did create Datasource domain & put wlclient.jar in my application classpath (Add jar in Java Build path of application), but, when I ran application, its giving below error
Exception in thread "Main Thread" java.lang.NoClassDefFoundError: weblogic/kernel/KernelStatus
at weblogic.jndi.Environment.<clinit>(Environment.java:78)
at weblogic.jndi.WLInitialContextFactory.getInitialContext(WLInitialContextFactory.java:117)
at javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:667)
at javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:288)
at javax.naming.InitialContext.init(InitialContext.java:223)
at javax.naming.InitialContext.<init>(InitialContext.java:198)
at TestDataSource.main(TestDataSource.java:37)
Also, I'm putting code here as I there is no provision to attach the file here. Please let me know whats wrong here.
Also, I've given the name of datasource as testDataSource through Admin console of the domain. Do we need to prefix the name with jdbc/ in the code or without that also it works?
import java.sql.Connection;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import java.util.Hashtable;
import javax.naming.Context;
import javax.naming.InitialContext;
import javax.naming.NamingException;
import javax.sql.DataSource;
public class TestDataSource {
public static void main(String[] args)
DataSource ds=null;
Connection conn=null;
Statement stmt=null;
ResultSet rs=null;
Context ctx=null;
try
Hashtable ht = new Hashtable();
ht.put(Context.INITIAL_CONTEXT_FACTORY,
"weblogic.jndi.WLInitialContextFactory");
ht.put(Context.PROVIDER_URL,
"t3://172.19.244.180:7001");
System.out.println("HERE");
ctx=new InitialContext(ht);
ds=(DataSource)ctx.lookup("jdbc/testDataSource");
System.out.println("HERE AFER CONTEXT CREATION");
conn=ds.getConnection();
stmt=conn.createStatement();
rs=stmt.executeQuery("select distinct(circle) from AIRCEL_STORE_FINDER order by 1 ");
while (rs.next())
System.out.println("circle name "+rs.getString(1));
}catch (Exception e) {
System.out.println("Error in Main "+e.toString());
e.printStackTrace();
finally{
try{
if(rs!=null)
rs.close();
if(stmt!=null)
stmt.close();
if(conn!=null)
conn.close();
if(ds!=null)
ds=null;
if(ctx!=null)
ctx.close();
}catch (SQLException e) {
System.out.println("Error in SQLException Finally "+e.toString());
catch (NamingException e) {
System.out.println("Error in NamingException Finally "+e.toString());
}
Similar Messages
-
How to run standalone java file from weblogic server on Solaris
Hi,
We have a requirement to run a java file at a scheduled time in a day using cron scheduler on our linux server.
We need to fetch data from the database & perform some business logic in this standalone JAVA file.
Our application has an EAR which is deployed on Weblogic 10.3 server & in our application, we are utilizing the datasource created in that domain.
Now, we have created a standealone Java file & used exisitng datasource (without Hibernate) of the domain with the help of below forums,
Use DataSource of weblogic in a standalone Java file
able to achieve the same.
I've bundled this JAVA in application WAR & depoyed on the same domain where datasource is created.
Now, how can I execute this file from anywhere on the server using weblogic classpath.
Please help on the same in implementation.
Thanks,
UttamIf the Java application must be stand-alone you must not deploy it on WebLogic, then WebLogic will manage its lifecycle.
In this case you can use the CommonJ API and use the timermanager if it must run on a certain time. More information
of how to do this can be found here: http://middlewaremagic.com/weblogic/?p=5569
If you keep the Java application stand-only and want to use a cron job you can follow the example presented here: http://middlewaremagic.com/weblogic/?p=7065
Note that the example runs a WLST script, but you can follow the same steps to run your Java application. -
Error in oim Role creation using Role Manager Service API from Standalone Java client
Hi,
Facing the following error when trying to create Role using Role Manager Service API from a standalone java client .
Tried with the solution of changing ,
Login into the Web Logic Admin Console --> Servers --> OIM Server --> Protocols --> Modify the Maximum Message from 100000000 to 1000000000, but still the problem persists.
Exception in thread "main" org.omg.CORBA.BAD_PARAM: vmcid: 0x0 minor code: 0 completed: No
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
at java.lang.reflect.Constructor.newInstance(Unknown Source)
at java.lang.Class.newInstance0(Unknown Source)
at java.lang.Class.newInstance(Unknown Source)
at com.sun.corba.se.impl.protocol.giopmsgheaders.MessageBase.getSystemException(Unknown Source)
at com.sun.corba.se.impl.protocol.giopmsgheaders.ReplyMessage_1_2.getSystemException(Unknown Source)
at com.sun.corba.se.impl.protocol.CorbaMessageMediatorImpl.getSystemExceptionReply(Unknown Source)
at com.sun.corba.se.impl.protocol.CorbaClientRequestDispatcherImpl.processResponse(Unknown Source)
at com.sun.corba.se.impl.protocol.CorbaClientRequestDispatcherImpl.marshalingComplete(Unknown Source)
at com.sun.corba.se.impl.protocol.CorbaClientDelegateImpl.invoke(Unknown Source)
at org.omg.CORBA.portable.ObjectImpl._invoke(Unknown Source)
at com.sun.org.omg.SendingContext._CodeBaseStub.meta(Unknown Source)
at com.sun.corba.se.impl.encoding.CachedCodeBase.meta(Unknown Source)
at com.sun.corba.se.impl.io.IIOPInputStream.getOrderedDescriptions(Unknown Source)
at com.sun.corba.se.impl.io.IIOPInputStream.inputObjectUsingFVD(Unknown Source)
at com.sun.corba.se.impl.io.IIOPInputStream.simpleReadObject(Unknown Source)
at com.sun.corba.se.impl.io.ValueHandlerImpl.readValueInternal(Unknown Source)
at com.sun.corba.se.impl.io.ValueHandlerImpl.readValue(Unknown Source)
at com.sun.corba.se.impl.encoding.CDRInputStream_1_0.read_value(Unknown Source)
at com.sun.corba.se.impl.encoding.CDRInputStream.read_value(Unknown Source)
at oracle.iam.identity.rolemgmt.api._RoleManager_ogut7n_RoleManagerRemoteRIntf_Stub.createx(Unknown Source)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at weblogic.ejb.container.internal.RemoteBusinessIntfProxy.invoke(RemoteBusinessIntfProxy.java:85)
at $Proxy2.createx(Unknown Source)
at oracle.iam.identity.rolemgmt.api.RoleManagerDelegate.create(Unknown Source)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at Thor.API.Base.SecurityInvocationHandler$1.run(SecurityInvocationHandler.java:68)
at weblogic.security.subject.SubjectProxy.doAs(SubjectProxy.java:64)
at weblogic.security.subject.SubjectManager.runAs(SubjectManager.java:262)
at weblogic.security.Security.runAs(Security.java:48)
at Thor.API.Security.LoginHandler.weblogicLoginSession.runAs(weblogicLoginSession.java:52)
at Thor.API.Base.SecurityInvocationHandler.invoke(SecurityInvocationHandler.java:79)
at $Proxy3.create(Unknown Source)
at com.idm.role.CreateRole.createRole(CreateRole.java:113)
at com.idm.role.CreateRole.main(CreateRole.java:167)
Thanks In AdvanceHi , I have used OIM 11g R2.
Please find below the code we have used,
package com.idm.role;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Hashtable;
import java.util.Iterator;
import java.util.Set;
import java.util.logging.Logger;
import javax.security.auth.login.LoginException;
import oracle.iam.identity.exception.NoSuchRoleException;
import oracle.iam.identity.exception.RoleAlreadyExistsException;
import oracle.iam.identity.exception.RoleCreateException;
import oracle.iam.identity.exception.RoleLookupException;
import oracle.iam.identity.exception.RoleModifyException;
import oracle.iam.identity.exception.SearchKeyNotUniqueException;
import oracle.iam.identity.exception.ValidationFailedException;
import oracle.iam.identity.rolemgmt.api.RoleManager;
import oracle.iam.identity.rolemgmt.api.RoleManagerConstants;
import oracle.iam.identity.rolemgmt.vo.Role;
import oracle.iam.platform.OIMClient;
import oracle.iam.platform.authz.exception.AccessDeniedException;
public class CreateRole {
private final static Logger LOGGER = Logger.getLogger(CreateRole.class .getName());
OIMClient oimClient = null;
public OIMClient connectToOIM() {
LOGGER.info("In connectToOIM ");
Hashtable env = new Hashtable();
env.put(OIMClient.JAVA_NAMING_FACTORY_INITIAL,
"weblogic.jndi.WLInitialContextFactory");
env.put(OIMClient.JAVA_NAMING_PROVIDER_URL,
"t3://V-hydidm1.itig.co.in:14000");
System.setProperty("java.security.auth.login.config",
"F:\\Projects\\IDM\\Team\\Env_setup\\OIM_Setup\\designconsole\\config\\authwl.conf");
System.setProperty("java.security.policy",
"F:\\Projects\\IDM\\Team\\Env_setup\\OIM_Setup\\designconsole\\config\\xl.policy");
System.setProperty("OIM.AppServerType", "wls");
System.setProperty("APPSERVER_TYPE", "wls");
System.setProperty("weblogic.Name", "oim_server1");
oimClient = new OIMClient(env);
try {
oimClient.login("xelsysadm", "Passw0rd".toCharArray());
} catch (LoginException e) {
e.printStackTrace();
System.out.println("Connected");
return oimClient;
public void readRoleMetadata() {
LOGGER.info("in readRoleMetadata ");
RoleManager roleManagerService = oimClient
.getService(RoleManager.class);
try {
Role roleVo = roleManagerService.getDetails(
RoleManagerConstants.ROLE_DISPLAY_NAME, "API Role1", null);
Set attributeNameSet = roleVo.getAttributeNames();
Iterator it = attributeNameSet.iterator();
while (it.hasNext()) {
System.out.println("Attribute Name :: " + it.next());
// roleVo.setAttribute("ADentitlements", "Security Admin access");
String adEntitlements = "" + roleVo.getAttribute("ADentitlements");
System.out.println("AD Entitlements :: " + adEntitlements);
System.out.println("DB Entitlements :: " + ""
+ roleVo.getAttribute("DBEntitlements"));
System.out.println("Unix Entitlements :: " + ""
+ roleVo.getAttribute("UnixWindows"));
System.out.println("VPN :: " + "" + roleVo.getAttribute("VPN"));
} catch (SearchKeyNotUniqueException e) {
e.printStackTrace();
} catch (NoSuchRoleException e) {
e.printStackTrace();
} catch (RoleLookupException e) {
e.printStackTrace();
} catch (AccessDeniedException e) {
e.printStackTrace();
public void createRole() {
LOGGER.info(" in Create role ");
RoleManager roleManagerService = oimClient
.getService(RoleManager.class);
HashMap<String, Object> roleCreationAttrMap = new HashMap<String, Object>();
roleCreationAttrMap.put(RoleManagerConstants.ROLE_NAME, "API Role1");
roleCreationAttrMap.put(RoleManagerConstants.ROLE_DESCRIPTION,
"This Role is created using API Role1");
roleCreationAttrMap.put(RoleManagerConstants.ROLE_DISPLAY_NAME,
"API Role1");
roleCreationAttrMap.put("ADentitlements", "API Role1 AD Entitlements");
roleCreationAttrMap.put("DBEntitlements", "API Role1 DB Entitlements");
roleCreationAttrMap.put("VPN", "No");
roleCreationAttrMap.put("UnixWindows", "API Role1 Unix Entitlements");
Role roleVo = new Role(roleCreationAttrMap);
try {
System.out.println(" Before Create role *********************************************");
roleManagerService.create(roleVo);
System.out.println("Role Created .. ");
} catch (ValidationFailedException e) {
e.printStackTrace();
} catch (RoleAlreadyExistsException e) {
e.printStackTrace();
} catch (RoleCreateException e) {
e.printStackTrace();
} catch (AccessDeniedException e) {
e.printStackTrace();
public void modifyRole() {
LOGGER.info(" in modifyRole ");
RoleManager roleManagerService = oimClient
.getService(RoleManager.class);
Role roleVo;
try {
roleVo = roleManagerService.getDetails(
RoleManagerConstants.ROLE_DISPLAY_NAME, "API Role1", null);
String roleKey = roleVo.getEntityId();
HashMap<String, Object> roleCreationAttrMap = new HashMap<String, Object>();
roleCreationAttrMap.put("ADentitlements",
"Updated API Role1 AD Entitlements");
Set roleKeySet = new HashSet<String>();
roleKeySet.add(roleKey);
Role roleVoNew = new Role(roleCreationAttrMap);
roleManagerService.modify(roleKeySet, roleVoNew);
System.out.println("Role Modified ..");
} catch (SearchKeyNotUniqueException e) {
e.printStackTrace();
} catch (NoSuchRoleException e) {
e.printStackTrace();
} catch (RoleLookupException e) {
e.printStackTrace();
} catch (AccessDeniedException e) {
e.printStackTrace();
} catch (ValidationFailedException e) {
e.printStackTrace();
} catch (RoleModifyException e) {
e.printStackTrace();
public static void main(String args[]) {
CreateRole miscObj = new CreateRole();
miscObj.connectToOIM();
miscObj.createRole();
//miscObj.readRoleMetadata();
Thanks In Advance . -
Connecting to TimesTen using DataSource in WebLogic on Linux
We are trying to use weblogic 9.2 to connect to TimesTen7.0, both are on Linux.
We have installed Oracle 10g client and then installed TimesTen 7.0 Client on the Linux server hosting weblogic.
Created Client DSN in /var/TimesTen/sys.odbc.ini file as follows:
[ODBC Data Sources]
TTclientMaster=TimesTen 7.0 Client Driver
[TTclientMaster]
TTC_SERVER="TTServerHostName"
TTC_SERVER_DSN=TTmaster
When we are trying to create DataSource in weblogic Admin console it does not show up TTClient Driver in the list.
We tried setting up using "Others" for driver and databasetype but then it asks for databasename which we don't have since TT uses DSN.
We are looking for any pointers or references that can explain how to configure weblogic to use TimesTen using TT 7.0 client DSN.If you have access to a copy of TimesTen 6.0 you can look in the AppServer Configuration Guide (appsrv.pdf) that was shipped with that release. This guide is currently being rewritten and so is not yet available for 7.0.
If you can't get hold of a copy, e-mail me at [email protected] and I'll send it to you.
Chris -
Using Datasources with Weblogic 7.2
Hi everyone,
I am using Weblogic 7.2 with Db2 8.1 fp3(Type 4 Drivers). I am wanting
to set up a Datasource that would allow my application to connect to
DB2 using the JNDI lookup for that data-source.
My question is: what additions/changes I need to make to config.xml in
order to set this up.Looking at the Websphere Admin Doc, it seems to
me that I need to atleast add 2 elements to my domain in config.xml:
1. JDBCConnectionPool
2. JDBCDataSource(and link it to the above pool)
I have previously set-up datasources on WAS 5.0. What is confusing me
w.r.t Weblogic is that there seems to be no way to specify the
implementing class for the DataSource. e.g. WAS5.0 allows you to
specify the implementationClassName of the
datasource(com.ibm.db2.jcc.DB2ConnectionPoolDataSource in my case) while
defining the DataSource.JDBCConnectionPool element in Weblogic does
have an attribute called "DriverName" but per the documentation it
should be set to an implementor of java.sql.Driver interface: there
seems to be no way to set an implementor of javax.sql.DataSource
anywhere.
Could anyone please shed some light on how to set this up?
Thanks much in advance,
SachinMitesh,
Many thanks for the reply. If you don't mind, I have a couple of follow-up questions
for you.
1> Does this mechanism work with Type 4 Pure Java Drivers?
e.g. if I specified the connection pool as
<JDBCConnectionPool DriverName="com.ibm.db2.jcc.DB2ConnectionPoolDataSource" Name="IBM-db2"
Password="MYPASSWORD" Properties="user=USERNAME;DatabaseName=DATABASE" Targets="MYSERVER"
TestTableName="SQL SELECT COUNT(*) FROM SYSIBM.SYSTABLES" URL="jdbc:db2:DATABASE"/>
==> I changed the DriverName to "com.ibm.db2.jcc.DB2ConnectionPoolDataSource"
which
is what I believe is the Type-4 version
2> Setting the DriverName to a javax.sql.DataSource extension seems to suggest
that the documentation in the "BEA Server Configuration Reference" guide is incorrect:
-- For the DriverName attribute of the Connection Pool, the guide says that "DriverName
must be the name of a class that implements the java.sql.Driver interface"
Thanks again
Sachin
Mitesh Patel <[email protected]> wrote:
<JDBCConnectionPool DriverName="COM.IBM.db2.jdbc.DB2XADataSource"
Name="IBM-db2-xa"
Password="MYPASSWORD"
Properties="user=USERNAME;DatabaseName=DATABASE"
Targets="MYSERVER"
TestTableName="SQL SELECT COUNT(*) FROM SYSIBM.SYSTABLES"
URL="jdbc:db2:DATABASE"/>
<JDBCConnectionPool DriverName="COM.IBM.db2.jdbc.app.DB2Driver"
Name="IBM-db2"
Password="MYPASSWORD"
Properties="user=USERNAME;DatabaseName=DATABASE"
Targets="MYSERVER"
TestTableName="SQL SELECT COUNT(*) FROM SYSIBM.SYSTABLES"
URL="jdbc:db2:DATABASE"/>
Then setup your datasource using one of this connection pools in your
config.xml. Also, make sure your driver zip files are in the classpath.
Thanks,
Mitesh
Sachin Arora wrote:
Hi everyone,
I am using Weblogic 7.2 with Db2 8.1 fp3(Type 4 Drivers). I am wanting
to set up a Datasource that would allow my application to connect to
DB2 using the JNDI lookup for that data-source.
My question is: what additions/changes I need to make to config.xmlin
order to set this up.Looking at the Websphere Admin Doc, it seems to
me that I need to atleast add 2 elements to my domain in config.xml:
1. JDBCConnectionPool
2. JDBCDataSource(and link it to the above pool)
I have previously set-up datasources on WAS 5.0. What is confusingme
w.r.t Weblogic is that there seems to be no way to specify the
implementing class for the DataSource. e.g. WAS5.0 allows you to
specify the implementationClassName of the
datasource(com.ibm.db2.jcc.DB2ConnectionPoolDataSource in my case)while
defining the DataSource.JDBCConnectionPool element in Weblogic does
have an attribute called "DriverName" but per the documentation it
should be set to an implementor of java.sql.Driver interface: there
seems to be no way to set an implementor of javax.sql.DataSource
anywhere.
Could anyone please shed some light on how to set this up?
Thanks much in advance,
Sachin -
To support certficate based client authentication using 2-way SSL from a standalone java application which uses JNDI and JSSE1.0.2 to connect to an SSL enabled LDAP Server how do we configure the certmap.conf?Is there any additional setup required at the LDAP Server side apart from enablinf SSL with the option"Required Client Authentication" enabled.The 2 way SSL handshake goes through but the access log file (After configuring the certmap.conf for the issuer DN of the client certficate etc..)shows SSL failed to LDAP DN?But inspite of this access log error the Java client does get an SSL Connection object with which it is able to connect to the LDAP.IS the certmap.conf file being looked up by the LDAP Server at all?
have you out.flush() and out.close() before you call connection.getInputStream()?
-
How can i execute "*.java " files in Workshop
Hi,
Im sunil,new to this weblogic workshop8.1..i dont know how to execute standalone .java files or servlets in workshop.plz help me and tell the way.
regards
Budati sunilIm not too sure about the Java project. But single normal java files with public static void maain(String [] args) are very simple to execute.
1. Write the java code somewhere lets call this class A.
2. Make a dummy page flow.
3. In the begin action of this pageFlow, call the main method of the A class directly using A.main(null) since main is a static method. your code will work fine.
4. If you have to pass a String[] as parameters. Before calling main, create this String[] and then pass it.
In this way you can make a jsp and take the input from the user also.
Hope it helps
Cheeers -
A tool for editing javadoc in .java files
Hi
i am looking for a tool that can be use for editing the javadoc in the .java files. it should edit constructors, methods and fields.
if you know such tool please send me a link.
Regards
y.l.We list some standalone solutions on the Javadoc FAQ.
(I have not tried any of these)
http://java.sun.com/j2se/javadoc/faq/index.html#G
- Utility for writing doc comments: Doc+.
- Tool that simplifies the process of writing doc comments: DocWiz.
- Tool for generating formated Javadoc comments: CommentMaster.
- Tool for editing Javadoc comments using a word processor-like view: XMLmind XML Editor.
-Doug Kramer
Javadoc team -
How to open java files in a java project
hi ,
i have to implement a java program analyzer and now i have implement a java parser using javaCC. My parser parse a java file at a time and i have to read and parse all java files in a java project. my idea is to enter
java project name *.jpx as an input and search java files in project and parse them one by one, or , to enter the folder path of java source files of project and parse them.
i am a beginer of java language and i don't know where to start to do it.
is there someone tell me which way is easier and better for my case and some ways to implement it. i search sample files that is similar to my case but i cannot find any.
thanks in advance.
amiif u don't mind , can u tell me which tutorial i
should read for that? http://java.sun.com/docs/books/tutorial/essential/io/
This... for example.
xH4x0r -
Javac error: Can't read my .java-file
Hi,
sorry for my stupid question, but I have problems compiling my java code.
Before, I used NetBeans to compile the code and I had no problems with it. Now I have to use the javac command (with the same *.java-files) and it does not work.
It's running on Linux. In my current working directory, I have the file
image/transfer/smallserver/RequestProcessor.java
So I type
javac image.transfer.smallserver.RequestProcessor.java but I get this error:
error: can't read: image.transfer.smallserver.RequestProcessor.javaPlease, can anyone tell me, what's wrong with this?
Thank you for your help
SusanneI set all possible classpathes. It makes no difference.
If I try it a different way, I get other errors concerning the files I want to import. These files are located in image/transfer/client.
I tried to use smallserver as working directory, simply with the command
javac RequestProcessor.javaI get
Class image.transfer.client.ImageObject not found in importI tried it with the same working directory as before with "/" instead of "." in the path name. I get
error: Invalid class file format: ./image/transfer/client/ImageObject.class, wrong version: 46, expected 45and addionally the message from above (ImageObject not found) -
EBS datasource in WebLogic cluster using the EBS dbc file
Hi All
Please let me know if someone has successfully created EBS datasource in WebLogic cluster using the EBS dbc file.
I have successfully created the datasource with one managed server but I am getting 'OAuth Mashaling Failure' error while adding the second managed server to this datasource.
ThanksThanks Hussein
Here is the complete error:
[wlst] Caused by: weblogic.common.ResourceException: weblogic.common.ResourceException: OAUTH marshaling failure
[wlst] at weblogic.jdbc.common.internal.PooledConnectionEnvFactory.createResource(PooledConnectionEnvFactory.java:133)
[wlst] at weblogic.common.resourcepool.ResourcePoolImpl.makeResources(ResourcePoolImpl.java:1249)
[wlst] at weblogic.common.resourcepool.ResourcePoolImpl.makeResources(ResourcePoolImpl.java:1166)
[wlst] at weblogic.common.resourcepool.ResourcePoolImpl.start(ResourcePoolImpl.java:249)
[wlst] at weblogic.jdbc.common.internal.ConnectionPool.doStart(ConnectionPool.java:1154)
[wlst] at weblogic.jdbc.common.internal.ConnectionPool.start(ConnectionPool.java:154)
[wlst] at weblogic.jdbc.common.internal.ConnectionPoolManager.createAndStartPool(ConnectionPoolManager.java:454)
[wlst] at weblogic.jdbc.common.internal.ConnectionPoolManager.createAndStartPool(ConnectionPoolManager.java:372)
[wlst] at weblogic.jdbc.module.JDBCModule.prepare(JDBCModule.java:255) -
How to use standalone java client with an enterprise bean in J2EE 1.4
Hi All,
I am have deployed a stateless session bean in Sun's J2EE 1.4 Application Server. i am trying to call the bean using a standalone java client. but the client cannot access the bean.
The error coming is:
Jan 21, 2004 7:48:27 PM com.sun.corba.ee.impl.legacy.connection.SocketFactoryCo
nectionImpl <init>
WARNING: ORBUTIL.connectFailure
org.omg.CORBA.COMM_FAILURE: vmcid: SUN minor code: 201 completed: No
at com.sun.corba.ee.impl.logging.ORBUtilSystemException.connectFailure(
RBUtilSystemException.java:1739)
at com.sun.corba.ee.impl.logging.ORBUtilSystemException.connectFailure(
RBUtilSystemException.java:1757)
at com.sun.corba.ee.impl.legacy.connection.SocketFactoryConnectionImpl.
init>(SocketFactoryConnectionImpl.java:74)
at com.sun.corba.ee.impl.legacy.connection.SocketFactoryContactInfoImpl
createConnection(SocketFactoryContactInfoImpl.java:88)
at com.sun.corba.ee.impl.protocol.CorbaClientRequestDispatcherImpl.begi
Request(CorbaClientRequestDispatcherImpl.java:146)
at com.sun.corba.ee.impl.protocol.CorbaClientDelegateImpl.request(Corba
lientDelegateImpl.java:121)
at com.sun.corba.ee.impl.protocol.CorbaClientDelegateImpl.is_a(CorbaCli
ntDelegateImpl.java:212)
at org.omg.CORBA.portable.ObjectImpl._is_a(ObjectImpl.java:112)
at org.omg.CosNaming.NamingContextHelper.narrow(NamingContextHelper.jav
:69)
at com.sun.enterprise.naming.SerialContext.getProvider(SerialContext.ja
a:58)
at com.sun.enterprise.naming.SerialContext.lookup(SerialContext.java:12
at javax.naming.InitialContext.lookup(InitialContext.java:347)
at StatelessSessionClient.main(StatelessSessionClient.java:17)
Caused by: java.lang.RuntimeException: java.net.ConnectException: Connection re
used: connect
at com.sun.enterprise.iiop.IIOPSSLSocketFactory.createSocket(IIOPSSLSoc
etFactory.java:390)
at com.sun.corba.ee.impl.legacy.connection.SocketFactoryConnectionImpl.
init>(SocketFactoryConnectionImpl.java:58)
... 10 more
Caused by: java.net.ConnectException: Connection refused: connect
at sun.nio.ch.Net.connect(Native Method)
at sun.nio.ch.SocketChannelImpl.connect(SocketChannelImpl.java:457)
at java.nio.channels.SocketChannel.open(SocketChannel.java:146)
at com.sun.enterprise.iiop.IIOPSSLSocketFactory.createSocket(IIOPSSLSoc
etFactory.java:381)
... 11 more
javax.naming.CommunicationException: Can't find SerialContextProvider
at com.sun.enterprise.naming.SerialContext.getProvider(SerialContext.ja
a:66)
at com.sun.enterprise.naming.SerialContext.lookup(SerialContext.java:12
at javax.naming.InitialContext.lookup(InitialContext.java:347)
at StatelessSessionClient.main(StatelessSessionClient.java:17)
Caused by: org.omg.CORBA.COMM_FAILURE: vmcid: SUN minor code: 201 completed
No
at com.sun.corba.ee.impl.logging.ORBUtilSystemException.connectFailure(
RBUtilSystemException.java:1739)
at com.sun.corba.ee.impl.logging.ORBUtilSystemException.connectFailure(
RBUtilSystemException.java:1757)
at com.sun.corba.ee.impl.legacy.connection.SocketFactoryConnectionImpl.
init>(SocketFactoryConnectionImpl.java:74)
at com.sun.corba.ee.impl.legacy.connection.SocketFactoryContactInfoImpl
createConnection(SocketFactoryContactInfoImpl.java:88)
at com.sun.corba.ee.impl.protocol.CorbaClientRequestDispatcherImpl.begi
Request(CorbaClientRequestDispatcherImpl.java:146)
at com.sun.corba.ee.impl.protocol.CorbaClientDelegateImpl.request(Corba
lientDelegateImpl.java:121)
at com.sun.corba.ee.impl.protocol.CorbaClientDelegateImpl.is_a(CorbaCli
ntDelegateImpl.java:212)
at org.omg.CORBA.portable.ObjectImpl._is_a(ObjectImpl.java:112)
at org.omg.CosNaming.NamingContextHelper.narrow(NamingContextHelper.jav
:69)
at com.sun.enterprise.naming.SerialContext.getProvider(SerialContext.ja
a:58)
... 3 more
Caused by: java.lang.RuntimeException: java.net.ConnectException: Connection re
used: connect
at com.sun.enterprise.iiop.IIOPSSLSocketFactory.createSocket(IIOPSSLSoc
etFactory.java:390)
at com.sun.corba.ee.impl.legacy.connection.SocketFactoryConnectionImpl.
init>(SocketFactoryConnectionImpl.java:58)
... 10 more
Caused by: java.net.ConnectException: Connection refused: connect
at sun.nio.ch.Net.connect(Native Method)
at sun.nio.ch.SocketChannelImpl.connect(SocketChannelImpl.java:457)
at java.nio.channels.SocketChannel.open(SocketChannel.java:146)
at com.sun.enterprise.iiop.IIOPSSLSocketFactory.createSocket(IIOPSSLSoc
etFactory.java:381)
... 11 more
My java client uses the following code to access the bean:
Hashtable props = new Hashtable();
String URL="iiop://localhost:3700";
props.put("java.naming.factory.initial","com.sun.jndi.cosnaming.CNCtxFactory");
props.put("java.naming.provider.url", URL) ;
InitialContext ctx = new InitialContext();
Object ref = ctx.lookup("ejb/StatelessSessionHome");
StatelessSessionHome home = (StatelessSessionHome)PortableRemoteObject.narrow(ref,StatelessSessionHome.class);
StatelessSessionRemote statelessSession = home.create();
plz help me to locate the error.
Regards,
MohitHi Amol,
thanks for your suggestion.
i have deployed the converter application in J2EE1.4 tutorial in Sun AppServer J2EE1.4. the deployment process works smoothly. but accessing the deployed converter bean using standalone client as given in the tutorial gives the following error.
Caught an unexpected exception!
javax.naming.NoInitialContextException: Need to specify class name in environmen
t or system property, or as an applet parameter, or in an application resource f
ile: java.naming.factory.initial
at javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:6
40)
at javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:243
at javax.naming.InitialContext.getURLOrDefaultInitCtx(InitialContext.jav
a:280)
at javax.naming.InitialContext.lookup(InitialContext.java:347)
at ConverterClient.main(ConverterClient.java:14)
I have set the InitialHost and InitialPort as suggested by you in the client code. the client gets successfully compiled but gives error when executed.
The client code is:
import javax.naming.Context;
import javax.naming.InitialContext;
import javax.rmi.PortableRemoteObject;
import java.math.BigDecimal;
public class ConverterClient {
public static void main(String[] args) {
System.setProperty("org.omg.CORBA.ORBInitialHost","localhost");
System.setProperty("org.omg.CORBA.ORBInitialPort","3700");
try {
Context initial = new InitialContext();
Object objref = initial.lookup
("java:comp/env/ejb/SimpleConverter");
ConverterHome home =
(ConverterHome)PortableRemoteObject.narrow(objref,
ConverterHome.class);
Converter currencyConverter = home.create();
BigDecimal param = new BigDecimal ("100.00");
BigDecimal amount =
currencyConverter.dollarToYen(param);
System.out.println(amount);
amount = currencyConverter.yenToEuro(param);
System.out.println(amount);
System.exit(0);
} catch (Exception ex) {
System.err.println("Caught an unexpected exception!");
ex.printStackTrace();
Please suggest so that i can run the standalone client successfully.
Regards,
Mohit Kapoor -
Problem in accessing the Web Service using standalone Java Client
Dear Friends,
Hi,
I have an active web service and I have tested the same with XML Spy and Apache Axis and is giving me the output perfectly. For the same, I have developed a standalone Java client but getting problem in fetching the output.
The Exception is :
<Jan 4, 2006 5:54:16 PM GMT+05:30> <Info> <WebService> <BEA-220025> <Handler weblogic.webservice.core.handler.ClientHandler threw
an exception from its handleResponse method.
The exception was:
javax.xml.rpc.JAXRPCException: java.io.IOException: Received a response from url: http://10.20.15.59:18004/amountToWords which did
not have a valid SOAP content-type: text/html;charset=ISO-8859-1. .>
SOAP Fault **************** Exception during processing: java.io.IOException: Received a response from url: http://10.20.15.59:18
004/amountToWords which did not have a valid SOAP content-type: text/html;charset=ISO-8859-1.
(see Fault Detail for stacktrace)
javax.xml.rpc.soap.SOAPFaultException: Exception during processing: java.io.IOException: Received a response from url: http://10.2
0.15.59:18004/amountToWords which did not have a valid SOAP content-type: text/html;charset=ISO-8859-1.
(see Fault Detail for sta
cktrace)
at weblogic.webservice.core.ClientDispatcher.receive(ClientDispatcher.java:313)
at weblogic.webservice.core.ClientDispatcher.dispatch(ClientDispatcher.java:144)
at weblogic.webservice.core.DefaultOperation.invoke(DefaultOperation.java:457)
at weblogic.webservice.core.DefaultOperation.invoke(DefaultOperation.java:443)
at weblogic.webservice.core.rpc.CallImpl.invoke(CallImpl.java:566)
at weblogic.webservice.core.rpc.CallImpl.invoke(CallImpl.java:419)
at HelloClient.main(HelloClient.java:100)
I have tried some ways to set the content type explicitly but the results are same(throwing an exception).
I appreciate you all for helping me out of this.
Thanks
VRHi Amit
We also have this issue with weblogic webservices. Did you get any resolution for this issue.
When the service is executed for lesser number of hits, all the responses are processed properly. But as load (Number of hits for the same service) increases, few responses are failed to be parsed in the web service client. We could confirm that the producer responds with proper content type (text/xml)
Any help or pointers will be greatly appreciated.
Thanks,
Finny -
Can we call a webservice using standalone java application ?
Hi friends,
Can we call configurd webservice in xi , using standalone java application by just giving url of webservice ?
OR
Only by means of WEBDynapro we can call ?
Can you please tell me the answer for this .
Regards .,
V.RangarajanHI Ranga Rajan
well, If at all if you have webservice...you can import that werbserivce as External definition in to IR.
How to import:
1) Go to IR and and move to your requied component and there you can see the option called imported objects...select on imported objects where you can give the name and you can select the webservices which you want to use it.
2) Hope you are aware of that a werbservice will have the request and response.
3) Create the mapping program accroding to your requirement.
Go through blogs of Bhavesh and Naveen which talks about calling webservice in a specific condition:
Webservice Calls From a User Defined Function - /people/bhavesh.kantilal/blog/2006/11/20/webservice-calls-from-a-user-defined-function
Consuming/Calling webservices from DataBases - /people/sap.user72/blog/2005/10/20/consumingcalling-webservices-from-databases
Also check this help file on Web Services:
https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/336365d3-0401-0010-9884-a651295aeaa9
Cheers..
Vasu
<i>** Reward Points if found useful **</i> -
TREX Search using Standalone Java code
Hi Expert,
I am new to TREX and KM, so please help me in this query.
I want a <b>standalone JAVA program</b> to call the TREX API's and do the search. Now here when I searched this forum I got to know that TREX APIs as such can't be used directly.
So please suggest a work around for this. If anyone have any code samples then please let me know.
Also I have read something about a <b>Java Client</b> through which we can da a TREX search. From where can I get this code/page.
Thanks & Regards
SurajHi,
Have you read this blog ?
Using the KM Indexmanagement APIs for searching with TREX
https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/docs/library/uuid/9237e490-0201-0010-f3a1-9a322ccbd8b1
Patricio.
Maybe you are looking for
-
Do I really need an Airport device for my home wireless network?
Hi Apple Users, I am seriously considering purchasing my very first Apple computer: a MacBook Pro to be precise. I'm a very experienced Windows PC user - was a Microsoft Windows & Office -based Help Desk Analyst at my company for 13 years till I was
-
Hi everyone, i'm living in a shared house and my housemat...
Hi everyone, i'm living in a shared house and my housemates are spending too much of our bandwidth on p2p stuff. Our internet package has a limit so when we exceed it before the end of the month, our speed gets shaped to around 10kbps. This month, we
-
PROBLEM with a PEARL 9105 please help me
Hi ,I've got a PEARL 9105 (with 14 characters) and I had a problem with it so I made an upgrade of it but when I upgraded it the phone is regognize by the Os as a 9100 with 20 characters. So I can't write correctly an sms or mail or anything . I tri
-
when i try to use programs it says i need to install flash player, but when i try to install, it says its already their? help??
-
Is there any option in captivate to capture tool tips
Hello Friends I'm using Captivate 4 .is there any option in captivate4 to record the mouse movement so that i can capture the Tool Tips in the software which i am making the Demo.Hope some one will help me.. Crazdobe