xsunil kumar

Ranch Hand
+ Follow
since Dec 14, 2009
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
2
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by xsunil kumar

Hi All,

I am using weblogic server to send and receive JMS message.

Use case is : Application A is deployed in Server A and Application B is deployed in Server B. Application A sends JMS request and Application B and receives the response (Synchronous method using Queue Receiver).

This use case is heavily used and i can expect around 2000 executions per seconds.

Because of Performance, we have cached Initial Context, Queue Sender, Queue Receiver using static variable.  Connection and session each time we are creating. But Oracle document is saying that Connection should also be cached. When we Cache the connection object, then after some time, we are getting close connection exception. Looks like cached connection has been closed by the remote weblogic server.

Please suggest how to do it or what is the best way to do it.

Regards,
Sunil
Hi All,

I am using weblogic 12c version and have created a data source in weblogic console. It is non XA data source. In connection pool properties setting i have provided defaultAutoCommit = false.

In the application i am using EJB transactions with toplink. Problem is that in one transaction, there are 5 insert statements and when i view database report, we found that there are 5 commit happens for one transaction which is not the desired behaviour. Using EJB transaction management, there should be one commit for all 5 transactions.

On further verification, we found that when toplink executes insert statement, weblogic is committing it. Because of this one 5 commit is happening. even if after providing defaultAutoCommit = false in connection pool properties, it is behaving the same.

Please provide your valuable suggestions.

Regards,
Sunil
1 year ago
Connection , Prepared Statement and Result set i have defined as instance variable. And in open method, i am preparing statement and querying the database. This will set the value of resultset (instance Variable).

Now in readItem i am trying to read the resultset and getting "Resultset is closed" exception.

Now able to understand, Why resultset in getting closed.

-Sunil
Hi,

I am trying to create Item Reader, Item Processor and Item Writer in Java EE 7 batch in Weblogic 12.2.2. My Item Reader should fetch the data from the database and Processor should consume the data.

For this, i have defined PreparedStatement, ResultSet as a instance variable in Reader. In Open method inside reader, i am fetching the data from database and setting the resultset. In readItem method, i am trying to do resultset.next but there i am getting exception that Resultset is already closed.

Upon debugging, i found that Resultset as well as Prepared Statement both are closed. Because of this i am not able to access the resultset in readItem() method.

Please help, why Prepared Statement and Resultset is getting closed automatically.

Regards,
Sunil

1
down vote
favorite
My spring java-config application packed as war runs wihout problem on weblogic 12.1.3 so I tried to deploy same war into weblogic 12.2.1 where it causes java.io.FileNotFoundException: Could not open ServletContext resource [/WEB-INF/DispatcherServlet-servlet.xml]. It seems like DispatcherServlet servlet is initialized with XmlWebApplicationContext (default one) instead of AnnotationConfigEmbeddedWebApplicationContext in 12.2.1 even when war is the same. Has someone any idea what was changed in weblogic implementation since previous version what is causing this problem?

Using same war:

in WLS 12.1.3 it is working without issue, application configures using annotations/java
in WLS 12.2.1 the same application looks for xml configuration at some point instead of configuring it using annotations/java as in 12.1.3.
Hi All,

I want to use Java CDI with transaction management but i am getting below exception
javax.persistence.TransactionRequiredException

Use case is
1. I have one DAO Impl class where i am injecting Entity manager
@PersistenceContext
protected EntityManager entityManager;

2. I have one service class annotated with @Named annotation.

Now in service class, i have one method, which i have tried to annoted with Transaction annotation


@Transactional(value=Transactional.TxType.REQUIRED)
public String printMethod() {

List<ClientStatus> lst = clientStatusDao.getAll();

for (ClientStatus clientStatus : lst) {
System.out.println("----------------- clientStatus ------------ " + clientStatus.clientStatusDesc);
if(clientStatus.getClientStatus().equals("A")) {
System.out.println("----------------- changing client status ------------ ");
clientStatus.setClientStatusDesc("Activ");
clientStatusDao.updateStatus(clientStatus);
}
}
return s;

}


Here i am able to fetch the records from the database but on update i am getting below exception


javax.persistence.TransactionRequiredException
org.apache.openejb.persistence.JtaEntityManager.assertTransactionActive(JtaEntityManager.java:116)
org.apache.openejb.persistence.JtaEntityManager.merge(JtaEntityManager.java:156)

I am not using EJB. Some blogs i read that Java EE 7 along with JTA 1.2 does not require EJB for the transaction.

Not able to understand, where i am doing mistake.

Please help,

Regards,
Sunil
Hi Prajakta,

