Configuring JDBC Realms and session mangement
Hello All,
I want to provide authentication to my application.
Eg.
There are users in "User" table in my Java DB.
There is home page having login form and other features.
When the user enter his credentials in the login form, his credentials will be checked against the "User" table. iIf the credentials are right then, the next page containing his account information and shopping cart will be displayed and his session ID will be maintained. This session id will be used for other operations performed by this user.
I have achieved the above task easliy with my normal JDBC and JSP,Servlet.
I am learning Securities, and i want to accomplish this task using JDBC Realm with Netbeans IDE. Means Credentials will be checked, Session will be maintined, session id will be tracked and user page(account information and shoping cart) will be displyed.
How to achieve this?
Please help me out with the codes or example.
Please provide me the link if any article is mentioned for the same.
Thans & Regards,
Gaurav Dighe
ok thanks....
but thats what i exacltly need. How to configure Servlet Container and Glassfish server to achieve the task. Second thing is that by doing so i want to achieve the session management. To be precise i want to configure by glassfish server and application for JDBC Realm and then achieve Session management/tracking.
I there any way to achieve this. I am new to Security.
Please help..
Edited by: user8687589 on Jan 27, 2011 11:33 AM
Similar Messages
-
Oracle db 11g r2 Configuration of processes and session
I recently installed Oracle DB 11g R2 and 50,000 users connect to this database suggest me what would be basic configurations .
Processes and sessions parameters for database are 5000 and 5505 but it is little lagging now so if its possible i want to make it maximum of processes and sessions or automatic .50,000 users getting connected concurrently? How many users/sessions remain active at any given point of time?
For such high userbase/sessions better to go with share server configuration, since I cannot assume that even 10% of the users will be active at any given point of time so better to use shared servers and dispatchers. -
Need help configuring JDBC Realm on Tomcat 4.0.1
I'm getting the following error:
(from DOS prompt)
Starting service Tomcat-Standalone
Apache Tomcat/4.0.1
Catalina.start: LifecycleException: Exception opening database connection: jav
a.sql.SQLException: [Microsoft][ODBC Driver Manager] Data source name too long
LifecycleException: Exception opening database connection: java.sql.SQLExcepti
on: [Microsoft][ODBC Driver Manager] Data source name too long
at org.apache.catalina.realm.JDBCRealm.start(JDBCRealm.java:615)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1108)Here's my attempted configuration:
<Realm className="org.apache.catalina.realm.JDBCRealm" debug="99"
driverName="sun.jdbc.odbc.JdbcOdbcDriver"
connectionURL="jdbc:odbc:DSNname@host_string:1521:ORCL?user=user_name;password=pwd_name"
userTable="chg_users" userNameCol="user_name" userCredCol="user_pass"
userRoleTable="chg_users_roles" roleNameCol="role_name" />Any help would be appreciated!
Thanks!connectionURL="jdbc:odbc:CATALINA"
in this case, where is CATALINA supposedly pointing
to a DB connection? I don't have mine set, save for
maybe the classpath, but why would you point the
connURL through jdbc:odbc to CATALINA?
That is the name of a DNS. The ODBC shell (nothing to do with java) has DNS names. The shell uses the passed in name to look up the attributes associated with the name.
If you were using a DNS-less name then you would have to specify ODBC driver (nothing to do with java) and the associated attributes for that driver in the connection string.
I'm a little confused by this. Any explanation would
be great, as I have a driver that is jdbc:odbc,
rather than an exclusive Oracle driver.
Well, I've got the ojdbc14_g.jar file. But that's not
exclusively Oracle, correct? Just for JDBC with
Oracle?
A jdbc driver lives somewhere. The bridge driver lives in the Sun VM. The Oracle driver lives in a jar (current ones.)
The bridge driver talks to ODBC (which is outside of java.)
The oracle drivers talk to oracle databases. -
HFM Web Sever Configuration--Keep Alive and Session Time Out Optimal Config
We recently implemented an HFM 9.3.1 environment. We are using Windows 2003 Enterprise SP2 servers with IIS6. We have two HFM Web servers connecting to an application cluster with two application servers in the cluster. We were getting some errors when trying to unlock HFM cells in Workspace, but we were able to perform the functions fine on the application using the WIN32 client.
I opened a ticket with support and they recommended modifying the subcontext.properties file located in %HYPERION_HOME%\deployments\WebLogic9\servers\Workspace\webapps\workspace\conf. They recommended changing the following settings:
#KeepAliveInterval=30
#SessionTimeout=60
From what I understand, these settings are for the communication between the HFM Web Servers and the application cluster servers. I'm wondering how changing these settings may affect our environment. Are there negative effects and/or trade-offs for changing these settings? Is there a recommended threshold or maximum value?Hi Dinesh,
This cannot be achieved without development enhancements to some standard SAP framework component, to introduce a "keep-alive" concept. If you are using a CMS for CTI or email integration, you need to ensure it supports keeping the communications session alive also.
Sincerely,
Glenn
Glenn Abel
Covington Creative
www.covingtoncreative.com -
Authentificaton - JDBC realm & Form Based in Jdeveloper 10.1.3 and OCJ4
Dear Partners:
Being new working with Jdeveloper 10.1.3 and embedded OC4J,
I'm migrating an application from Tomcat and trying to
setup authentication for my JSP pages: JDBC realm and Form Based.
I succeeded only adding the security constraint to
the application's server.xml file, and creating the
user and user's roles tables. Yet, I got lost
by using the Jdeveloper's menu option Tools->OC4J embedded
OC4J server preferences.
Any documentation or examples are appreciated.
Thank you.Waheed - we aren't satisfied with our device coverage for mobile devices, hence we're focusing our efforts on Telnet/PDA and working with partners for ADF support for the broader class of mobile devices. Please send me an email or give me a call with any questions ([email protected], +1-408-687-8185).
-Indu -
Tomcat JDBC Realm Database Connection Error
Hello all,
I am trying to edit the server.xml file on Tomcat so I can use the JDBC Realm instead of the MemoryRealm. Hence, I will be able to read users, passwords and roles from a relational database instead of from the tomcat-users.xml.
I have tried following all the guides on the net I can find, my server.xml looks as follows (after making changes to allow it to use JDBC realm). The only problem is, when I try to run the application the server outputs the following: (after all of these errors have been kicked up a pop-up box then appears titled "Tomcat Manager Application", it asks for a User Name and Password. I have tried the standard user name of "ide" and the password next to it in tomcat-users.xml but it won't accept it. (I am using the netbeans IDE)).
Please could someone suggest any ideas of how I can get the server.xml to work with JDBC realm?
Using CATALINA_BASE: C:\Documents and Settings\Administrator\.netbeans\5.0beta\jakarta-tomcat-5.5.7_base
Using CATALINA_HOME: C:\Program Files\netbeans-5.0beta\enterprise2\jakarta-tomcat-5.5.7
Using CATALINA_TMPDIR: C:\Documents and Settings\Administrator\.netbeans\5.0beta\jakarta-tomcat-5.5.7_base\temp
Using JAVA_HOME: C:\j2sdk1.4.2_08
Created MBeanServer with ID: 1f934ad:107444b1d2b:-8000:ravinder-rdnzoa:1
31-Oct-2005 01:29:33 org.apache.coyote.http11.Http11Protocol init
INFO: Initializing Coyote HTTP/1.1 on http-8084
31-Oct-2005 01:29:34 org.apache.coyote.http11.Http11Protocol init
INFO: Initializing Coyote HTTP/1.1 on http-8443
31-Oct-2005 01:29:34 org.apache.catalina.startup.Catalina load
INFO: Initialization processed in 2174 ms
31-Oct-2005 01:29:34 org.apache.catalina.core.StandardService start
INFO: Starting service Catalina
31-Oct-2005 01:29:34 org.apache.catalina.core.StandardEngine start
INFO: Starting Servlet Engine: Apache Tomcat/5.5.7
31-Oct-2005 01:29:34 org.apache.catalina.realm.JDBCRealm start
SEVERE: Exception opening database connection
java.sql.SQLException: org.gjt.mm.mysql.Driver
at org.apache.catalina.realm.JDBCRealm.open(JDBCRealm.java:646)
at org.apache.catalina.realm.JDBCRealm.start(JDBCRealm.java:720)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1003)
at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:440)
at org.apache.catalina.core.StandardService.start(StandardService.java:450)
at org.apache.catalina.core.StandardServer.start(StandardServer.java:683)
at org.apache.catalina.startup.Catalina.start(Catalina.java:537)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:324)
at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:271)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:409)
31-Oct-2005 01:29:34 org.apache.catalina.core.StandardHost start
INFO: XML validation disabled
31-Oct-2005 01:29:36 org.apache.catalina.startup.ContextConfig validateSecurityRoles
INFO: WARNING: Security role name IBM used in an <auth-constraint> without being defined in a <security-role>
31-Oct-2005 01:29:36 org.apache.catalina.startup.ContextConfig validateSecurityRoles
INFO: WARNING: Security role name Auditor used in an <auth-constraint> without being defined in a <security-role>
31-Oct-2005 01:29:37 org.apache.struts.tiles.TilesPlugin initDefinitionsFactory
INFO: Tiles definition factory loaded for module ''.
31-Oct-2005 01:29:37 org.apache.struts.validator.ValidatorPlugIn initResources
INFO: Loading validation rules file from '/WEB-INF/validator-rules.xml'
31-Oct-2005 01:29:37 org.apache.struts.validator.ValidatorPlugIn initResources
INFO: Loading validation rules file from '/WEB-INF/validation.xml'
31-Oct-2005 01:29:38 org.apache.catalina.startup.ContextConfig validateSecurityRoles
INFO: WARNING: Security role name IBM used in an <auth-constraint> without being defined in a <security-role>
31-Oct-2005 01:29:38 org.apache.struts.tiles.TilesPlugin initDefinitionsFactory
INFO: Tiles definition factory loaded for module ''.
31-Oct-2005 01:29:38 org.apache.struts.validator.ValidatorPlugIn initResources
INFO: Loading validation rules file from '/WEB-INF/validator-rules.xml'
31-Oct-2005 01:29:38 org.apache.struts.validator.ValidatorPlugIn initResources
INFO: Loading validation rules file from '/WEB-INF/validation.xml'
31-Oct-2005 01:29:39 org.apache.coyote.http11.Http11Protocol start
INFO: Starting Coyote HTTP/1.1 on http-8084
31-Oct-2005 01:29:39 org.apache.coyote.http11.Http11Protocol start
INFO: Starting Coyote HTTP/1.1 on http-8443
31-Oct-2005 01:29:40 org.apache.jk.common.ChannelSocket init
INFO: JK2: ajp13 listening on /0.0.0.0:8009
31-Oct-2005 01:29:40 org.apache.jk.server.JkMain start
INFO: Jk running ID=0 time=0/60 config=null
31-Oct-2005 01:29:40 org.apache.catalina.storeconfig.StoreLoader load
INFO: Find registry server-registry.xml at classpath resource
31-Oct-2005 01:29:40 org.apache.catalina.startup.Catalina start
INFO: Server startup in 5738 ms
31-Oct-2005 01:29:40 org.apache.catalina.realm.JDBCRealm authenticate
SEVERE: Exception performing authentication
java.sql.SQLException: org.gjt.mm.mysql.Driver
at org.apache.catalina.realm.JDBCRealm.open(JDBCRealm.java:646)
at org.apache.catalina.realm.JDBCRealm.authenticate(JDBCRealm.java:344)
at org.apache.catalina.authenticator.BasicAuthenticator.authenticate(BasicAuthenticator.java:181)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:446)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:825)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:738)
at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:526)
at org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:80)
at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:684)
at java.lang.Thread.run(Thread.java:534)
31-Oct-2005 01:29:40 org.apache.catalina.realm.JDBCRealm authenticate
SEVERE: Exception performing authentication
java.sql.SQLException: org.gjt.mm.mysql.Driver
at org.apache.catalina.realm.JDBCRealm.open(JDBCRealm.java:646)
at org.apache.catalina.realm.JDBCRealm.authenticate(JDBCRealm.java:344)
at org.apache.catalina.authenticator.BasicAuthenticator.authenticate(BasicAuthenticator.java:181)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:446)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:825)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:738)
at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:526)
at org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:80)
at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:684)
at java.lang.Thread.run(Thread.java:534)The server.xml looks as follows:
<?xml version="1.0" encoding="UTF-8"?>
<!-- Example Server Configuration File -->
<!-- Note that component elements are nested corresponding to their
parent-child relationships with each other -->
<!-- A "Server" is a singleton element that represents the entire JVM,
which may contain one or more "Service" instances. The Server
listens for a shutdown command on the indicated port.
Note: A "Server" is not itself a "Container", so you may not
define subcomponents such as "Valves" or "Loggers" at this level.
-->
<Server port="8025" shutdown="SHUTDOWN">
<!-- Comment these entries out to disable JMX MBeans support used for the
administration web application -->
<Listener className="org.apache.catalina.mbeans.ServerLifecycleListener"/>
<Listener className="org.apache.catalina.mbeans.GlobalResourcesLifecycleListener"/>
<Listener className="org.apache.catalina.storeconfig.StoreConfigLifecycleListener"/>
<!-- Global JNDI resources -->
<GlobalNamingResources>
<!-- Test entry for demonstration purposes -->
<Environment name="simpleValue" type="java.lang.Integer" value="30"/>
<!-- Editable user database that can also be used by
UserDatabaseRealm to authenticate users -->
<!-- RAV
<Resource name="UserDatabase" auth="Container" type="org.apache.catalina.UserDatabase" description="User database that can be updated and saved" factory="org.apache.catalina.users.MemoryUserDatabaseFactory" pathname="conf/tomcat-users.xml"/>
-->
</GlobalNamingResources>
<!-- A "Service" is a collection of one or more "Connectors" that share
a single "Container" (and therefore the web applications visible
within that Container). Normally, that Container is an "Engine",
but this is not required.
Note: A "Service" is not itself a "Container", so you may not
define subcomponents such as "Valves" or "Loggers" at this level.
-->
<!-- Define the Tomcat Stand-Alone Service -->
<Service name="Catalina">
<!-- A "Connector" represents an endpoint by which requests are received
and responses are returned. Each Connector passes requests on to the
associated "Container" (normally an Engine) for processing.
By default, a non-SSL HTTP/1.1 Connector is established on port 8080.
You can also enable an SSL HTTP/1.1 Connector on port 8443 by
following the instructions below and uncommenting the second Connector
entry. SSL support requires the following steps (see the SSL Config
HOWTO in the Tomcat 5 documentation bundle for more detailed
instructions):
* If your JDK version 1.3 or prior, download and install JSSE 1.0.2 or
later, and put the JAR files into "$JAVA_HOME/jre/lib/ext".
* Execute:
%JAVA_HOME%\bin\keytool -genkey -alias tomcat -keyalg RSA (Windows)
$JAVA_HOME/bin/keytool -genkey -alias tomcat -keyalg RSA (Unix)
with a password value of "changeit" for both the certificate and
the keystore itself.
By default, DNS lookups are enabled when a web application calls
request.getRemoteHost(). This can have an adverse impact on
performance, so you can disable it by setting the
"enableLookups" attribute to "false". When DNS lookups are disabled,
request.getRemoteHost() will return the String version of the
IP address of the remote client.
-->
<!-- Define a non-SSL HTTP/1.1 Connector on port 8080 -->
<Connector port="8084" maxThreads="150" minSpareThreads="25" maxSpareThreads="75" enableLookups="false" redirectPort="8443" acceptCount="100" connectionTimeout="20000" disableUploadTimeout="true" URIEncoding="utf-8"/>
<!-- Note : To disable connection timeouts, set connectionTimeout value
to 0 -->
<!-- Note : To use gzip compression you could set the following properties :
compression="on"
compressionMinSize="2048"
noCompressionUserAgents="gozilla, traviata"
compressableMimeType="text/html,text/xml"
-->
<!-- Define a SSL HTTP/1.1 Connector on port 8443 -->
<Connector port="8443"
maxThreads="150" minSpareThreads="25" maxSpareThreads="75"
enableLookups="false" disableUploadTimeout="true"
acceptCount="100" scheme="https" secure="true"
clientAuth="false" sslProtocol="TLS" />
<!-- Define an AJP 1.3 Connector on port 8009 -->
<Connector port="8009" enableLookups="false" redirectPort="8443" protocol="AJP/1.3"/>
<!-- Define a Proxied HTTP/1.1 Connector on port 8082 -->
<!-- See proxy documentation for more information about using this. -->
<!--
<Connector port="8082"
maxThreads="150" minSpareThreads="25" maxSpareThreads="75"
enableLookups="false" acceptCount="100" connectionTimeout="20000"
proxyPort="80" disableUploadTimeout="true" />
-->
<!-- An Engine represents the entry point (within Catalina) that processes
every request. The Engine implementation for Tomcat stand alone
analyzes the HTTP headers included with the request, and passes them
on to the appropriate Host (virtual host). -->
<!-- You should set jvmRoute to support load-balancing via AJP ie :
<Engine name="Standalone" defaultHost="localhost" jvmRoute="jvm1">
-->
<!-- Define the top level container in our container hierarchy -->
<Engine name="Catalina" defaultHost="localhost">
<!-- The request dumper valve dumps useful debugging information about
the request headers and cookies that were received, and the response
headers and cookies that were sent, for all requests received by
this instance of Tomcat. If you care only about requests to a
particular virtual host, or a particular application, nest this
element inside the corresponding <Host> or <Context> entry instead.
For a similar mechanism that is portable to all Servlet 2.4
containers, check out the "RequestDumperFilter" Filter in the
example application (the source for this filter may be found in
"$CATALINA_HOME/webapps/examples/WEB-INF/classes/filters").
Request dumping is disabled by default. Uncomment the following
element to enable it. -->
<!--
<Valve className="org.apache.catalina.valves.RequestDumperValve"/>
-->
<!-- Because this Realm is here, an instance will be shared globally -->
<!-- This Realm uses the UserDatabase configured in the global JNDI
resources under the key "UserDatabase". Any edits
that are performed against this UserDatabase are immediately
available for use by the Realm. -->
<!-- RAV
<Realm className="org.apache.catalina.realm.UserDatabaseRealm" resourceName="UserDatabase"/>
-->
<!-- Comment out the old realm but leave here for now in case we
need to go back quickly -->
<!--
<Realm className="org.apache.catalina.realm.MemoryRealm" />
-->
<!-- Replace the above Realm with one of the following to get a Realm
stored in a database and accessed via JDBC -->
<Realm className="org.apache.catalina.realm.JDBCRealm"
driverName="org.gjt.mm.mysql.Driver"
connectionURL="jdbc:mysql://localhost:3306/tomcatusers"
connectionName="root" connectionPassword="sikhism1"
userTable="users" userNameCol="user_name" userCredCol="user_pass"
userRoleTable="user_roles" roleNameCol="role_name" />
<!--
<Realm className="org.apache.catalina.realm.JDBCRealm"
driverName="oracle.jdbc.driver.OracleDriver"
connectionURL="jdbc:oracle:thin:@ntserver:1521:ORCL"
connectionName="scott" connectionPassword="tiger"
userTable="users" userNameCol="user_name" userCredCol="user_pass"
userRoleTable="user_roles" roleNameCol="role_name" />
-->
<!--
<Realm className="org.apache.catalina.realm.JDBCRealm"
driverName="sun.jdbc.odbc.JdbcOdbcDriver"
connectionURL="jdbc:odbc:CATALINA"
userTable="users" userNameCol="user_name" userCredCol="user_pass"
userRoleTable="user_roles" roleNameCol="role_name" />
-->
<!-- Define the default virtual host
Note: XML Schema validation will not work with Xerces 2.2.
-->
<Host name="localhost" appBase="webapps" unpackWARs="true" autoDeploy="false" xmlValidation="false" xmlNamespaceAware="false">
<!-- Defines a cluster for this node,
By defining this element, means that every manager will be changed.
So when running a cluster, only make sure that you have webapps in there
that need to be clustered and remove the other ones.
A cluster has the following parameters:
className = the fully qualified name of the cluster class
name = a descriptive name for your cluster, can be anything
mcastAddr = the multicast address, has to be the same for all the nodes
mcastPort = the multicast port, has to be the same for all the nodes
mcastBindAddr = bind the multicast socket to a specific address
mcastTTL = the multicast TTL if you want to limit your broadcast
mcastSoTimeout = the multicast readtimeout
mcastFrequency = the number of milliseconds in between sending a "I'm alive" heartbeat
mcastDropTime = the number a milliseconds before a node is considered "dead" if no heartbeat is received
tcpThreadCount = the number of threads to handle incoming replication requests, optimal would be the same amount of threads as nodes
tcpListenAddress = the listen address (bind address) for TCP cluster request on this host,
in case of multiple ethernet cards.
auto means that address becomes
InetAddress.getLocalHost().getHostAddress()
tcpListenPort = the tcp listen port
tcpSelectorTimeout = the timeout (ms) for the Selector.select() method in case the OS
has a wakup bug in java.nio. Set to 0 for no timeout
printToScreen = true means that managers will also print to std.out
expireSessionsOnShutdown = true means that
useDirtyFlag = true means that we only replicate a session after setAttribute,removeAttribute has been called.
false means to replicate the session after each request.
false means that replication would work for the following piece of code: (only for SimpleTcpReplicationManager)
<%
HashMap map = (HashMap)session.getAttribute("map");
map.put("key","value");
%>
replicationMode = can be either 'pooled', 'synchronous' or 'asynchronous'.
* Pooled means that the replication happens using several sockets in a synchronous way. Ie, the data gets replicated, then the request return. This is the same as the 'synchronous' setting except it uses a pool of sockets, hence it is multithreaded. This is the fastest and safest configuration. To use this, also increase the nr of tcp threads that you have dealing with replication.
* Synchronous means that the thread that executes the request, is also the
thread the replicates the data to the other nodes, and will not return until all
nodes have received the information.
* Asynchronous means that there is a specific 'sender' thread for each cluster node,
so the request thread will queue the replication request into a "smart" queue,
and then return to the client.
The "smart" queue is a queue where when a session is added to the queue, and the same session
already exists in the queue from a previous request, that session will be replaced
in the queue instead of replicating two requests. This almost never happens, unless there is a
large network delay.
-->
<!--
When configuring for clustering, you also add in a valve to catch all the requests
coming in, at the end of the request, the session may or may not be replicated.
A session is replicated if and only if all the conditions are met:
1. useDirtyFlag is true or setAttribute or removeAttribute has been called AND
2. a session exists (has been created)
3. the request is not trapped by the "filter" attribute
The filter attribute is to filter out requests that could not modify the session,
hence we don't replicate the session after the end of this request.
The filter is negative, ie, anything you put in the filter, you mean to filter out,
ie, no replication will be done on requests that match one of the filters.
The filter attribute is delimited by ;, so you can't escape out ; even if you wanted to.
filter=".*\.gif;.*\.js;" means that we will not replicate the session after requests with the URI
ending with .gif and .js are intercepted.
The deployer element can be used to deploy apps cluster wide.
Currently the deployment only deploys/undeploys to working members in the cluster
so no WARs are copied upons startup of a broken node.
The deployer watches a directory (watchDir) for WAR files when watchEnabled="true"
When a new war file is added the war gets deployed to the local instance,
and then deployed to the other instances in the cluster.
When a war file is deleted from the watchDir the war is undeployed locally
and cluster wide
-->
<!--
<Cluster className="org.apache.catalina.cluster.tcp.SimpleTcpCluster"
managerClassName="org.apache.catalina.cluster.session.DeltaManager"
expireSessionsOnShutdown="false"
useDirtyFlag="true"
notifyListenersOnReplication="true">
<Membership
className="org.apache.catalina.cluster.mcast.McastService"
mcastAddr="228.0.0.4"
mcastPort="45564"
mcastFrequency="500"
mcastDropTime="3000"/>
<Receiver
className="org.apache.catalina.cluster.tcp.ReplicationListener"
tcpListenAddress="auto"
tcpListenPort="4001"
tcpSelectorTimeout="100"
tcpThreadCount="6"/>
<Sender
className="org.apache.catalina.cluster.tcp.ReplicationTransmitter"
replicationMode="pooled"
ackTimeout="15000"/>
<Valve className="org.apache.catalina.cluster.tcp.ReplicationValve"
filter=".*\.gif;.*\.js;.*\.jpg;.*\.png;.*\.htm;.*\.html;.*\.css;.*\.txt;"/>
<Deployer className="org.apache.catalina.cluster.deploy.FarmWarDeployer"
tempDir="/tmp/war-temp/"
deployDir="/tmp/war-deploy/"
watchDir="/tmp/war-listen/"
watchEnabled="false"/>
</Cluster>
-->
<!-- Normally, users must authenticate themselves to each web app
individually. Uncomment the following entry if you would like
a user to be authenticated the first time they encounter a
resource protected by a security constraint, and then have that
user identity maintained across *all* web applications contained
in this virtual host. -->
<!--
<Valve className="org.apache.catalina.authenticator.SingleSignOn" />
-->
<!-- Access log processes all requests for this virtual host. By
default, log files are created in the "logs" directory relative to
$CATALINA_HOME. If you wish, you can specify a different
directory with the "directory" attribute. Specify either a relative
(to $CATALINA_HOME) or absolute path to the desired directory.
-->
<!--
<Valve className="org.apache.catalina.valves.AccessLogValve"
directory="logs" prefix="localhost_access_log." suffix=".txt"
pattern="common" resolveHosts="false"/>
-->
<!-- Access log processes all requests for this virtual host. By
default, log files are created in the "logs" directory relative to
$CATALINA_HOME. If you wish, you can specify a different
directory with the "directory" attribute. Specify either a relative
(to $CATALINA_HOME) or absolute path to the desired directory.
This access log implementation is optimized for maximum performance,
but is hardcoded to support only the "common" and "combined" patterns.
-->
<!--
<Valve className="org.apache.catalina.valves.FastCommonAccessLogValve"
directory="logs" prefix="localhost_access_log." suffix=".txt"
pattern="common" resolveHosts="false"/>
-->
<!-- Access log processes all requests for this virtual host. By
default, log files are created in the "logs" directory relative to
$CATALINA_HOME. If you wish, you can specify a different
directory with the "directory" attribute. Specify either a relative
(to $CATALINA_HOME) or absolute path to the desired directory.
This access log implementation is optimized for maximum performance,
but is hardcoded to support only the "common" and "combined" patterns.
This valve use NIO direct Byte Buffer to asynchornously store the
log.
-->
<!--
<Valve className="org.apache.catalina.valves.ByteBufferAccessLogValve"
directory="logs" prefix="localhost_access_log." suffix=".txt"
pattern="common" resolveHosts="false"/>
-->
</Host>
</Engine>
</Service>
</Server>Many thanks, and apologies for "dumping" all of the code here.So looking through the java api docs, I found that the tcUtilJDBCOperations has a connect string for the database. Below is the info it outlines. The questions I have it this. How do you specify the psdriver and URL along with do I need to do this as a persistent instance then add my selectstatement as a part of this or can I just specify this and the select statement will use this connection? Any help you can give would be appreciated.
tcUtilJDBCOperations
public tcUtilJDBCOperations(java.lang.String psDriver,
java.lang.String psUrl,
java.lang.String psUsername,
java.lang.String psPassword)Contructor that sets the parameters for connecting to a database
Parameters:
psDriver - The class name of the jdbc driver
psUrl - The URL of the database
psUsername - The username required to access the database
psPassword - The password for the above username
Nick -
JDBC Realm issue on Tomcat 4.0.1
Hi folks,
Tried this one the Sun forum and haven't had luck yet getting a thorough reply.
Trying to establish the JDBC realm config in Tomcat and am getting the following error:
Starting service Tomcat-Standalone
Apache Tomcat/4.0.1
Catalina.start: LifecycleException: Exception opening database connection: jav
a.sql.SQLException: [Microsoft][ODBC Driver Manager] Data source name too long
LifecycleException: Exception opening database connection: java.sql.SQLExcepti
on: [Microsoft][ODBC Driver Manager] Data source name too long
at org.apache.catalina.realm.JDBCRealm.start(JDBCRealm.java:615)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1108)
my configuration in the web.xml file is as follows;
<Realm className="org.apache.catalina.realm.JDBCRealm" debug="99"
driverName="sun.jdbc.odbc.JdbcOdbcDriver"
connectionURL="jdbc:odbc:DSNname@host_string:1521:ORCL?user=user_name;password=pwd_name"
userTable="chg_users" userNameCol="user_name" userCredCol="user_pass"
userRoleTable="chg_users_roles" roleNameCol="role_name" />
does the above appear incorrect? If so, specifically how?
Thanks!connectionURL="jdbc:odbc:CATALINA"
in this case, where is CATALINA supposedly pointing
to a DB connection? I don't have mine set, save for
maybe the classpath, but why would you point the
connURL through jdbc:odbc to CATALINA?
That is the name of a DNS. The ODBC shell (nothing to do with java) has DNS names. The shell uses the passed in name to look up the attributes associated with the name.
If you were using a DNS-less name then you would have to specify ODBC driver (nothing to do with java) and the associated attributes for that driver in the connection string.
I'm a little confused by this. Any explanation would
be great, as I have a driver that is jdbc:odbc,
rather than an exclusive Oracle driver.
Well, I've got the ojdbc14_g.jar file. But that's not
exclusively Oracle, correct? Just for JDBC with
Oracle?
A jdbc driver lives somewhere. The bridge driver lives in the Sun VM. The Oracle driver lives in a jar (current ones.)
The bridge driver talks to ODBC (which is outside of java.)
The oracle drivers talk to oracle databases. -
Connection Failure for JDBC system in Session Bean using JCA
Hi,
I am trying to write a session bean that runs a query
against a JDBC system, but I keep seeing the following
error in the default trace file in the J2EE log folder:
14##0#0#Path##Java###Throwing
#1#java.sql.SQLException: Invalid connection string
attribute: Database name is required but not supplied#
#1.5#
This is the code, with the line marked (*) being the point where the exception is thrown:
public void getConnection(String sURL, String sUser, String sPassword) {
ManagedConnectionFactory mcf = null;
IConnectionFactory cf = null;
IConnectionSpec cs = null;
try {
mcf = new JDBCManagedConnectionFactory();
cf = (IConnectionFactory) mcf.createConnectionFactory();
cs = cf.getConnectionSpec();
cs.setPropertyValue("UserName", "sa");
cs.setPropertyValue("Password", "admin");
cs.setPropertyValue"driver",
"com.sap.portals.jdbc.sqlserver.SQLServerDriver");
cs.setPropertyValue("url",
"jdbc:sap:sqlserver://localhost:1433;DatabaseName=pubs");
conn = cf.getConnectionEx(cs); (*)
I have tried adding another property value, like so:
cs.setPropertyValue( "DatabaseName", "pubs");
(or) cs.setPropertyValue( "Database", "pubs" );
but I still get the same exception. What does this
exception really mean, what is missing from the
configuration information ?
Also, in the default trace file of the J2EE engine, the
configuration information is printed out, but in an
encrypted format, (see below), is it possible to have it
print out this information in a readable format ?
#1.5#005056A41E66006200000092000009AC000406E03C94F3D9#1133460065906#com.sap.portal.connectors.JDBC#sap.com/CFV3#com.sap.portal.connectors.JDBC#Guest#0####71758520629411daacf7005056a41e66#SAPEngine_Application_Thread[impl:3]_14##0#0#Info##Plain###UserName: ????n????????????????????d?????????????????????????????????????????????s???????????????????????????????????????????????0??????????????????????????????????????????????????h?????0??????R???????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????s?????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????c???????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????u??????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????c???????????????????????????????????????????c????????????????3?????????3????e??????????????????????????????????????????????????l???????0????????1????1?????????????????????????????????????????????????????????s?????p?????????????????????????????????????????????????????????????????6?????????????3??????????????s????????????????????t???????????s????????????????????????????????????????????????????????????????????????s????????????????????????????????????????????????????????s?????????????????????????????????g????????????????????????????????????????????????????????????????????????? Password: ******** URL: ???????????????n??????????????????????????????????????????????????????????????????????????0?????e??????????????????????????r?????????????s?????????????O??????????????2???????????7????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????:????5???T?????????????????????????l?????????1????????????????????????????????????????????????????????????????????????????2??????????????????????????????????????????????????????????????????????????????????????????????????h???????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????a??????????????????????????????????????????????????????????????????????????????????????????????????S??????????????????????????????????????????????????????????????????????????????????2???????????????????????????u???????????????????????????????????????????????????????????????????????s???????????????????????????????????????????????????????????????????????????????????????????????s?????????????????????????????????????????.?????????????????????????????????????????????????????????????????1????????????????????????????????????l????5??????????? Driver: com.sap.portals.jdbc.sqlserver.SQLServerDriver#
#1.5#0Hi Vladimir,
thanks for your response. The reason I am accessing a
JDBC source via JCA is to get a feel for how JCA works.
What I ultimately want to do is construct a bean that can
give queries to different kinds of sources; JDBC, and SAP
(R3, CRM), and possibly sources like Siebel. For this, I
believe I should use the Connector Gateway Service, as
described in the "Using the JDBC Connector" and "Using
the SAP Backend System Connector" sections of the SAP
Portal Developer's Guide. But for now, my first approach
was to use the approach described in "Connecting via
J2EE" subsection of "Using the JDBC Connector" (see
http://help.sap.com/saphelp_nw04/helpdata/en/30/a0f17aacb34b108b39a96acc33da3f/content.htm)
Thanks,
Colm. -
JDBC realm of FORM authentication in Web AS 640
Hi, All,
We try to port a web application from Apache Tomcat to WebAS 6.40. In the application we use FORM authentication based on Tomcat JDBC Realm. The configuration in Tomcat server.xml is like:
<Context...>
<Resource name="jdbc/mydb" auth="Container" type="javax.sql.DataSource" username="..." password="..." driverClassName="..." url="..."/>
<Realm className="org.apache.catalina.realm.DataSourceRealm" dataSourceName="jdbc/mydb" digest="MD5" userTable="users" userNameCol="userName" userCredCol="passwd" userRoleTable="roles" roleNameCol="roleType"/>
</Context>
In database there are 2 tables for authentication purpose: users and roles. There are column userName, passwd in table users and userName, roleType in table roles (correlated with column userName). Then in web.xml we define FORM authentication:
<login-config>
<auth-method>FORM</auth-method>
<realm-name>...</realm-name>
<form-login-config>
<form-login-page>...</form-login-page>
<form-error-page>...</form-error-page>
</form-login-config>
</login-config>
Has anyone tried to port Tomcat JDBC realm mechanism of FORM authentication to WebAS 640? How do we need to configure J2EE server in Visual Administrator or deploy an application with DeployTool to implement the same features? And does WebAS support declarative MD5 digest algorithm in FORM Authentication?
Any help is highly appreciated.
Thanks in advance
Johnevnafets wrote:
The way it works is that you declare which pages in your application have got security around them in your web.xml. Whenever a user tries to navigate to one of those pages, they are presented with the login screen. If they login successfully, then they are taken to the page they originally requested.
You should never actually have a link to your login page - the container will serve it when required.Ok, but how do i stop them entering the URL of the login page?
i get this error after logging in correctly if i directly access the login page:
"HTTP Status 400 - Invalid direct reference to form login page"
i tried adding this constraint but it still happens:
<security-constraint>
<web-resource-collection>
<web-resource-name>login</web-resource-name>
<url-pattern>/staffLogin/login.jsp</url-pattern>
</web-resource-collection>
<auth-constraint/>
</security-constraint>
>
One possible way around this would be to create a database view which is a union of the two tables, thus giving you one "table" to query for the username/password/role combinations. That should satisfy the realm requirement.
Cheers,
evnafetsThats a good idea, il give that a shot. Thanks. -
hi,Good evening ,this is my First post in sun.com.......
I am trying to provide Form authentication and authorization in my we application (facelets,glashfish).For this I create one sample database with tables user and grouptable and finally created JDBC realm in glassfish server Successfully.
so this authentication and auth with JSP pages I am success fully providing .But i want with .jsf(.xhtml).I am getting struggle in how to call j_security_check from .xhtml page.But this same method I am successfully calling from .jsp(action="j_security_check").so can u please help me how to call j_security_check from .xhtml. page And what is the configuration for displaying success.xhtml and fail.xhtml after click on submit button in login.xhtml
web.xml
<web-app>
<context-param>
<param-name>javax.faces.STATE_SAVING_METHOD</param-name>
<param-value>client</param-value>
</context-param>
<context-param>
<param-name>com.sun.faces.validateXml</param-name>
<param-value>true</param-value>
</context-param>
<context-param>
<param-name>com.sun.faces.verifyObjects</param-name>
<param-value>true</param-value>
</context-param>
<context-param>
<param-name>facelets.SKIP_COMMENTS</param-name>
<param-value>true</param-value>
</context-param>
<context-param>
<param-name>facelets.DEVELOPMENT</param-name>
<param-value>false</param-value>
</context-param>
<context-param>
<param-name>org.richfaces.SKIN</param-name>
<param-value>DEFAULT</param-value>
</context-param>
<context-param>
<param-name>javax.faces.DEFAULT_SUFFIX</param-name>
<param-value>.xhtml</param-value>
</context-param>
<servlet>
<servlet-name>Faces Servlet</servlet-name>
<servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>Faces Servlet</servlet-name>
<url-pattern>*.jsf</url-pattern>
</servlet-mapping>
<error-page>
<error-code>403</error-code>
<location>/accesdenaid.jsp</location>
</error-page>
<filter>
<display-name>RichFaces Filter</display-name>
<filter-name>richfaces</filter-name>
<filter-class>org.ajax4jsf.Filter</filter-class>
</filter>
<filter-mapping>
<filter-name>richfaces</filter-name>
<servlet-name>Faces Servlet</servlet-name>
<dispatcher>REQUEST</dispatcher>
<dispatcher>FORWARD</dispatcher>
<dispatcher>INCLUDE</dispatcher>
</filter-mapping>
<welcome-file-list>
<welcome-file>/forward.jsp</welcome-file>
</welcome-file-list>
<security-constraint>
<web-resource-collection>
<web-resource-name>Protected Area</web-resource-name>
<url-pattern>/pages/cpdownloader/*</url-pattern>
<http-method>POST</http-method>
<http-method>GET</http-method>
</web-resource-collection>
<auth-constraint>
<role-name>admin</role-name>
</auth-constraint>
<!-- <user-data-constraint>
<transport-guarantee>CONFIDENTIAL</transport-guarantee>
</user-data-constraint> -->
</security-constraint>
<security-constraint>
<web-resource-collection>
<web-resource-name>Protected Area</web-resource-name>
<url-pattern>/pages/cprequester/*</url-pattern>
<http-method>POST</http-method>
<http-method>GET</http-method>
</web-resource-collection>
<auth-constraint>
<role-name>user</role-name>
</auth-constraint>
<!-- <user-data-constraint>
<transport-guarantee>CONFIDENTIAL</transport-guarantee>
</user-data-constraint> -->
</security-constraint>
<login-config>
<auth-method>FORM</auth-method>
<!--<realm-name>default</realm-name>-->
<realm-name>enrollmentsrealm</realm-name>
</login-config>
<security-role>
<role-name>admin</role-name>
</security-role>
<security-role>
<role-name>user</role-name>
</security-role>
</web-app>and login.xhtml
<ui:composition template="/templates/login_layout.xhtml">
<ui:define name="body">
<h:form id="loginForm1">
<table align="center" cellspacing="0" cellpadding="0">
<tr>
<td height="30px"></td>
</tr>
<tr align="center" >
<td align="center" colspan="2" class="pagetitle">Requester Login</td>
</tr>
<tr>
<td height="10px" ></td>
</tr>
<tr>
<td class="labelname">User Name *</td>
<td class="label"><h:inputText id="j_username" value="#{LoginBean.userName}"/>
</td>
</tr>
<tr>
<td class="labelname">Password </td>
<td class="label"><h:inputSecret id="j_password" value="#{LoginBean.password}"/></td>
</tr><br/>
<tr>
<td colspan="2" height="5px" ></td>
</tr>
<tr>
<td> </td>
<td class="buttonsalign">
<h:commandButton id="login1" value="Login" styleClass="buttonstyle" action="#{LoginBean.submit}"/>
</td>
</tr>
<tr>
<td colspan="2" height="25px" ></td>
</tr>
</table>
</h:form>
</ui:define>
</ui:composition>can u please help me where i did mistake
thanks in advanceI am also having problems trying to get an appclient authenticated.
Could someone post a working example app or provide a link to an example ? -
Hi,
I have been trying to get the JDBC Realm to work, but with no success,
I get the following error:
Catalina.start: LifecycleException: Exception opening database connection: java.sql.SQLException
LifecycleException: Exception opening database connection: java.sql.SQLException
(see bottom of page for more detail)
I have successfully connected to the database and retrieved data using the following code
// Define the JDBP Driver and the database connection URL
public static final String driver = "org.gjt.mm.mysql.Driver";
public static final String url = "jdbc:mysql://localhost/db?user=un&password=pw";
public static void main(String args[])
Connection conn;
try
Class.forName(driver); // load the driver dynamically
conn = DriverManager.getConnection(url); // connect to the database
// perform a query. first create a Statement object from the connection
Statement select = conn.createStatement();
// next execute a query (SQL string) and return the results in a ResultSet object
ResultSet result = select.executeQuery("select * from users");
// print out the results
while(result.next())
String user = result.getString("user_name"); // note these match the columns in the
String password = result.getString("user_pass"); // SELECT statement
System.out.println(user + " " + password);
select.close(); //Close the query
conn.close(); //Close the database connection
however I have no luck in connecting using the JDBC Realm, I am using j2re1.4.1_01, jwsdp-1_0_01 & mysql-connector-java-3.1.0-alpha and the com & org directories are in $JWSDP_HOME/common/lib/ I have also put a copy of the mysql-connector-java-3.1.0-alpha.jar in $JWSDP_HOME/server/lib/ in an effort to get this to work!!
my $JWSDP_HOME/conf/server.xml contains
<Realm className="org.apache.catalina.realm.JDBCRealm" debug="99" driver="org.gjt.mm.mysql.Driver"
connectionURL="jdbc:mysql://localhost/db?user=un;password=pw"
userTable="users" usserNameCol="user_name" userCredCol="user_pass"
userRoleTable="user_roles" roleNameCol="role_name" />
I hope someone can shed some light on this as I have been reading a lot of threads about this however they all seem to have the driver name included in the Exception error and I don't get that in the error message, so I am assuming that the driver is working and there is another error.....
Cheers in advance
Contentents of $JWSDP_HOME/logs/catalina.outStarting service Internal Services
Java Web Services Developer Pack/1.0_01-fcs
Catalina.start: LifecycleException: Exception opening database connection: java.sql.SQLException
LifecycleException: Exception opening database connection: java.sql.SQLException
at org.apache.catalina.realm.JDBCRealm.start(JDBCRealm.java:683)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1175)
at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:347)
at org.apache.catalina.core.StandardService.start(StandardService.java:499)
at org.apache.catalina.core.StandardServer.start(StandardServer.java:2187)
at org.apache.catalina.startup.Catalina.start(Catalina.java:504)
at org.apache.catalina.startup.Catalina.execute(Catalina.java:399)
at org.apache.catalina.startup.Catalina.process(Catalina.java:179)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:324)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:203)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:324)
at com.sun.launcher.Launcher.main(Launcher.java:208)
----- Root Cause -----
java.sql.SQLException
at org.apache.catalina.realm.JDBCRealm.open(JDBCRealm.java:606)
at org.apache.catalina.realm.JDBCRealm.start(JDBCRealm.java:681)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1175)
at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:347)
at org.apache.catalina.core.StandardService.start(StandardService.java:499)
at org.apache.catalina.core.StandardServer.start(StandardServer.java:2187)
at org.apache.catalina.startup.Catalina.start(Catalina.java:504)
at org.apache.catalina.startup.Catalina.execute(Catalina.java:399)
at org.apache.catalina.startup.Catalina.process(Catalina.java:179)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:324)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:203)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:324)
at com.sun.launcher.Launcher.main(Launcher.java:208)
Stopping service Internal Services
Catalina.stop: LifecycleException: Coyote connector has not been started
LifecycleException: Coyote connector has not been started
at org.apache.coyote.tomcat4.CoyoteConnector.stop(CoyoteConnector.java:1043)
at org.apache.catalina.core.StandardService.stop(StandardService.java:549)
at org.apache.catalina.core.StandardServer.stop(StandardServer.java:2223)
at org.apache.catalina.startup.Catalina.start(Catalina.java:535)
at org.apache.catalina.startup.Catalina.execute(Catalina.java:399)
logs/catalina.outokayyyy.... now i got ur point. I think its not much
difficult. Lets take it step-by-step.
That's what I thought and it's still not working .....
As a first step, you have to create 3 tables in your
mySql database for authentication purposes. Lets name
those tables: (1) user, (2) roles (3) user_roles.
'user' will contain fields regarding user name and
password, 'roles' will contain only 1 field specific
to role names and finally 'user_roles' is a mapping
table which contain user names and their
corresponding role names (obviously from 'roles'
table). This completes the database in mySQL that
will help you to authenticate your users.
I have added the roles table, not that they are referenced in the JDBC Realm connector ????
>
Now, its time to configure your web container, i.e.
Tomcat to use this database (in terms of JDBCRealm).
Make sure that tomcat services are stopped and then
open server.xml file in any ANSII compliant editor.
Search for any real tag (<Realm ... ) already placed
in your xml file. If there would be any, then you
should find under the <Engine> tag. Now place your own
<Realm> tag under the <Engine> tag.
It should be something like:
<Realm className="org.apache.catalina.realm.JDBCRealm"
debug="99"
driverName="org.gjt.mm.mysql.Driver"
connectionURL="jdbc:mysql://localhost:3306/tomcatusers"
connectionName="root"
connectionPassword=""
userTable="users"
userNameCol="user_name"
userCredCol="user_pass"
userRoleTable="user_roles"
roleNameCol="role_name"/>
Yup already done... now slightly modified
>
Plz double check "connectionName" and
"connectionPassword" attributes to match your own
user-name and passwords for your mySql db. This will
complete the whole process, just start your Tomcat
services again and see if that work. I hope it will
help you, plz must tell me about progress -:)
Raheel.
mysql -u tomcat -p
mysql> select a.user_name, b.role_name from users a, user_roles b
-> where a.user_name=b.user_name;
----------------------+
| user_name | role_name |
----------------------+
| daren | employee |
| tomcat | admin |
| tomcat | manager |
| tomcat | provider |
----------------------+
can you guess what happened????
IT DONT WORK :( -
What driver should I use for O8.1.6 using RedHat 6.2 Linux
Thanks
P.S. Please respond to [email protected]the jdbc driver readme file:
Oracle JDBC Drivers release 8.1.7 README
========================================
What Is New In This Release?
These are the major new features/enhancements in this release:
- Statement Caching
* Implicit Statement Caching
* Explicit Statement Caching
- Full XA Support
* Including XA Recover and Forget
* OracleXid independent implementation for 8.1.7 servers and above
- Connection Caching
* New Scheme (FIXED_WAIT_SCHEME)
* Statement Caching coupling
- PLSQL Tables Support for Scalar types (for OCI driver only)
- User-Defined Datatypes Performance Enhancement
- Object Types Extensions
* Serializable Type Descriptors
* Accessing collection elements in Java primitive types
* Buffering and indexing collection elements
* Creating empty Lobs
- Support for 56-bit encryption algorithms for connection using
the Thin JDBC driver.
These are the major bug fixes:
- BUG-903011
The JDBC Thin driver could not be used with usernames that
contained Latin-1 characters when the server used UTF8 character
set. This problem has been fixed in release 8.1.7.
- BUG-1052489
There was a problem with PreparedStatements being executed
multiple times and the length of one of the bind variables (bound
with setBinaryStream or setCharacterStream) increased. This
problem has been fixed in release 8.1.7.
- BUG-1069768
There was a problem with insertion of ADTs with an image bigger
than 4K with the JDBC Thin driver. This problem has been fixed
in release 8.1.7.
- BUG-1247015
When using ResultSet::getObject() to access CHAR or VARCHAR columns
in scrollable result sets, ResultSet::getObject() returned null.
- BUG-1349713
getString() of scrollable result sets returns incorrect values if
the column data contains multibyte characters.
Driver Versions
These are the driver versions in the 8.1.7 release:
- JDBC OCI Driver 8.1.7
Client-side JDBC for use on a machine where OCI 8.1.7 is installed.
- JDBC Thin Driver 8.1.7
100% Java client-side JDBC for use in applets and applications.
- JDBC Thin Server-side Driver 8.1.7
JDBC for use by Java Stored Procedures or by Java CORBA objects
running in Oracle 8.1.7. This driver is typically used in a middle
tier server.
- JDBC Server-side Internal Driver 8.1.7
Server-side JDBC for use by Java Stored procedures or by Java CORBA
objects running in Oracle 8.1.7. This driver used to be called the
"JDBC Kprb Driver".
For complete documentation, please refer to "JDBC Developer's Guide
and Reference".
Contents Of This Release
The [ORACLE_HOME]/jdbc/lib directory contains:
- classes111.zip
Classes for use with JDK 1.1.x. It contains the JDBC driver
classes except classes necessary for NLS support in Object and
Collection types.
- nls_charset11.zip
NLS classes for use with JDK 1.1.x. It contains classes necessary
for NLS support in Object and Collection types.
- classes111_g.zip
Same as classes111.zip, except that classes were compiled with
"javac -g".
- classes12.zip
Classes for use with JDK 1.2.x. It contains the JDBC driver
classes except classes necessary for NLS support in Object and
Collection types.
- nls_charset12.zip
NLS classes for use with JDK 1.2.x. It contains classes necessary
for NLS support in Object and Collection types.
- classes12_g.zip
Same as classes12.zip, except that classes were compiled with
"javac -g".
Note that the packaging of the JDBC classes to support NLS was
changed in 8i. The classes pertaining to specific character sets
support in Object and Collection types have been separated from the
basic zip files. These NLS classes are now packaged into the
extension zip files. This allows the user to include the NLS
classes only if necessary. Please refer to the "NLS Extension Zip
Files (for client-side only)" for further details.
[ORACLE_HOME]/lib directory contains libocijdbc8.so and
libocijdbc8_g.so (on Solaris), which are the shared libraries used by
the JDBC OCI driver.
[ORACLE_HOME]/jdbc/doc/javadoc.tar contains the JDBC Javadoc. This
release contains a beta release of the Javadoc files for the public
API of the public classes of Oracle JDBC.
[ORACLE_HOME]/jdbc/demo/demo.tar contains sample JDBC programs.
Demo programs written for JDK 1.1 must be modified to run in JDK 1.2.
Please refer to the "Support For JDK 1.2" for porting details.
NLS Extension Zip Files (for client-side only)
The JDBC Server-side Internal Driver provides complete NLS support.
It does not require any NLS extension zip files, nls_charset*.zip.
Discussions in this section do not apply to the JDBC Server-side
Internal Driver. You can skip this section if you only use the
Server-side Internal Driver.
The basic zip files, classes111.zip and classes12.zip, contain all the
necessary classes to provide complete NLS support for:
- Oracle Character sets for CHAR/VARCHAR/LONGVARCHAR/CLOB type data
that is not retrieved or inserted as a data member of an Oracle 8
Object or Collection type.
- NLS support for CHAR/VARCHAR data members of Objects and
Collections for a few commonly used character sets. These
character sets are: US7ASCII, WE8DEC, WE8ISO8859P1 and UTF8.
Users must include the appropriate extension zip in their CLASSPATH
if utilization of other character sets in CHAR/VARCHAR data members
of Objects/Collections is desired. It is important to note that
extension zip files are large in size due to the requirement of
supporting a large number of character sets. Users may choose to
include only the necessary classes from the extension zip file.
To do so, users can first unzip the extension zip file, and then put
only the necessary classes in the CLASSPATH. The character set
extension class files are named in the following format:
CharacterConverter<OracleCharacterSetId>.class
where <OracleCharacterSetId> is the hexidecimal representation of the
Oracle character set id of the corresponding character set.
Installation
Please do not try to put multiple versions of the Oracle JDBC drivers
in your CLASSPATH. The Oracle installer installs the JDBC Drivers in
the [ORACLE_HOME]/jdbc directory.
Setting Up Your Environment
On Win95/Win98/NT:
- Add [ORACLE_HOME]\jdbc\lib\classes111.zip and
[ORACLE_HOME]\jdbc\lib\nls_charset11.zip to your CLASSPATH.
(Add classes12.zip and nls_charset12.zip if JDK 1.2.x is used.)
- Add [ORACLE_HOME]\jdbc\lib to your PATH.
On Solaris/Digital Unix:
- Add [ORACLE_HOME]/jdbc/lib/classes111.zip and
[ORACLE_HOME]/jdbc/lib/nls_charset11.zip to your CLASSPATH.
(Add classes12.zip and nls_charset12.zip if JDK 1.2.x is used.)
- Add [ORACLE_HOME]/jdbc/lib to your LD_LIBRARY_PATH.
On HP/UX:
- Add [ORACLE_HOME]/jdbc/lib/classes111.zip and
[ORACLE_HOME]/jdbc/lib/nls_charset11.zip to your CLASSPATH.
(Add classes12.zip and nls_charset12.zip if JDK 1.2.x is used.)
- Add [ORACLE_HOME]/jdbc/lib to your SHLIB_PATH and LD_LIBRARY_PATH.
On AIX:
- Add [ORACLE_HOME]/jdbc/lib/classes111.zip and
[ORACLE_HOME]/jdbc/lib/nls_charset11.zip to your CLASSPATH.
(Add classes12.zip and nls_charset12.zip if JDK 1.2.x is used.)
- Add [ORACLE_HOME]/jdbc/lib to your LIBPATH and LD_LIBRARY_PATH.
Some Useful Hints In Using the JDBC Drivers
Please refer to "JDBC Developer's Guide and Reference" for details
regarding usage of Oracle's JDBC Drivers. This section only offers
useful hints. These hints are not meant to be exhaustive.
These are a few simple things that you should do in your JDBC program:
1. Import the necessary JDBC classes in your programs that use JDBC.
For example:
import java.sql.*;
import java.math.*;
2. Register the Oracle driver before before calling other JDBC APIs.
(This is not needed if you are using the JDBC Server-side Internal
Driver because registration is done automatically in the server.)
To register the Oracle driver, make sure the following statement
is executed at least once in your Java session:
DriverManager.registerDriver(
new oracle.jdbc.driver.OracleDriver());
3. Open a connection to the database with the getConnection call.
Different connection URLs should be used for different JDBC
drivers. The following examples demonstrate the different URLs.
For the JDBC OCI8 Driver:
Connection conn = DriverManager.getConnection(
"jdbc:oracle:oci8:@<database>",
"scott", "tiger");
where <database> is either an entry in tnsnames.ora or a SQL*net
name-value pair.
For the JDBC Thin Driver, or Server-side Thin Driver:
Connection conn = DriverManager.getConnection(
"jdbc:oracle:thin:@<database>",
"scott", "tiger");
where <database> is either a string of the form
<host>:<port>:<sid> or a SQL*net name-value pair.
For the JDBC Server-side Internal Driver:
Connection conn = DriverManager.getConnection(
"jdbc:oracle:kprb:");
Note that the trailing ':' character is necessary. When you use
the Server-side Internal Driver, you always connect to the
database you are executing in. You can also do this:
Connection conn
= new oracle.jdbc.driver.OracleDriver().defaultConnection();
Java Stored Procedures
Please note that examples for callins and instance methods using Oracle
8 Object Types are provided in:
[ORACLE_HOME]/javavm/demo/demo.zip
Once unzipped, the directory containing the examples is:
[ORACLE_HOME]/javavm/demo/examples/jsp
Known Problems/Limitations In This Release
The following is a list of known problems/limitations:
1. There is a limitation regarding the use of stream input for LOB
types. Stream input for LOB types can only be used for 8.1.7
JDBC OCI driver connecting to an 8.1.7 Oracle server. The use of
stream input for LOB types in all other configurations may result
in data corruption. PreparedStatement stream input APIs include:
setBinaryStream(), setAsciiStream(), setUnicodeStream(),
setCharacterStream() and setObject().
2. BUG-1018797
Extra characters may be appended to the end of a CLOB value
mistakenly under the following conditions:
- setCharacterStream() is used to insert a CLOB value, and
- The Oracle server uses multi-byte character set.
(See 1 for limitation of stream input for LOB type.)
3. Programs can fail to open 16 or more connections using our
client-side drivers at any one time. This is not a limitation
caused by the JDBC drivers. It is most likely that the limit of
per-process file descriptors is exceeded. The solution is to
increase the limit.
4. The Server-side Internal Driver has the following limitation:
- Data access for LONG and LONG RAW types is limited to 32K of
data.
- Inserts of Object Types (Oracle 8 Objects, Collections and
References) will not work when the database compatibility mode
is set to 8.0. This limitation does not apply when the
compatibility mode is set to 8.1.
- Statement.cancel() is not implemented.
- In a chain of SQLExceptions, only the first one in the chain
will have a getSQLState value.
5. The JDBC OCI driver on an SSL connection hangs when the Java
Virtual Machine is running in green threads mode. A work-around
is to run the Java Virtual Machine in native threads mode.
6. Date-time format, currency symbol and decimal symbols are always
presented in American convention.
7. When using OracleStatement.defineColumnType(), it is not necessary
to define the column type to be the same as the column type
declared in the database. If the types are different, the
retrieved values are converted to the type specified in
defineColumnType.
Note: Most reasonable conversions work, but not all. If you find
a conversion that you think is reasonable, but that does not wo rk,
please submit a TAR to Oracle Support.
8. The utility dbms_java.set_output or dbms_java.set_stream that is
used for redirecting the System.out.println() in JSPs to stdout
SHOULD NOT be used when JDBC tracing is turned on. This is
because the current implementation of dbms_java.set_output and
set_stream uses JDBC to write the output to stdout. The result
would be an infinite loop.
9. The JDBC OCI and Thin drivers do not read CHAR data via binary
streams correctly. In other word, using getBinaryStream() to
retrieve CHAR data may yield incorrect results. A work-around is
to use either getCHAR() or getAsciiStream() instead. The other
alternative is to use getUnicodeStream() although the method is
deprecated.
10. BUG-899078 (since 8.1.6 SDK):
The JDBC Server-side Internal driver has extra space padding with
PL/SQL CHAR OUT (2 to 3 space depending on character set).
Problem occurs in most of the multibyte database character set
except UTF8.
11. There is a limitation for Triggers implemented in Java and Object
Types. It only affects the IN argument types of triggers
implemented using Java on the client-side. The restriction does
not apply to JDBC programs running inside the server. Triggers
implemented as Java methods cannot have IN arguments of Oracle 8
Object or Collection type. This means the Java methods used to
implement triggers cannot have arguments of the following types:
- java.sql.Struct
- java.sql.Array
- oracle.sql.STRUCT
- oracle.sql.ARRAY
- oracle.jdbc2.Struct
- oracle.jdbc2.Array
- any class implementing oracle.jdbc2.SQLData or
oracle.sql.CustomDatum
12. The scrollable result set implementation has the following
limitation:
- setFetchDirection() on ScrollableResultSet is not supported.
- refreshRow() on ScrollableResultSet does not support all
combinations of sensitivity and concurrency. The following
table depicts the supported combinations.
Support Type Concurrency
no TYPE_FORWARD_ONLY CONCUR_READ_ONLY
no TYPE_FORWARD_ONLY CONCUR_UPDATABLE
no TYPE_SCROLL_INSENSITIVE CONCUR_READ_ONLY
yes TYPE_SCROLL_INSENSITIVE CONCUR_UPDATABLE
yes TYPE_SCROLL_SENSITIVE CONCUR_READ_ONLY
yes TYPE_SCROLL_SENSITIVE CONCUR_UPDATABLE
13. BUG-1324918
Repeatedly updating a clob with jdbc-oci, prepared statement,
and setCharacterStream consumes the temporary tablespace. If
you repeatedly update the clob, either the temp tablespace will
continue to grow, or you may get a Exception in thread "main"
java.sql.SQLException: ORA-01652: unable to extend segment if
you have a limit on the tablespace size. The work-around is to
use oracle.sql.CLOB::setCharacterOutputStream() instead. -
I have a problem with JDBC Realm in Tomcat/Oracle/Win XP
I have a problem with JDBC Realm in Tomcat.
I have attached my server.xml file located in the
C:\Program Files\Apache Software Foundation\Tomcat 5.5\conf\server.xml
The Problem is that when I login I get the user name and password prompt but it does not resolve.
When I enter in the tomcat-users.xml password with memory realm uncommented it works fine.
C:\Program Files\Apache Software Foundation\Tomcat 5.5\conf\tomcat-users.xml
Is there a cache or something I need to reset for the JDBC Realm to work?
I have attached my tables and contents as well...
Did I miss something????
Thanks
Phil
server.xml
<Server port="8005" shutdown="SHUTDOWN">
<Listener className="org.apache.catalina.mbeans.ServerLifecycleListener" />
<Listener className="org.apache.catalina.mbeans.GlobalResourcesLifecycleListener" />
<Listener className="org.apache.catalina.storeconfig.StoreConfigLifecycleListener"/>
<!-- Global JNDI resources -->
<GlobalNamingResources>
<!-- Test entry for demonstration purposes -->
<Environment name="simpleValue" type="java.lang.Integer" value="30"/>
</GlobalNamingResources>
<!-- Define the Tomcat Stand-Alone Service -->
<Service name="Catalina">
<!-- Define a non-SSL HTTP/1.1 Connector on port 8080 -->
<Connector
port="8080" maxHttpHeaderSize="8192"
maxThreads="150" minSpareThreads="25" maxSpareThreads="75"
enableLookups="false" redirectPort="8443" acceptCount="100"
connectionTimeout="20000" disableUploadTimeout="true" />
<!-- Define an AJP 1.3 Connector on port 8009 -->
<Connector port="8009"
enableLookups="false" redirectPort="8443" protocol="AJP/1.3" />
<!-- Define the top level container in our container hierarchy -->
<Engine name="Catalina" defaultHost="localhost">
<!--
<Realm className="org.apache.catalina.realm.MemoryRealm" />
-->
<Realm className="org.apache.catalina.realm.JDBCRealm"
driverName="oracle.jdbc.driver.OracleDriver"
connectionURL="jdbc:oracle:thin:@localhost:1521:orcl"
connectionName="testName" connectionPassword="testPass"
userTable="users"
userNameCol="user_name"
userCredCol="user_pass"
userRoleTable="user_roles"
roleNameCol="role_name" />
<!-- Define the default virtual host
Note: XML Schema validation will not work with Xerces 2.2.
-->
<Host name="localhost" appBase="webapps"
unpackWARs="true" autoDeploy="true"
xmlValidation="false" xmlNamespaceAware="false">
</Host>
</Engine>
</Service>
</Server>
Tables
create table users
user_name varchar(15) not null primary key,
user_pass varchar(15) not null
create table roles
role_name varchar(15) not null primary key
create table user_roles
user_name varchar(15) not null,
role_name varchar(15) not null,
primary key( user_name, role_name )
select * from users;
----------------------+
| user_name | user_pass |
----------------------+
| tomcat | tomcat |
| user1 | tomcat |
| user2 | tomcat |
| user3 | tomcat |
----------------------+
select * from roles;
| role_name |
| tomcat |
| role1 |
select * from user_roles;
-----------------------+
| role_name | user_name |
-----------------------+
| tomcat | user1 |
| role1 | user2 |
| tomcat | tomcat |
| role1 | tomcat |
-----------------------+Jan 2, 2008 11:49:35 AM org.apache.coyote.http11.Http11Protocol init
INFO: Initializing Coyote HTTP/1.1 on http-8080
Jan 2, 2008 11:49:35 AM org.apache.catalina.startup.Catalina load
INFO: Initialization processed in 734 ms
Jan 2, 2008 11:49:35 AM org.apache.catalina.core.StandardService start
INFO: Starting service Catalina
Jan 2, 2008 11:49:35 AM org.apache.catalina.core.StandardEngine start
INFO: Starting Servlet Engine: Apache Tomcat/5.5.9
Jan 2, 2008 11:49:35 AM org.apache.catalina.realm.JDBCRealm start
SEVERE: Exception opening database connection
java.sql.SQLException: oracle.jdbc.driver.OracleDriver
at org.apache.catalina.realm.JDBCRealm.open(JDBCRealm.java:684)
at org.apache.catalina.realm.JDBCRealm.start(JDBCRealm.java:758)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1004)
at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:442)
at org.apache.catalina.core.StandardService.start(StandardService.java:450)
at org.apache.catalina.core.StandardServer.start(StandardServer.java:683)
at org.apache.catalina.startup.Catalina.start(Catalina.java:537)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:271)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:409)
Jan 2, 2008 11:49:35 AM org.apache.catalina.core.StandardHost start
INFO: XML validation disabled
Jan 2, 2008 11:49:36 AM org.apache.catalina.core.StandardContext resourcesStart -
JDBC, JMS and EJB transactions - possible problem?
Hello,
I am using Oracle 9, Weblogic 8.1 SP 4, MyEclipse and
XDoclet.
In my current project I have the following piece of code
in one of my message driven beans (code cited as pseudocode
without unnecessary details):
* @ejb.bean name="MyMessageProcessor"
* display-name="Display name for a MyMessageProcessor"
* jndi-name="ejb/MyMessageProcessor"
* description="Bean MyMessageProcessor"
* destination-type="javax.jms.Queue"
* transaction-type="Container"
* acknowledge-mode="Auto-acknowledge"
* subscription-durability="Durable"
* generate="false"
* @ejb.transaction type="Required"
public class MyMessageProcessor implements MessageDrivenBean, MessageListener {
public void onMessage(Message msg) {
try {
//obtaining connections to two different databases via JNDi
java.sql.Connection connOne =
((DataSource)ctx.lookup("DataSourceOne")).getConnection();
java.sql.Connection connTwo =
((DataSource)ctx.lookup("DataSourceTwo")).getConnection();
// performing some UPDATEs and INSERTs on connOne and connTwo
// calling some other methods of this bean
//creating the reply JMS message and sending it to another JMS queue
Message msgTwo = this.createReplyMessage(msg)
this.queueSender.send(msgTwo);
//commiting everything
this.queueSession.commit();
} catch (Exception ex) {
try {
if (this.queueSession!=null) this.queueSession.rollback();
} catch (JMSException JMSEx) {};
this.context.setRollbackOnly();
Some days ago (before the final remarks from my client) there used to be only one DataSource configurated on the basis of the
connection pool with non-XA jdbc driver. Everything worked fine
including the transactions (if anything wrong happend not only wasn't the replymessage sent, but also no changes were written
to database and the incomming message was thrown back to the my bean's
queue).
When I deployed the second DataSource I was informed by an error message, that only one non-transactional resource may
participate in a global transaction. When I changed both datasources
to depend on underlying datasources with transatcional (XA) jdbc drivers, everything stopped working. Even if
EJB transaction was theoretically successfully rolledbacked, the changed were written to the database
and the JMS message wasn't resent to the JMS queue.
So here are my questions:
1. How to configure connection pools to work in such situations? What JDBC drivers should I choose?
Are there any global server configurations, which may influence this situation?
2. Which jdbc drivers should I choose so that the container was able to rollback the database transactions
(of course, if necessary)?
3. Are there any JMS Queue settings, which would disable the container to send message back to the
queue in case of setRollbackOnly()? How should be the Queue configurated?
As I am new to the topic and the deadline for the project seems to be too close I would be grateful
for any help.
This message was sent to EJB list and JDBC list.
Sincerely yours,
Marcin ZakidalskiHi,
I found these information extremely useful and helpful.
The seperate transaction for sending messages was, of course, unintentional. Thanks a lot.
Anyway, I still have some problems. I have made some changes to the
code cited in my previous mail. These changes included changing QueueSessions
to non-transactional. I also set the "Honorate global transactions" to true.
I am using XA JDBC driver. After setting "Enable local transactions" to false
(I did it, because I assume that JDBC transactions should be part on the global
EJB transaction) I got the following error:
java.sql.SQLException: SQL operations are not allowed with no global transaction by default for XA drivers. If the XA
driver supports performing SQL operations with no global transaction, explicitly allow it by setting
"SupportsLocalTransaction" JDBC connection pool property to true. In this case, also remember to complete the local
transaction before using the connection again for global transaction, else a XAER_OUTSIDE XAException may result. To
complete a local transaction, you can either set auto commit to true or call Connection.commit() or Connection.rollback().
I have also inspected the calls of methods of bean inside of onMessage() method just to check, whether
the transactions are correctly initialized (using the weblogic.transaction.Transaction class).
My questions are as follows:
1. Any suggestions how to solve it? I have gone through the google answers on that problem and only
thing I managed to realize that JDBC must start its own transaction. Is there any way to prohibit it
from doing that? Can using setAutocommit(true/false) change the situation for better?
2. How to encourage the JDBC driver to be a part of EJB transaction?
3. As I have noticed each of ejb method has its own transactions (transactions have different
Xid). Each method of the bean has "required" transaction attribute. Shouldn't it work in such
way that if already started transaction exists it is used by the called method?
4. The DataSources are obtained in my application via JNDI and in the destination environment I will have slight
impact on the configuration of WebLogic. What is least problematic and most common WebLogic configuration which would
enable JDBC driver to participate in the EJB transaction? Is it the WebLogic configuration problem or can it be
solved programmically?
Currently my module works quite fine when "enable local transactions" for DataSources is set to true, but this way
I am loosing the ability to perform all actions in one transaction.
Any suggestions / hints are more than welcomed. This message was posted to jdbc list and ejb list.
Marcin -
Configuring file realm in weblogic server 9.2
Hi,
I am trying to upgrade my application from weblogic 6.1 to weblogic 9.2 and I am using compatibility security.
I have configured a RDBMS realm and then configured the caching realm giving that RDBMS realm as its Base realm.
Now since caching realm works with file realm. I have to configure this also. Now on click of file realm tab in weblogic 9.2 throws the following error.
java.lang.RuntimeException: The requested operation is not exposed through JMX in this context: equals
Caused by: java.lang.NoSuchMethodException: equals(java.lang.Object,) for com.bea:Name=CachingRealm-0,Type=CachingRealm
at weblogic.management.jmx.modelmbean.WLSModelMBean.invoke(WLSModelMBean.java:369)
at com.sun.jmx.mbeanserver.DynamicMetaDataImpl.invoke(DynamicMetaDataImpl.java:213)
at com.sun.jmx.mbeanserver.MetaDataImpl.invoke(MetaDataImpl.java:220)
at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.invoke(DefaultMBeanServerInterceptor.java:815)
at com.sun.jmx.mbeanserver.JmxMBeanServer.invoke(JmxMBeanServer.java:784)
at weblogic.management.jmx.mbeanserver.WLSMBeanServerInterceptorBase.invoke(WLSMBeanServerInterceptorBase.java:149)
at weblogic.management.mbeanservers.internal.SecurityMBeanMgmtOpsInterceptor.invoke(SecurityMBeanMgmtOpsInterceptor.java:63)
at weblogic.management.jmx.mbeanserver.WLSMBeanServerInterceptorBase.invoke(WLSMBeanServerInterceptorBase.java:149)
at weblogic.management.mbeanservers.edit.internal.EditLockInterceptor.invoke(EditLockInterceptor.java:141)
at weblogic.management.jmx.mbeanserver.WLSMBeanServerInterceptorBase.invoke(WLSMBeanServerInterceptorBase.java:149)
at weblogic.management.mbeanservers.internal.SecurityInterceptor.invoke(SecurityInterceptor.java:426)
at weblogic.management.mbeanservers.internal.AuthenticatedSubjectInterceptor$10.run(AuthenticatedSubjectInterceptor.java:377)
at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:363)
at weblogic.management.mbeanservers.internal.AuthenticatedSubjectInterceptor.invoke(AuthenticatedSubjectInterceptor.java:375)
at weblogic.management.jmx.mbeanserver.WLSMBeanServer.invoke(WLSMBeanServer.java:310)
at javax.management.remote.rmi.RMIConnectionImpl.doOperation(RMIConnectionImpl.java:1408)
at javax.management.remote.rmi.RMIConnectionImpl.access$100(RMIConnectionImpl.java:81)
at javax.management.remote.rmi.RMIConnectionImpl$PrivilegedOperation.run(RMIConnectionImpl.java:1245)
at java.security.AccessController.doPrivileged(Native Method)
at javax.management.remote.rmi.RMIConnectionImpl.doPrivilegedOperation(RMIConnectionImpl.java:1348)
at javax.management.remote.rmi.RMIConnectionImpl.invoke(RMIConnectionImpl.java:782)
at javax.management.remote.rmi.RMIConnectionImpl_WLSkel.invoke(Unknown Source)
at weblogic.rmi.internal.ServerRequest.sendReceive(ServerRequest.java:174)
... 91 more
Can anyone help me out?
Thank you
Njoy
:-)You may still need to define the role in the weblogic.xml file in order for deployment descriptor-based role definition to work (alternatively you could use the WebLogic Server console to define the role and policy).
You can specify your role "testrole" as "externally-defined" as opposed to mapping it to specific principals.
See http://e-docs.bea.com/wls/docs92/webapp/weblogic_xml.html#wp1040908
Jeff
Maybe you are looking for
-
Hi I have java packet with code that connects to a Oracle database (jdbc connection) which failes using BPM 10g studio. Executing this as a java main program from prompt (using same libs and same jre as in STUDIO), works Code looks like.. SolutionOff
-
How to hide OM infotype screen field
Hello Experts. Please let me know how to hide OM infotype Screen field ? i want to hide Percentage field on IT1011. I know i can create alternative screen "Z" and hide the field and attach alternative screen to the Module pool. Please let me know if
-
Migrating excel reports to new BO frame work
Hi Friends We got a new requirements to Migrate existing Excel reports to new BO framework,can you please explain how to achieve this. Regards Srinivas
-
Hello! I am using this function in order to save text in sales order. When i pass the table lines to the function it has for example 4 lines. After saving i can see that the 4 lines where concatenated to each other. I want to create a situation where
-
Saving the document template in the desired folder
Dear Experts I have enabled templates for some folders. When a template is being used, its getting saved in the current folder. Is it possible to give an option to the user for specifying target folder? Regards Aparnna