Road 2 Home

Road 2 Home

Friday, September 19, 2003

Use the servlet filter to protect static& dynamic web contents

Use the servlet filter to protect static& dynamic web contents

My customer want to using web.xml configuration to protect static& dynamic web contents

Wls support the login-config to do this , but this depend the j_security_check,can only authen inner role & principle

if you want to use external authen , we advise using the servlet filter to so this :


in web.xml :



<filter>
<filter-name>loginFilter</filter-name>
<filter-class>loginFilter</filter-class>
</filter>

<filter-mapping>
<filter-name>loginFilter</filter-name>
<url-pattern>/admin/*</url-pattern>
</filter-mapping>


loginFilter.java 's doFilter method :

public void doFilter(ServletRequest req, ServletResponse res, FilterChain fc)
throws java.io.IOException, javax.servlet.ServletException {

HttpSession sess = ((HttpServletRequest)req).getSession(true);
String auth = (String)sess.getAttribute("authenticated");

if(auth == null || auth.equals("false")) {

((HttpServletResponse)res).sendRedirect("/login.jsp?path_context="+URLEncoder.encode(((HttpServletRequest)req).getRequestURI()+"?"+((HttpServletRequest)req).getQueryString()));
return;
}


fc.doFilter(req,res);
}



then wrapper the authen in the authenticate.jsp ,which is the login.jsp 's action file


<%@page import="java.net.URLDecoder"%>

<%
//authen the user
//.....put your authen method , I just give a example

boolean authenticated=false;

if (request.getParameter("username").equals("abc") && request.getParameter("password").equals("abc") )
authenticated = true;

//*******************
if (authenticated) {
(request.getSession(false)).setAttribute("authenticated", "true");
response.sendRedirect(URLDecoder.decode(request.getParameter("path_context")));
}
else {
(request.getSession(false)).setAttribute("authenticated", "false");
response.sendRedirect("/error.jsp?path_context="+request.getParameter("path_context"));
}

%>



finally the login.jsp :

<form method="post" action="/authenticate.jsp">
<table border="0" bgcolor=#eeeeee align=center cellspacing=10>
<tr>
<td>Username:</td>
<td>
<input type="TEXT" name="username">
</td>
</tr>
<tr>
<td>Password:</td>
<td>
<input type="PASSWORD" name="password">
</td>
</tr>
</table>
<p>
<center>
<input type="SUBMIT" name="submit" value="Login">
<input type="hidden" name="path_context" value="<%=request.getParameter("path_context")%>">
</center>
</form>

Wednesday, September 17, 2003

HotSpot Virtual Machine Error, Unexpected Signal 10(HP 11.00 WLS 6.1 sp1 javacore)

HotSpot Virtual Machine Error, Unexpected Signal 10(HP 11.00 WLS 6.1 sp1 javacore)

Unexpected Signal : 10 occurred at PC=0xbcdb0
Function name=(N/A)
Library=(N/A)

NOTE: We are unable to locate the function name symbol for the error
just occurred. Please refer to release documentation for possible
reason and solutions.

Current Java thread:
"ExecuteThread: '16' for queue: 'default'" daemon prio=10 tid=0x00049d40 nid=28 lwp_id=11299 runnable [0x00000000..0x5836d4d0]

Dynamic libraries:
/weblogic/jdk131/jre/bin/../bin/PA_RISC2.0/native_threads/java
text:0x00001000-0x00007384 data:0x00008000-0x000086b8
/weblogic/jdk131/jre/bin/../lib/PA_RISC2.0/server/libjvm.sl
text:0xc2c00000-0xc3467000 data:0x7f70a000-0x7f7ca000
/usr/lib/libpthread.1
text:0xc0f60000-0xc0f76000 data:0x7f68f000-0x7f692000
/usr/lib/libm.2
text:0xc0230000-0xc0256000 data:0x7f692000-0x7f698000
/usr/lib/librt.2
text:0xc02bc000-0xc02c0000 data:0x7f698000-0x7f699000
/usr/lib/libcl.2
text:0xc0840000-0xc08ed000 data:0x7f69a000-0x7f6e1000
/usr/lib/libisamstub.1
text:0xc00d6000-0xc00d7000 data:0x7f699000-0x7f69a000
/usr/lib/libCsup.2
text:0xc02a0000-0xc02bb000 data:0x7f6e1000-0x7f6e4000
/usr/lib/libc.2
text:0xc0100000-0xc022e000 data:0x7f7cf000-0x7f7e6000
/usr/lib/libdld.2
text:0xc0003000-0xc0006000 data:0x7f7ca000-0x7f7cb000
/weblogic/jdk131/jre/lib/PA_RISC2.0/native_threads/libhpi.sl
text:0xc0c10000-0xc0c22000 data:0x7f68d000-0x7f68f000
/weblogic/jdk131/jre/bin/../lib/PA_RISC2.0/libverify.sl
text:0xc0c30000-0xc0c40000 data:0x7f679000-0x7f67a000
/weblogic/jdk131/jre/bin/../lib/PA_RISC2.0/libjava.sl
text:0xc0c40000-0xc0c6c000 data:0x7f674000-0x7f679000
/weblogic/jdk131/jre/bin/../lib/PA_RISC2.0/libzip.sl
text:0xc0c70000-0xc0c83000 data:0x7f672000-0x7f674000
/usr/lib/nls/loc/locales.2/zh_CN.hp15CN
text:0xc03fa000-0xc03fd000 data:0x726db000-0x72800000
/usr/lib/nls/loc/methods.2/libhp15CN.sl
text:0xc0292000-0xc0294000 data:0x7f404000-0x7f405000
/weblogic/jdk131/jre/bin/../lib/PA_RISC2.0/libnet.sl
text:0xc0c04000-0xc0c0d000 data:0x7f403000-0x7f404000
/usr/lib/libnss_dns.1
text:0xc00bc000-0xc00c0000 data:0x7f400000-0x7f401000
/usr/lib/libnss_files.1
text:0xc0034000-0xc003b000 data:0x7d2ca000-0x7d2cb000
/usr/lib/libnss_nis.1
text:0xc0008000-0xc000e000 data:0x7d2c9000-0x7d2ca000
/usr/lib/libnsl.1
text:0xc0040000-0xc00bb000 data:0x7d2b4000-0x7d2c9000
/usr/lib/libxti.2
text:0xc00c0000-0xc00d5000 data:0x7d2ad000-0x7d2b2000
/weblogic/wlserver/lib/hpux11/libmuxer.sl
text:0xc03fd000-0xc0400000 data:0x7d2ac000-0x7d2ad000
/weblogic/jdk131/jre/bin/../lib/PA_RISC2.0/libioser12.sl
text:0xc07cc000-0xc07d0000 data:0x7d2ab000-0x7d2ac000

Local Time = Tue Sep 16 15:10:12 2003
Elapsed Time = 21023
#
# HotSpot Virtual Machine Error : 10
# Please report this error to HP customer support.
#
# Java VM: Java HotSpot(TM) Server VM (1.3.1 1.3.1.09-_18_apr_2003_14_01 PA2.0 mixed mode)
#


============resolve info=========================

it is code caused problem

we found StackOverflowError in the server log just before the javacore
it should be a infinite loop in code

=============================================

Wednesday, September 03, 2003

Java Core without hs_err_pidxxxx.log or Core file On HP 11.11,when Using MQ Serias integrete with WLS

Java Core without hs_err_pidxxxx.log or Core file On HP 11.11,when Using MQ Serias integrete with WLS

OS:hp11.11
MQ:5.3
WLS:701/702

MQ bindding mode (accoding the WLS doc,using startupclass)

JDK:131_06
After send jms to MQ ,redepoly the DefaultAPP(or any other webapp,which is not relate with JMS) will cause the WLS core dump,can get the core file,but no hs_err_pidxxxx.log

JDK:131_08
after wls server startup ,when sending jms to MQ , wls core ,even whithout core file .

all JDK patch installed

here is the GDB core result:

gdb /opt/java1.3/bin/PA_RISC2.0/native_threads/java core
HP gdb 3.1.5 for PA-RISC 1.1 or 2.0 (narrow), HP-UX 11.00.
Copyright 1986 - 2001 Free Software Foundation, Inc.
Hewlett-Packard Wildebeest 3.1.5 (based on GDB) is covered by the
GNU General Public License. Type "show copying" to see the conditions to
change it and/or distribute copies. Type "show warranty" for warranty/support.
.
Core was generated by `java'.
Program terminated with signal 11, Segmentation fault.

warning: The shared libraries were not privately mapped; setting a
breakpoint in a shared library will not work until you rerun the program.

#0 0x75c10318 in compiled frame: weblogic.apache.xerces.dom.DeferredDocumentImpl::ensureCapacity (int, int) ->boolean ()
(gdb) bt
#0 0x75c10318 in compiled frame: weblogic.apache.xerces.dom.DeferredDocumentImpl::ensureCapacity (int, int) ->boolean ()
#1 0x75c0d944 in i2c_adapter frame ()
#2 0x44bac in interpreted frame: weblogic.apache.xerces.dom.DeferredDocumentImpl::createNode (short) ->int ()
#3 0x44bac in interpreted frame: weblogic.apache.xerces.dom.DeferredDocumentImpl::createDocument () ->int ()
#4 0x44bac in interpreted frame: weblogic.apache.xerces.parsers.DOMParser::startDocument () ->void ()
#5 0x44dec in interpreted frame: weblogic.apache.xerces.validators.common.XMLValidator::callStartDocument () ->void ()
#6 0x44dec in interpreted frame: weblogic.apache.xerces.framework.XMLDocumentScanner$XMLDeclDispatcher::dispatch (boolean) ->boolean ()
#7 0x44d5c in interpreted frame: weblogic.apache.xerces.framework.XMLDocumentScanner::parseSome (boolean) ->boolean ()
#8 0x44bac in interpreted frame: weblogic.apache.xerces.framework.XMLParser::parse (org.xml.sax.InputSource) ->void ()
#9 0x44c3c in interpreted frame: weblogic.apache.xerces.jaxp.DocumentBuilderImpl::parse (org.xml.sax.InputSource) ->org.w3c.dom.Document ()
#10 0x44b88 in interpreted frame: weblogic.xml.jaxp.RegistryDocumentBuilder::parse (org.xml.sax.InputSource) ->org.w3c.dom.Document
()
#11 0x44b88 in interpreted frame: javax.xml.parsers.DocumentBuilder::parse (java.lang.String) ->org.w3c.dom.Document ()
#12 0x44b88 in interpreted frame: com.easipass.sys.Controller::executeCommand (java.lang.String, java.io.PrintWriter) ->void ()
#13 0x44c3c in interpreted frame: com.easipass.sys.ServerThread::run () ->void ()
#14 0x77fc2c88 in Java entry frame ()
#15 0xc4c320f0 in JavaCalls::call_helper+0x318 () from /opt/java1.3/bin/../jre/lib/PA_RISC2.0/server/libjvm.sl
#16 0xc4cf27c4 in os::os_exception_wrapper+0x34 () from /opt/java1.3/bin/../jre/lib/PA_RISC2.0/server/libjvm.sl
#17 0xc4c31234 in JavaCalls::call_virtual+0x15c () from /opt/java1.3/bin/../jre/lib/PA_RISC2.0/server/libjvm.sl
#18 0xc4c73048 in thread_entry+0x108 () from /opt/java1.3/bin/../jre/lib/PA_RISC2.0/server/libjvm.sl
#19 0xc4d5452c in JavaThread::run+0x3d4 () from /opt/java1.3/bin/../jre/lib/PA_RISC2.0/server/libjvm.sl
#20 0xc4cf59e0 in _start+0xe8 () from /opt/java1.3/bin/../jre/lib/PA_RISC2.0/server/libjvm.sl
#21 0xc003b2e4 in __pthread_body+0x44 () from /usr/lib/libpthread.1
#22 0xc0045574 in __pthread_start+0x14 () from /usr/lib/libpthread.1



Error when the MDB.onMessage() to get the DataSource via Ctx

Error when the MDB.onMessage() to get the DataSource via Ctx


java.lang.SecurityException: Invalid Subject: principals=[weblogic, Administrators]

Start server side stack trace:
java.lang.SecurityException: Invalid Subject: principals=[weblogic, Administrators]
at weblogic.security.service.SecurityServiceManager.seal(SecurityServiceManager.java:943)
at weblogic.security.service.RoleManager.getRoles(RoleManager.java:271)
at weblogic.security.service.AuthorizationManager.isAccessAllowed(AuthorizationManager.java:609)
at weblogic.jndi.internal.ServerNamingNode.checkPermission(ServerNamingNode.java:332)
at weblogic.jndi.internal.ServerNamingNode.checkLookup(ServerNamingNode.java:295)
at weblogic.jndi.internal.ServerNamingNode.lookupHere(ServerNamingNode.java:146)
at weblogic.jndi.internal.BasicNamingNode.lookup(BasicNamingNode.java:187)
at weblogic.jndi.internal.RootNamingNode_WLSkel.invoke(Unknown Source)
at weblogic.rmi.internal.ServerRequest.sendReceive(ServerRequest.java:159)
at weblogic.rmi.cluster.ReplicaAwareRemoteRef.invoke(ReplicaAwareRemoteRef.java:262)
at weblogic.rmi.cluster.ReplicaAwareRemoteRef.invoke(ReplicaAwareRemoteRef.java:229)
at weblogic.jndi.internal.ServerNamingNode_WLStub.lookup(Unknown Source)
at weblogic.jndi.internal.WLContextImpl.lookup(WLContextImpl.java:337)
at weblogic.jndi.internal.WLContextImpl.lookup(WLContextImpl.java:332)
at javax.naming.InitialContext.lookup(InitialContext.java:347)
at pub.ConnectSybase.(ConnectSybase.java:49)
at pub.SqlQuery.(SqlQuery.java:27)
at jmsbean.sendRemoteReceive.insSys_Jms_xxrz(sendRemoteReceive.java:178)
at jmsbean.sendRemoteReceive.sendmsg(sendRemoteReceive.java:47)
at jmsbean.GSJMSQueue_001MDBBean.onMessage(GSJMSQueue_001MDBBean.java:46)
at weblogic.ejb20.internal.MDListener.execute(MDListener.java:356)
at weblogic.ejb20.internal.MDListener.transactionalOnMessage(MDListener.java:290)
at weblogic.ejb20.internal.MDListener.onMessage(MDListener.java:271)
at weblogic.jms.client.JMSSession.onMessage(JMSSession.java:2303)
at weblogic.jms.client.JMSSession.execute(JMSSession.java:2226)
at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:153)
at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:134)
End server side stack trace


Frist Post when I get my blog