I am also facing the same issue. Can you give me example, how you have done the lookup of EJB.

Regards,
Sunil
Interesting .... Please let us know, whey it was going to save even if isUserExists() method returns true.
Hi All,

I am trying to generate XSD schema from JAXB object. I have used SchemaOutputResolver to generate schema files and it is working fine.

But problem is that one, in my JAXB object, there are reference to other JAXB objects also. So in this case, SchemaOutputResolver is generating only one XSD file having the complex type of referenced object.

I want that it should generated another XSD file for the reference object and that should be imported into the parent XSD file.

Please provide your valuable Feedback.

-Sunil
Hi All,

experienced some weird behaviour of JPA (EclipseLink and Hibernate) and I can't find it defined in the specs, so I hope someone can give me a hint.

Given the following scenario:

Entity C is assigned to table C
Entity B is an @Embeddable
- having a unidirectional @OneToOne reference to C (orphanRemoval=true)

Entity A is assigned to table A
- having an @Embedded reference to B
- having a unidirectional @OneToOne reference to C (orphanRemoval=true)

When I create an instance of
Code: [Select all] [Show/ hide]
a -------- (1 : 1) ------> c1
\----- (embedded) -----> b ------- (1 : 1) -------> c2

a having the 1:1 relation to c1 and having the relation to c2 via b and save it to the database, all SQL statements are created as expected. When I set both references to C (namely c1 and c2) to null and save the same entity again, I expect JPA to set the fields to null and delete the orphans afterwards.

Deletion of C takes place only for c1. c2 is not being deleted, though both fields are set to null.

The relations to C are are annotated as given below:

Code: [Select all] [Show/ hide]
@OneToOne(cascade = {PERSIST, MERGE, REFRESH}, orphanRemoval = true)
@JoinColumn(name = "<field_name>")
private C c;

This behaviour can be seen with all EclipseLink version starting from 2.3.3 up to 2.5.2-M1, as well as with Hibernate 4.3.4. EclipseLink only works (but showing the weird behaviour) when the entities are enhanced by static weaving. Without static weaving there is a NullPointerException in UnitOfWorkImpl.calculateChanges.

Code: [Select all] [Show/ hide]
java.lang.NullPointerException
at org.eclipse.persistence.internal.sessions.UnitOfWorkImpl.calculateChanges(UnitOfWorkImpl.java:696)
at org.eclipse.persistence.internal.sessions.RepeatableWriteUnitOfWork.writeChanges(RepeatableWriteUnitOfWork.java:438)
at org.eclipse.persistence.internal.jpa.EntityManagerImpl.flush(EntityManagerImpl.java:863)
at OrphanRemovalTest.saveFlushAndClear(OrphanRemovalTest.java:74)
at OrphanRemovalTest.testApp(OrphanRemovalTest.java:47)


Even using @PrivateOwned in conjunction with EclipseLink does not change anything.

Please help how to solve this issue.

Regards,
Sunil
Hi All,

In my application there are around 2000 java files. I want to read all java files and all methods written inside the each files and change the content of the method on some code criteria.

Manually doing this work will take lot of time. I want to write a program which reads all methods and i can change the method by applying some formula.

Please help me to write such type of utility program.


-Sunil
3 years ago
Hi All,

I am trying to build spring annotation based project but on run time i am getting below exception. After doing google i found that partial order class is in aspectjweaver.jar. But in my project i have not used any Spring AOP. then why aspectjweaver.jar is required for this project.

Please help me.

-Sunil

SmtpDetailsManagerImpl.class]: Initialization of bean failed; nested exception is java.lang.NoClassDefFoundError: org/aspectj/util/PartialOrder
$PartialComparable
at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessPropertyValues(AutowiredAnnotationBeanPostProcessor.java:292)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1185)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:537)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:475)
at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:304)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:228)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:300)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:195)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:703)
at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:760)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:482)
at org.springframework.web.context.ContextLoader.configureAndRefreshWebApplicationContext(ContextLoader.java:403)
at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:306)
at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:106)
at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4206)
at org.apache.catalina.core.StandardContext.start(StandardContext.java:4705)
at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:799)
at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:779)
at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:601)
3 years ago
Hi All,

I have a Practitioner class which is used to do the partition for the batch jobs. In partition method , i am creating a list of parameters and setting this list in ExecutionContext.

Below is the code sample.



This parameter value i am going to use in step configuration and have to retrieve it in job xml configuration file.

I am trying to use below




I want to set the value of start index as "1" but not able to understand how to do it.

Please help.

Regards,
Sunil

4 years ago