subba rao

Ranch Hand
+ Follow
since Apr 24, 2008
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
1
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by subba rao

we have configured ldap settings in tomcat.its working fine all these days.but suddenly getting below ldap errors.what is the meaning of below errors.

Jul 19, 2016 11:14:04 AM org.apache.tomcat.util.digester.SetPropertiesRule begin
   WARNING: [SetPropertiesRule]{Context/Realm} Setting property 'debug' to '99' did not find a matching property.
   Jul 19, 2016 11:14:04 AM org.apache.tomcat.util.digester.SetPropertiesRule begin
   WARNING: [SetPropertiesRule]{Context/Realm} Setting property 'curUserPattern' to '%s@corp' did not find a matching property.
   Jul 19, 2016 11:14:04 AM org.apache.tomcat.util.digester.SetPropertiesRule begin
   WARNING: [SetPropertiesRule]{Context/Realm} Setting property 'resourceName' to 'add_web_realm' did not find a matching property.
   Jul 19, 2016 11:14:05 AM org.apache.catalina.core.ContainerBase addChildInternal
   SEVERE: ContainerBase.addChild: start:
   org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina].StandardHost[localhost].StandardContext[/add-web]]
   at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:154)


   Caused by: org.apache.catalina.LifecycleException: Failed to start component [Realm[JNDIRealm]]
   at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:154)
   at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5350)
   at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
   ... 10 more
   Caused by: org.apache.catalina.LifecycleException: Exception opening directory server connection
   at org.apache.catalina.realm.JNDIRealm.startInternal(JNDIRealm.java:2191)
   at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
   ... 12 more
   Caused by: javax.naming.AuthenticationException: [LDAP: error code 49 - 80090308: LdapErr: DSID-0C0903A9, comment: AcceptSecurityContext error, data 775, v1db1^@]
   at com.sun.jndi.ldap.LdapCtx.mapErrorCode(LdapCtx.java:3087)
7 years ago
from JSP below Category string will passed;How to compare the Category with the Category that is stored in Hashtable key and replace with the values?

For example if Category comes as "Entire Category AND Full-Res PDF PDF (print)" then final output should as "900014 AND 724242"

if another Category comes as "(Composite Pattern AND Cover) OR (Full-Res PDF (print) AND Cover)" then final output should as "(36363636 AND 7697979) OR (724242 AND 7697979) "

1.Entire Category AND Full-Res PDF PDF (print)
2.Cover Image OR (Full-Res PDF (print) AND Entire Category)
3.Composite Pattern OR Full-Res PDF (print)
4.(Composite Pattern AND Cover) OR (Full-Res PDF (print) AND Cover)
Category and the value will be stored in the Hashtable.

hashtable.put("Entire Category","900014");
hashtable.put("Full-Res PDF PDF (print)","724242");
hashtable.put("Composite Pattern","36363636");
hashtable.put("Entire Category","352525");
hashtable.put("Cover Image","95757");
hashtable.put("Cover","7697979");
7 years ago
As we are using log4j for enable logging in our application.what are the changes needed in log4j.properties file to get logs in JOSN format? .As per this link we need to put [log4j.appender.RollingLog.layout=net.logstash.log4j.JSONEventLayoutV1] like this.what version of log4j support this JSON format?

I think need to download jar from below link and place it in tomcat\lib folder..

https://github.com/logstash/log4j-jsonevent-layout


This is just a quick snippit of a log4j.properties file:

log4j.rootCategory=WARN, RollingLog
log4j.appender.RollingLog=org.apache.log4j.DailyRollingFileAppender
log4j.appender.RollingLog.Threshold=TRACE
log4j.appender.RollingLog.File=api.log
log4j.appender.RollingLog.DatePattern=.yyyy-MM-dd
log4j.appender.RollingLog.layout=net.logstash.log4j.JSONEventLayoutV1

7 years ago
To setup loggly alerts in logStash we need to configure tomcat server to return logs in JSON format.

