[JCA/JBoss] - Re: issues with JCA minimum connections
by vickyk
Couple of things we need to check
1) How are you getting the Connection Handle from the ConnectionFactory ? Are you passing the CRI details to the Connection Handle through the application code?
eg
| DemoConnectionFactory cf = (DemoConnectionFactory)ctx.lookup("<JNDINAME>");
| DemoConnectionHandle connection = cf.getConnection(parameter1, parameter2,......) ;
| where getConnection(parameter1,parameter2,.....) contains the parameter which are used by ConnectionHandle implementation to generate the CRI object which is later passed to the ConnecitonManager Pool.
2) Verify if the <connectionfactory-impl-class> implementation are passsing the ConnectionRequestInfo appropriately when asked to .
Look at the jdbc resource adapter implemetaion of the connectionfactory-impl-class here
http://anonsvn.jboss.org/repos/jbossas/trunk/connector/src/main/org/jboss...
See how the WrappedConnectionRequestInfo is created in it and passed to ConnectionManager in it
public Connection getConnection(String user, String password) throws SQLException
| {
| ConnectionRequestInfo cri = new WrappedConnectionRequestInfo(user, password);
| try
| {
| WrappedConnection wc = (WrappedConnection) cm.allocateConnection(mcf, cri);
| wc.setDataSource(this);
| return wc;
| }
| catch (ResourceException re)
| {
| throw new NestedSQLException(re);
| }
| }
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4130003#4130003
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4130003
18 years, 2 months
[JBoss Seam] - Seam/JAAS/DatabaseServerLoginModule problens
by skidvd
Hello,
I am brand new to Seam and am sorry for the newbie question. However, I've been following what I have found in the forums and docs without any luck.
I have a simple Seam/facelets webapp that I cannot get JAAS based security/authentication working for. I've used JASS form based authentication before on many webapps with great success, but somehow this appears to work differently with Seam.
I have a security realm declared to use the DatabaseServerLoginModule (please note that this realm is successfully used for other webapps). The application prompts for the login (displays the login form), appears to accept the response and then returns with the following error
| The page isn't redirecting properly
|
| Firefox has detected that the server is redirecting the request for this address in a way that will never complete.
|
|
Note that the URL at this point has been redirected to something like: https://localhost:8443/eventBrowser/debug.xhtml?conversationId=85
The debug.xhtml page is not part of my application? However, I suspect it is related to the seam debug option which I have declared (and I do have the jboss-seam-debug.jar in my WEB-INF/lib. Any subsequent attempts to "try again" results in this same error. I've compared the following to the wiki samples for DatabaseServerLoginModule and cannot seem to see the differences or problem. I'm really lost and not sure what to try?
I'll appreciate any help you can provide!
TIA!
My environment:
JBoss AS 4.2.2.GA
Seam 2.0.1.GA
RichFaces 3.1.4.GA
MyFaces Tomahawk 1.1.6 and Sandbox 1.1.7
My login.xhtml has the following form:
|
| <form action="j_security_check" method="POST" bgcolor="#999999">
| <table border='0' bgcolor='#999966'>
| <tr>
| <td>
| <h:outputText value="UserId:"/>
| </td>
| <td>
| <h:inputText id="j_username" required="true"/>
| </td>
| </tr>
|
| <tr>
| <td>
| <h:outputText value="Password:"/>
| </td>
| <td>
| <h:inputSecret id="j_password" required="true"/>
| </td>
| </tr>
|
| <tr>
| <td colspan='2' align='center'>
| <h:commandButton id="SubmitButton" value="Submit" action="j_security_check"/>
| <input type='reset' value='Reset'/>
| </td>
| </tr>
| </table>
| </form>
|
My components.xml is as follows:
| <components xmlns="http://jboss.com/products/seam/components"
| xmlns:core="http://jboss.com/products/seam/core"
| xmlns:security="http://jboss.com/products/seam/security"
| xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
| xsi:schemaLocation=
| "http://jboss.com/products/seam/core http://jboss.com/products/seam/core-2.0.xsd
| http://jboss.com/products/seam/components http://jboss.com/products/seam/components-2.0.xsd">
|
| <core:init
| jndi-pattern="eventBrowser/#{ejbName}/local"
| debug="true"/>
|
| <core:manager conversation-timeout="60000"/>
|
| <security:identity jaas-config-name="MyRealm"/>
| </components>
|
My faces-config.xml is as follows:
|
| <faces-config version="1.2"
| xmlns="http://java.sun.com/xml/ns/javaee"
| xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
| xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-facesconfig_1_2.xsd">
|
| <application>
| <view-handler>
| com.sun.facelets.FaceletViewHandler
| </view-handler>
| </application>
|
| </faces-config>
|
|
and my web.xml is as follows:
|
| <web-app version="2.5"
| xmlns="http://java.sun.com/vml/ns/j2ee"
| xmlns:xsi="http://www/w3.org.2001/XMLSchema-instance"
| xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_5.xsd">
|
| <display-name>Event Historian (EVTH)</display-name>
| <description>The EVTH provides a historical view of events.
| </description>
|
| <!-- Seam -->
| <listener>
| <listener-class>org.jboss.seam.servlet.SeamListener</listener-class>
| </listener>
|
| <!-- MyFaces -->
| <!-- Not needed when using JBoss since it bundle JSF 1.2 RI
| <listener>
| <listener-class>
| org.apache.myfaces.webapp.StartupServletContextListener
| </listener-class>
| </listener>
| -->
|
| <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>
|
| <!-- An optional comma separated list of additional navigation definition files -->
| <context-param>
| <param-name>javax.faces.CONFIG_FILES</param-name>
| <param-value>/WEB-INF/navigation.xml</param-value>
| </context-param>
| <context-param>
| <description>This parameter tells MyFaces if javascript code should be
| allowed int th rendered HTML output. If javascript is allowed, comand_link
| anchors will have javascript code that submits the corresponding form. If
| javascript is not allowed, the state saving info and nested parameters
| will be added as url parameters. Default: "true"</description>
| <param-name>org.apache.myfaces.ALLOW_JAVASCRIPT</param-name>
| <param-value>true</param-value>
| </context-param>
| <context-param>
| <description>This parameter tells MyFaces if javascript code should be
| allowed int th rendered HTML output. If javascript is allowed, comand_link
| anchors will have javascript code that submits the corresponding form. If
| javascript is not allowed, the state saving info and nested parameters
| will be added as url parameters. Default: "false"
| Setting this parameter to true should be combined with
| STATE_SAVING_METHOD of "server" for best results.
| This is an experimental feature. You have to enable the decorator filter/
| filter mapping below to get Javascript detection working.</description>
| <param-name>org.apache.myfaces.DETECT_JAVASCRIPT</param-name>
| <param-value>false</param-value>
| </context-param>
| <context-param>
| <description>If true, rendered HTML code will be formatted, so that it is
| "human readable". i.e. additional line separators and whitespace will
| be written, that do not influence HTML code. Default: "true"</description>
| <param-name>org.apache.myfaces.PRETTY_HTML</param-name>
| <param-value>true</param-value>
| </context-param>
| <context-param>
| <description>If true, a javascript function will be rendered that is able to
| restire the former vertical scroll of every request. Convenient feature
| if you have pages with long lists and you do not want the browser page to
| always jump to the top if you trigger a link or button action that stays
| on the same page. Default: "false"</description>
| <param-name>org.apache.myfaces.AUTO_SCROLL</param-name>
| <param-value>true</param-value>
| </context-param>
| <context-param>
| <param-name>org.apache.myfaces.ADD_RESOURCE_CLASS</param-name>
| <param-value>org.apache.myfaces.component.html.util.StreamingAddResource</param-value>
| </context-param>
| <!-- Only if needed to avoid ExtensionFilter configuration errors. However,
| using the StreamingAddResource in the org.apache.myfaces.ADD_RESOURCE_CLASS
| context-param should fix those errors.
| <context-param>
| <param-name>org.apache.CHECK_EXTENSIONS_FILTER</param-name>
| <param-value>false</param-value>
| </context-param>
| -->
|
| <context-param>
| <param-name>javax.faces.DEFAULT_SUFFIX</param-name>
| <param-value>.xhtml</param-value>
| </context-param>
| <context-param>
| <param-name>facelets.DEVELOPMENT</param-name>
| <param-value>true</param-value>
| </context-param>
| <context-param>
| <param-name>facelets.LIBRARIES</param-name>
| <param-value>/WEB-INF/tomahawk-sandbox-taglib.xml</param-value>
| </context-param>
|
| <!--
| <context-param>
| <param-name>org.ajax4jsf.VIEW_HANDLERS</param-name>
| <param-value>org.jboss.seam.ui.facelet.SeamFaceletViewHandler</param-value>
| </context-param>
|
| <filter>
| <display-name>Ajax4jsf Filter</display-name>
| <filter-name>ajax4jsf</filter-name>
| <filter-class>org.ajax4jsf.Filter</filter-class>
| </filter>
| -->
|
| <filter>
| <filter-name>Seam Filter</filter-name>
| <filter-class>org.jboss.seam.servlet.SeamFilter</filter-class>
| </filter>
| <filter>
| <filter-name>MyFacesExtensionsFilter</filter-name>
| <filter-class>org.apache.myfaces.webapp.filter.ExtensionsFilter</filter-class>
| <init-param>
| <description>Set the size limit for uploaded files.
| Format 10 - 10 bytes
| 10k - 10 KB
| 10m - 10 MB
| 1g - 1 GB</description>
| <param-name>uploadMaxFileSize</param-name>
| <param-value>100m</param-value>
| </init-param>
| <init-param>
| <description>Set the threshold size - files below this limit are
| stored in memory, files above this limit are stored on disk.
| Format 10 - 10 bytes
| 10k - 10 KB
| 10m - 10 MB
| 1g - 1 GB</description>
| <param-name>uploadThresholdSize</param-name>
| <param-value>100k</param-value>
| </init-param>
|
| </filter>
| <filter>
| <filter-name>Seam Exception Filter</filter-name>
| <filter-class>org.jboss.seam.servlet.SeamExceptionFilter</filter-class>
| </filter>
| <!-- This requires a <redirect/> in the faces-config.xml for all navigation
| rules. It supports browser friendly URLs and allows JAAS to work
| correctly -->
| <filter>
| <filter-name>Seam Redirect Filter</filter-name>
| <filter-class>org.jboss.seam.servlet.SeamRedirectFilter</filter-class>
| </filter>
|
|
| <!--
| <filter-mapping>
| <filter-name>ajax4jsf</filter-name>
| <servlet-name>Faces Servlet</servlet-name>
| <url-pattern>*.seam</url-pattern>
| </filter-mapping>
| <filter-mapping>
| <filter-name>ajax4jsf</filter-name>
| <servlet-name>Faces Servlet</servlet-name>
| <url-pattern>*.xhtml</url-pattern>
| </filter-mapping>
| <filter-mapping>
| <filter-name>ajax4jsf</filter-name>
| <servlet-name>Faces Servlet</servlet-name>
| <url-pattern>*.jsf</url-pattern>
| </filter-mapping>
| -->
| <filter-mapping>
| <filter-name>Seam Filter</filter-name>
| <url-pattern>/*</url-pattern>
| </filter-mapping>
| <filter-mapping>
| <filter-name>MyFacesExtensionsFilter</filter-name>
| <servlet-name>Faces Servlet</servlet-name>
| </filter-mapping>
| <filter-mapping>
| <filter-name>MyFacesExtensionsFilter</filter-name>
| <url-pattern>*.seam</url-pattern>
| </filter-mapping>
| <filter-mapping>
| <filter-name>MyFacesExtensionsFilter</filter-name>
| <url-pattern>*.xhtml</url-pattern>
| </filter-mapping>
| <filter-mapping>
| <filter-name>MyFacesExtensionsFilter</filter-name>
| <url-pattern>*.jsf</url-pattern>
| </filter-mapping>
| <filter-mapping>
| <filter-name>MyFacesExtensionsFilter</filter-name>
| <url-pattern>/faces/myFacesExtensionResource/*</url-pattern>
| </filter-mapping>
| <filter-mapping>
| <filter-name>Seam Exception Filter</filter-name>
| <url-pattern>/*</url-pattern>
| </filter-mapping>
| <filter-mapping>
| <filter-name>Seam Redirect Filter</filter-name>
| <url-pattern>*.jsf</url-pattern>
| </filter-mapping>
|
| <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>*.seam</url-pattern>
| </servlet-mapping>
| <servlet-mapping>
| <servlet-name>Faces Servlet</servlet-name>
| <url-pattern>*.xhtml</url-pattern>
| </servlet-mapping>
| <servlet-mapping>
| <servlet-name>Faces Servlet</servlet-name>
| <url-pattern>*.jsf</url-pattern>
| </servlet-mapping>
|
| <servlet>
| <servlet-name>Seam Resource Servlet</servlet-name>
| <servlet-class>org.jboss.seam.servlet.ResourceServlet</servlet-class>
| </servlet>
| <servlet-mapping>
| <servlet-name>Seam Resource Servlet</servlet-name>
| <url-pattern>/seam/resource/*</url-pattern>
| </servlet-mapping>
|
| <!-- *********************************************************** -->
|
| <!--
| Automatically created by Apache Jakarta Tomcat JspC.
| Place this fragment in the web.xml before all icon, display-name,
| description, distributable, and context-param elements.
| -->
|
| <servlet>
| <servlet-name>org.apache.jsp._500_jsp</servlet-name>
| <servlet-class>org.apache.jsp._500_jsp</servlet-class>
| </servlet>
|
| <servlet-mapping>
| <servlet-name>org.apache.jsp._500_jsp</servlet-name>
| <url-pattern>/500.jsp</url-pattern>
| </servlet-mapping>
|
| <!--
| All session-config, mime-mapping, welcome-file-list, error-page, taglib,
| resource-ref, security-constraint, login-config, security-role,
| env-entry, and ejb-ref elements should follow this fragment.
| -->
|
| <!-- *********************************************************** -->
|
| <session-config>
| <session-timeout>180</session-timeout> <!-- 3 hours -->
| </session-config>
|
| <welcome-file-list>
| <welcome-file>index.html</welcome-file>
| </welcome-file-list>
|
| <error-page>
| <error-code>500</error-code>
| <location>/500.jsp</location>
| </error-page>
|
| <!-- Security -->
| <security-constraint>
| <web-resource-collection>
| <web-resource-name>EVTH</web-resource-name>
| <url-pattern>/*</url-pattern>
| </web-resource-collection>
| <auth-constraint>
| <role-name>ReadOnlyUser</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>MyRealm</realm-name>
| <form-login-config>
| <form-login-page>/login.xhtml</form-login-page>
| <form-error-page>/login-error.xhtml</form-error-page>
| </form-login-config>
| </login-config>
|
| <security-role>
| <role-name>ReadOnlyUser</role-name>
| </security-role>
| <security-role>
| <role-name>TagEvents</role-name>
| </security-role>
| <security-role>
| <role-name>AckEvents</role-name>
| </security-role>
| <security-role>
| <role-name>FullAccessUser</role-name>
| </security-role>
|
|
|
| </web-app>
|
and my jboss-web.xml has:
| <jboss-web>
| <security-domain>java:/jaas/MyRealm</security-domain>
| </jboss-web>
|
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4130002#4130002
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4130002
18 years, 2 months
[Tomcat, HTTPD, Servlets & JSP] - Re: Using existing Tomcat with JBoss AS?
by murthy64
I tried these:
a) renamed jbossweb-tomcat55.sar to jbossweb-tomcat55.sar.old
b) copied the Tomcat5.5.26 folder to JBOSS_HOME/server/all/deploy
The deployment has failed. Looks like JBOSS uses some special code
to integrate the Tomcat.
The reason I want the latest Tomcat under Jboss is the nice clustering feature of the Tomcat 5.5.26 that gracefully fails-over to another instance of Tomcat running on the same server. This way I can have multiple instances of Jboss+Tomcat on the same machine and make the fault tolerance robust.
Any thoughts on how to do this?
BTW, I read the clustering manual of Jboss and it is different from Tomcat's clustering. To illustrate:
a) let's say Tomcat1 is configured to listen on port 8080 with a helloworld.war deployed
b) Tomcat2 is configured to listent on port 8090 with the same helloworld.war deployed
c) now shut off tomcat1 and see tomcat2 display the very exact page
I have tried the Tomcat "clustering" and it works superbly. What I want to know is how can I make Jboss do the same? That is, if I run multiple instances of Jboss+Tomcat on the same physical machine, how can I fail-over when one of the instances of Jboss+Tomcat goes down?
In the Jboss manual they talked about load-balancing. I do this with Apache and mod-jk because the Jboss model is way too complicated. Can anyone point to a reference on how to go about doing this?
Thanks
Murthy
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4129999#4129999
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4129999
18 years, 2 months
[JCA/JBoss] - issues with JCA minimum connections
by tvbinh
Hi,
I am developing an in-house resource adapter for both inbound and outbound communications. I have specified <min-pool-size>2</min-pool-size> in the -ds.xml but it seems do not work properly. The fillToMin method of InternalManagedConnectionPool class in JBoss does attempt to create 2 connections but it does not pass the connection request information in so the 2 connections created are not much useful since it is connected to nowhere. I am not sure whether this is a bug, could someone please help ?
Best regards,
Binh
- defaultCri is null at the time fillToMin is executed.
public void fillToMin()
{
while (true)
{
// Get a permit - avoids a race when the pool is nearly full
// Also avoids unnessary fill checking when all connections are checked out
try
{
if (permits.attempt(poolParams.blockingTimeout))
{
try
{
if (shutdown.get())
return;
// We already have enough connections
if (getMinSize() - connectionCounter.getGuaranteedCount() <= 0)
return;
// Create a connection to fill the pool
try
{
ConnectionListener cl = createConnectionEventListener(defaultSubject, defaultCri);
synchronized (cls)
{
if (trace)
log.trace("Filling pool cl=" + cl);
cls.add(cl);
}
}
catch (ResourceException re)
{
log.warn("Unable to fill pool ", re);
return;
}
}
finally
{
permits.release();
}
}
}
catch (InterruptedException ignored)
{
log.trace("Interrupted while requesting permit in fillToMin");
}
}
}
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4129997#4129997
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4129997
18 years, 2 months
[Datasource Configuration] - issues with JCA minimum connections
by tvbinh
Hi,
I am developing an in-house resource adapter for both inbound and outbound communications. I have specified <min-pool-size>2</min-pool-size> in the -ds.xml but it seems do not work properly. The fillToMin method of InternalManagedConnectionPool class in JBoss does attempt to create 2 connections but it does not pass the connection request information in so the 2 connections created are not much useful since it is connected to nowhere. I am not sure whether this is a bug, could someone please help ?
Best regards,
Binh
- defaultCri is null at the time fillToMin is executed.
public void fillToMin()
{
while (true)
{
// Get a permit - avoids a race when the pool is nearly full
// Also avoids unnessary fill checking when all connections are checked out
try
{
if (permits.attempt(poolParams.blockingTimeout))
{
try
{
if (shutdown.get())
return;
// We already have enough connections
if (getMinSize() - connectionCounter.getGuaranteedCount() <= 0)
return;
// Create a connection to fill the pool
try
{
ConnectionListener cl = createConnectionEventListener(defaultSubject, defaultCri);
synchronized (cls)
{
if (trace)
log.trace("Filling pool cl=" + cl);
cls.add(cl);
}
}
catch (ResourceException re)
{
log.warn("Unable to fill pool ", re);
return;
}
}
finally
{
permits.release();
}
}
}
catch (InterruptedException ignored)
{
log.trace("Interrupted while requesting permit in fillToMin");
}
}
}
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4129996#4129996
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4129996
18 years, 2 months
[JBoss Seam] - Re: Bug? Outjected boolean changes value mid-template
by tomstrummer
I expect Seam to re-initialize the value when it goes out of scope.
How does Seam know when a context variable goes out of scope? If Seam sees a @Out variable go out of scope, then it sees the bijected field with no factory... It should just ignore it and leave whatever value happened to be there? Once the value goes out of scope, I hoped it would be re-initialized to false. Ok, so I wouldn't be surprised if you couldn't keep track of the initial value, but at least set it to null.
Using a Boolean doesn't help. And the problem is I only set the value to true when I need to (show the form). The rest of the time, i.e. after it goes out of scope, I need it to be false. But like I said, that means I need a factory just to re-initialize a page-scoped boolean. Otherwise it hangs on to the old value.
Can you elaborate on your suggestion? My situation feels analogous to having a variable defined in a method, and the variable is getting the value it had when method was last called. (Obviously the mechanics are very different but from a user standpoint I am in the same situation.)
I solved my problem making all of my beans that keep track of the form state stateful & page scoped.
Like I said, think I understand why this is happening, I just don't think it's a very desirable behavior. It sounds like the answer is "don't biject a narrow-scoped field into a wide-scoped bean unless you have a factory. If you do, you'll have an inconsistent state when the template is rendered." But regardless of why it is happening, I don't think it is um, "good" behavior or desirable in any situation and suggest it be disallowed or at least document some sort of warning or output a log warning when such a thing is detected.... Is that at least possible?
Thanks.
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4129994#4129994
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4129994
18 years, 2 months