The logs shipped to loggly are presently not in expected format (JSON). They are in .out and .log formats currently. we need to analyze on writing the logs in JSON format in tomcat server.
7 years ago
when i checked the prod logs, getting socket time out exception.what was the remedy for this issue?do i need to put connectionTimeout option in Realm options.

The issue is first time if we give valid credentials then its logging but next time onwards its giving authentication error even though cache the browser.after 4 or 5 attempts only its again logging in.

https://tomcat.apache.org/tomcat-7.0-doc/config/realm.html#JNDI_Directory_Realm_-_org.apache.catalina.realm.JNDIRealm


May 09, 2016 2:03:37 AM org.apache.catalina.core.ApplicationContext log
INFO: No Spring WebApplicationInitializer types detected on classpath
May 09, 2016 2:03:37 AM org.apache.catalina.core.ApplicationContext log
INFO: Initializing Spring root WebApplicationContext
May 09, 2016 4:02:30 AM org.apache.catalina.realm.JNDIRealm authenticate
INFO: Exception performing authentication. Retrying...
javax.naming.CommunicationException: Connection reset [Root exception is java.net.SocketException: Connection reset]; remaining name 'DC=corp,DC=local'
at com.sun.jndi.ldap.LdapCtx.doSearch(LdapCtx.java:2003)
at com.sun.jndi.ldap.LdapCtx.searchAux(LdapCtx.java:1847)
at com.sun.jndi.ldap.LdapCtx.c_search(LdapCtx.java:1772)
at com.sun.jndi.toolkit.ctx.ComponentDirContext.p_search(ComponentDirContext.java:386)
at com.sun.jndi.toolkit.ctx.PartialCompositeDirContext.search(PartialCompositeDirContext.java:356)
at com.sun.jndi.toolkit.ctx.PartialCompositeDirContext.search(PartialCompositeDirContext.java:339)
at javax.naming.directory.InitialDirContext.search(InitialDirContext.java:267)
at org.apache.catalina.realm.JNDIRealm.getUserBySearch(JNDIRealm.java:1446)
at org.apache.catalina.realm.JNDIRealm.getUser(JNDIRealm.java:1297)
at org.apache.catalina.realm.JNDIRealm.getUser(JNDIRealm.java:1253)
at org.apache.catalina.realm.JNDIRealm.authenticate(JNDIRealm.java:1194)
at org.apache.catalina.realm.JNDIRealm.authenticate(JNDIRealm.java:1052)
at org.apache.catalina.authenticator.FormAuthenticator.authenticate(FormAuthenticator.java:294)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:449)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:171)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:950)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:116)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:408)
at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1040)
at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:607)
at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:316)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
at java.lang.Thread.run(Thread.java:745)
Caused by: java.net.SocketException: Connection reset
at java.net.SocketInputStream.read(SocketInputStream.java:196)
at java.net.SocketInputStream.read(SocketInputStream.java:122)
at sun.security.ssl.InputRecord.readFully(InputRecord.java:442)
at sun.security.ssl.InputRecord.read(InputRecord.java:480)
at sun.security.ssl.SSLSocketImpl.readRecord(SSLSocketImpl.java:934)
at sun.security.ssl.SSLSocketImpl.readDataRecord(SSLSocketImpl.java:891)
at sun.security.ssl.AppInputStream.read(AppInputStream.java:102)
at java.io.BufferedInputStream.fill(BufferedInputStream.java:235)
at java.io.BufferedInputStream.read1(BufferedInputStream.java:275)
at java.io.BufferedInputStream.read(BufferedInputStream.java:334)
at com.sun.jndi.ldap.Connection.run(Connection.java:853)
... 1 more
7 years ago
I am trying to replicate the production issue in local env for tomcat+LDAP authentication error issue.even though I gave valid credentials but getting authentication error.

how do we confirm whether its connecting LDAP active directory in local env. The issue is first time if we give valid credentials then its logging but next time onwards its giving authentication error even though cache the browser.after 4 or 5 attempts only its again logging in.

web.xml

<security-constraint>
<display-name>sun-web</display-name>
<web-resource-collection>
<web-resource-name>ProtectedArea</web-resource-name>
<url-pattern>/home</url-pattern>
<url-pattern>*.jsp</url-pattern>
</web-resource-collection>
<auth-constraint>
<role-name>*</role-name>
</auth-constraint>
</security-constraint>
<login-config>
<auth-method>FORM</auth-method>
<realm-name>sun_web_realm</realm-name>
<form-login-config>
<form-login-page>/WEB-INF/jsp/login.jsp</form-login-page>
<form-error-page>/WEB-INF/jsp/error.jsp</form-error-page>
</form-login-config>
</login-config>
<security-role>
<role-name>*</role-name>
</security-role>

tomcat-users.xml
******************



<tomcat-users>
<user username="CN=XXX Repository, OU=Unknown, O=XXX Software Ltd., L=nhead, ST=UK, C=GB" roles="repository" password="null"/>
<user username="CN=XXX Repository Client, OU=Unknown, O=XXX Software Ltd., L=head, ST=UK, C=GB" roles="repoclient" password="null"/>
</tomcat-users>
tomcat/conf/Catalian/localhost/sun-web.xml

<Realm className="org.apache.catalina.realm.JNDIRealm" debug="99"
connectionURL="ldaps://xxx.xx.xx:636"
alternateURL="ldaps://xxx.xx.xx:636"
curUserPattern="%s@corp"
connectionName="CN=xxxxxxx LDAP,OU=Service Accounts,OU=XXX,DC=corp,DC=local"
connectionPassword="xxxx"
referrals="follow"
userBase="DC=corp,DC=local"
userSearch="(sAMAccountName={0})"
userSubtree="true"
roleBase="DC=corp,DC=local"
roleName="name"
roleSubtree="true"
roleSearch="(member={0})" resourceName="sun_web_realm"
/>
7 years ago
I am calling below method which is deployed in the remote network.the application is deployed in JBOSS as a EJB services.

So am calling below program as a standalone program in eclipse then below exception is coming.

My question is how to access below service.can't i call this service as standalone program which is deployed as EJB service in some other network.

AuthenticationServices.getInstance().createSession("abcd");


Caused by: javax.naming.CommunicationException [Root exception is java.lang.ClassNotFoundException: org.jboss.ejb.plugins.local.LocalHomeProxy (no security manager: RMI class loader disabled)]
at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:845)
at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:686)
at javax.naming.InitialContext.lookup(InitialContext.java:392)
at com.ejb.EjbHomeLoader.getRemoteHome(EjbHomeLoader.java:68)
at com.ejb.EjbHomeLoader.getRemoteHome(EjbHomeLoader.java:45)
at com.ejb.EjbManager.getEjbHome(EjbManager.java:238)
at com.ejb.EjbManager.getEjbObject(EjbManager.java:184)
at com.services.BaseServices.executeLocalEjbMethod(BaseServices.java:294)
... 2 more
Caused by: java.lang.ClassNotFoundException: org.jboss.ejb.plugins.local.LocalHomeProxy (no security manager: RMI class loader disabled)
at sun.rmi.server.LoaderHandler.loadClass(LoaderHandler.java:375)
what is the difference between SCBCD 6 AND SCBCD 5 certifications
I have implemented UserNameToken and also X.509 security headers to my service using below weblog.

http://www.jroller.com/gmazza/entry/cxf_x509_profile

i have generated WSDL file using java2wsdl .i have used apache cxf 2.5.2 version.

how to apply security policies to my WSDL so that client knows that i have implemented UserNameToken and also X.509 security headers to my service.how does these security policies would come automatically by using java2WSDL command. what changes do i need to make for server side cxf-servlet.xml ?

11 years ago
A named query that sets an exclusive pessimistic on the entities returned by the query by setting the
NamedQuery lockMode element to LockModeType.PESSIMISTIC_FORCE_INCREMENT. The
application starts transaction and executes the query. Which of the following statements is correct
about the entities returned by the query?
A. Only the current transition may modify or delete the entity instances.
B. The current transaction may NOT modify or delete the entity instances.
C. Other concurrent transactions may modify or delete the entity instances.
D. Other concurrent transactions may modify but MAY NOT delete the entity instances

what is the answer for this Q?

in my view the answer should be A.

A developer wants to model the grades for a student as a Map<course, integer>. Assume that
Student and Course are entitles, and that grades are modelled by integers. Which of the following
two statements are correct? (Choose two)
A. The developer can model the grades as an element collection in the Student entity.
B. The developer can model the grades as a one To Many relationship in the Student entity.
C. The mapping for the key of the map can be specified by the @MapKeycolumn annotation.
D. The mapping for the value of the map can be specified by the @Column annotation

In my view answer should be A,D;but actual answer was A,C

An application that uses container-managed transaction demarcation creates a query within an
active transaction and receives a QueryTimeoutException. Which of those scenarios describes what
happens to the active transaction?

A. The statement and the transaction continue.
B. The query is recreated within the current transaction.
C. The statement and the transaction are marked for rollback.
D. The statement is rolled back, but the transaction continues.

In my view answer should be D;but actual answer was C
3)Given the following code:
Public void create () {
try {
doA () {
} catch (PersistenceException e) {}
try (doB) ();
} catch (PersistenceException e) {}
}
Calling method doA will cause an NonUniqueResultException to be thrown. Calling method doB will
cause an EntityExistsException to be thrown. What two options describe what will happen when the
create method is called within an application ' uses container managed transactions? (Choose two)
A. Method doB will never be called.
B. The current transaction will continue after doA executes.
C. The current transaction will continue after doB executes.
D. The current transaction will be marked for rollback when doA is called.
E. The current transaction will be marked for rollback when doB is called.



A developer has created a deep entity class hierarchy with many polymorphic relationships between
entitles. Which inheritance strategy, as defined by the inheritance Type enumerated type, will be
most performed in this scenario?
A. Single table-per-class-hierarchy (InheritanceType.SINGLE_TABLE)
B. Joined-subclass (inheritanceType. JOINED)
C. Table-per-concrete-class (inheritanceType.TABLE_PER_CLASS)
D. Polymorphic join table (inheritanceType. POLYMORPHIC_JOIN_TABLE)

what is the answer for this question and why?
Hi,

I am preparing for the JPA exam (1Z0-898).I purchased the Enthuware exam kit and having problem solving questions in the below topic.I heard that some 7 or 8 questions may come in this Topic.To conquer this which book or online tutorials should i read .

Please guide me.

Implementing Transactions and Locking
Describe the transaction demarcation management
Implement container-managed transactions (CMT)
Interact programmatically with an ongoing CMT transaction
Implement bean-managed transactions (BMT)
Apply transactions to the Java Persistence API
Hi,

I have completed my SCJP 6 exam few months back.Initially I have planned to write SCBCD 5 but when I see the SCBCD links I understood that this exam is not going to exist after April'12.

So I decided to write following exams.Can I write below exams without completing SCBCD 5?

CX-311-093 - Java Platform, Enterprise Edition 6 Enterprise JavaBeans Developer Certified Expert Exam
CX-311-094 Java Platform, Enterprise Edition 6 Java Persistence API Developer Certified Expert Exam

one more clarification.which certification is important to get good Job? ;is it EJB3 or JPA??


Raymond Tong wrote:

subba rao wrote:thanks for the reply.

(.*?)

i know that if you we use .* then its the meaning of finding any single character with 0 or more times.then what is the meaning of (.*?)


What would you use the following ?
private static String REPLACE = "$1-11-$3";
Why $1? Why $3?



your code will also work.but my code also will work if we do like this.

private static String REGEX = "(.*?)\\-(\\d+)\\-(\\d+)"; // changed
private static String INPUT = "http://xxx.xxx.xx.xx:8080/xxx-xxx-application/rservation-document/120-521-0";
private static String REPLACE = "$1-11-$3"; // changed


INPUT = INPUT.replaceAll(REGEX,REPLACE);
System.out.println(INPUT);

so my question is what is the meaning of (.*?) and in which situations do we use this symbol?
12 years ago