Help coderanch get a
new server
by contributing to the fundraiser

vidya mahavadi

Ranch Hand
+ Follow
since Nov 24, 2004
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
In last 30 days
0
Forums and Threads

Recent posts by vidya mahavadi

Hi there,

I have a similar problem of parsing a huge xml.. I need to update some of the nodes while parsing and its random (some times updating the already parsed nodes). I was using dom&xpath, but it has a huge memory usage as well. I tried STAX, but it is a forward only parser. So Any suggestions from you will be very appriciated.

Thanks
Hi,

I am looking at an application which uses ExecutorService which handles 3 threads. These threads handle events put in BlockingQueues one after the other. I need to know when one of these threads fail, I would like to stop the rest of the threads and log the exception.. Can anyone suggest a better mechanism to monitor these threads..

Thanks,
Vidya
Hi,

I am using JPA on Sybase. The context is I have few MDBs reading few thousands of messages off a topic and I am trying to instantiate/populate couple of entity beans that have one-to-many relationship and persist them to database (sybase). If I declate the number of MDBs in the container as 1, then the feed goes through smoothly. But it takes far too much time to consume all the messages.
@ActivationConfigProperty(propertyName = "maxSession", propertyValue = "1")

If I make the number of MDB instances to more than 1, occationally it is throwing up the following exception.

2007-10-22 10:41:13,181 DEBUG [org.jboss.mq.server.JMSDestinationManager] Exception occured, rolling back transaction:
org.jboss.mq.SpyJMSException: Could not commit tx: 4422; - nested throwable: (com.sybase.jdbc2.jdbc.SybSQLException: Your server command (family id #0, process id #145) encountered a deadlock situation. Please re-run your command.
)
at org.jboss.mq.pm.jdbc2.PersistenceManager.commitPersistentTx(PersistenceManager.java:855)
at org.jboss.mq.pm.Tx.commit(Tx.java:207)
at org.jboss.mq.pm.TxManager.commitTx(TxManager.java:113)
at org.jboss.mq.server.JMSDestinationManager.transact(JMSDestinationManager.java:444)
at org.jboss.mq.server.JMSServerInterceptorSupport.transact(JMSServerInterceptorSupport.java:126)
at org.jboss.mq.security.ServerSecurityInterceptor.transact(ServerSecurityInterceptor.java:197)
at org.jboss.mq.server.TracingInterceptor.transact(TracingInterceptor.java:352)
at org.jboss.mq.server.JMSServerInvoker.transact(JMSServerInvoker.java:132)
at org.jboss.mq.il.jvm.JVMServerIL.transact(JVMServerIL.java:175)
at org.jboss.mq.Connection.send(Connection.java:1110)
at org.jboss.mq.SpyXAResourceManager.commit(SpyXAResourceManager.java:166)
at org.jboss.mq.SpyXAResource.commit(SpyXAResource.java:88)
at org.jboss.tm.TransactionImpl$Resource.commit(TransactionImpl.java:2253)
at org.jboss.tm.TransactionImpl.commitResources(TransactionImpl.java:1784)
at org.jboss.tm.TransactionImpl.commit(TransactionImpl.java:340)
at org.jboss.tm.TxManager.commit(TxManager.java:240)
at org.jboss.resource.adapter.jms.inflow.JmsServerSession$XATransactionDemarcationStrategy.end(JmsServerSession.java:471)
at org.jboss.resource.adapter.jms.inflow.JmsServerSession.run(JmsServerSession.java:260)
at org.jboss.resource.work.WorkWrapper.execute(WorkWrapper.java:204)
at org.jboss.util.threadpool.BasicTaskWrapper.run(BasicTaskWrapper.java:275)
at EDU.oswego.cs.dl.util.concurrent.PooledExecutor$Worker.run(PooledExecutor.java:743)
at java.lang.Thread.run(Thread.java:595)

I am using container managed EntityManager and following is the sample code snippet where I am trying to persist the message.

FiccValuationData ficcValuationData = new FiccValuationData();
FiccTradeData tradeData = new FiccTradeData();
//Code to populate the two entities (not included)
ficcValuationData.setFiccTradeData(tradeData);
entityManager.persist(ficcValuationData);

Please let me know if anyone has got ideas on this.

Regards
Vidya
Hi guys,

I am working around the same problem of separating the log4j properties files in jboss. My stuff is working fine when I add the appenders to jboss conf/log4j.xml and now I am trying out the option that Rahul suggested. I am using maven for building the project and I have put the log4j.xml under src/main/resources/conf folder and the packaged jar has the correct path as conf/log4j.xml. Now how do I add this file to the Class-Path in manifest.mf. my plugin settings in pom.xml are as follows.

<plugin>
<artifactId>maven-jar-plugin</artifactId>
<configuration>
<archive>
<manifest>
<addClasspath>true</addClasspath>
</manifest>
</archive>
</configuration>
</plugin>

It is adding all the dependency jars to classpath, but not log4j.xml. Any ideas how to get this thing to work?

Regards,
Vidya
16 years ago
Hi guys,

I am new bie in webservices world and I have basic question. We have many services running in the company now, most of them using java-rmi and corba. Is it ok to use webservice when you know that only java clients will be using it? My understanding is that the complexity of webservices is justified only if it is inteded for cross platform communication. If it to be used for java clients only, we could probably use other distributed technologies in java like JMS, RMI, EJB etc.. What value can we add by switching to a new technology?

I know my question might sound a bit mundane, but I am in a confused state on the learning curve and I would appriciate if someone can explain me.

Thanks and regards,
V
17 years ago
Hi,

I did not get any response on this post.. But still I would like to know from anyone who must have worked on ejb3 and Maven and deployed on Unix server..

I would like to know about the project setup etc.. Any help, suggestions are much appriciated.
17 years ago
Hi,

I am working on ejb3 application and I am generating a jar file using maven2 which I am deploying on Jboss. I have couple dependency injections for getting EJB instances.

I have persistence.xml and jboss.xml in src\main\resources\META-INF folder. When I run maven package command it creates the two files in a. meta-inf (lower case) folder. So when I deploy this jar file in JBoss running on Windows it works perfectly. But it fails at the dependency injections on Jboss running on Unix. Here are my DI and pom.xml. (When I deploy on Unix I can see that the bean is deployed.)

@EJB
private AmendmentsService amendmentsBean;


<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<parent>
<artifactId>rmb-parent-pom</artifactId>
<groupId>za.co.rmb</groupId>
<version>1.0</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<groupId>za.co.rmb.amendments</groupId>
<artifactId>dealamendments</artifactId>
<name>RMB Deal Amendments</name>
<version>1.0-SNAPSHOT</version>
<dependencies>
<dependency>
<groupId>javax.xml</groupId>
<artifactId>jaxp-api</artifactId>
<version>1.3</version>
</dependency>
<dependency>
<groupId>javax.transaction</groupId>
<artifactId>jta</artifactId>
<version>1.0.1B</version>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>3.8.1</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<version>1.2.9</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>javax.j2ee</groupId>
<artifactId>j2ee</artifactId>
<version>1.5</version>
</dependency>
</dependencies>


<build>

<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.5</source>
<target>1.5</target>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<skip>true</skip>
</configuration>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>jboss-maven-plugin</artifactId>
<configuration>
<jbossHome>c:/software/jboss-4.0.5.GA</jbossHome>
<hostName>localhost</hostName>
<port>8080</port>
<server>default</server>
<fileName>
${project.build.directory}\${project.build.finalName}.${project.packaging}
</fileName>

</configuration>
</plugin>

</plugins>
</build>

</project>

Please suggest if anyone has a solution for this problem.
17 years ago
Hi,

I have ejb3 applciation which I am running on Jboss 4.0.5GA. My application structure looks pretty simple.

myApp
|
|_target
|_src
|_test
|_ main
|
|_java
|
|_resources
|_log4j.properties
|_META-INF
|
|_jboss.xml
|_persistence.xml


When I run maven to package the jar file it puts the jboss.xml and persistence.xml in meta-inf (lower case) folder. The application deploys perfectly in Jboss running on Windows as well as Unix, but does not behave the same way. (I checked in JMX console)

I have an annotation
@EJB AmendmentsService amendmentsBean in one of the MDB. When I run it on Windows this DI works perfect, but fails on Unix (The bean does not get instantiated). Is it because of the case change of the meta-inf folder in the jar file..

If anyone has come across similar problem or have a solution for this, please respond.

Thanks.
Thanks for the reply Mark!

Sybase does not support sequence generation. So I too the default way

@Id
@GeneratedValue
public Long getAmendmentId() {
return amendmentId;
}

I did not mention (strategy = GenerationType.AUTO), since it is default and did not make any difference. But why is it creating the ids properly when JPA creates the tables and fails when I create using a script??
Oh.. sorry! can the administrators move the topic to 'Object Relational Mapping Forum'
Hi,

I am using EJB3 with Jboss 4.0.5GA and Sybase. I have couple of entity beans which I want to persist.

Here is the part of the entity bean and persistence.xml..

@Entity(name = "Amendment")
@Table
public class Amendment implements Serializable {

private Long amendmentId;
private String assignedTo;
private String portfolioName;
private String shortName;
private int tradeRefNo;

@Id
@GeneratedValue
public Long getAmendmentId() {
return amendmentId;
}

// geetters and setters included
}

<?xml version="1.0" encoding="UTF-8"?>
<persistence xmlns="http://java.sun.com/xml/ns/persistence">

<persistence-unit name="amendments_ejbPU">
<description>Amendments persistence</description>
<jta-data-source>java:jdbc/dealAmendmentsDS</jta-data-source>
<class>za.co.rmb.amendments.bean.Amendment</class>
<class>za.co.rmb.amendments.bean.FieldAmendment</class>
<class>za.co.rmb.amendments.bean.xml.XPathMapping</class>
<properties>
<property name="hibernate.dialect" value="org.hibernate.dialect.SybaseDialect"/>
<property name="hibernate.hbm2ddl.auto" value="update"/>
</properties>

</persistence-unit>
</persistence>

These entities are persisted perfectly when I allow JPA to create the tables in sybase. If I create the tables using a script (with exactly same structure) it does not generate primary key for the rows while inserting.. It throws the following exception.

Caused by: javax.persistence.EntityExistsException: org.hibernate.exception.ConstraintViolationException
: could not insert: [za.co.rmb.amendments.bean.Amendment]
at org.hibernate.ejb.AbstractEntityManagerImpl.throwPersistenceException(AbstractEntityManagerIm
pl.java:622)
at org.hibernate.ejb.AbstractEntityManagerImpl.persist(AbstractEntityManagerImpl.java:218)
at org.jboss.ejb3.entity.TransactionScopedEntityManager.persist(TransactionScopedEntityManager.j
ava:175)
at za.co.rmb.amendments.bean.AmendmentsServiceBean.saveDealAmendment(AmendmentsServiceBean.java:
139)
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.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:112)
at org.jboss.ejb3.interceptor.InvocationContextImpl.proceed(InvocationContextImpl.java:166)
at org.jboss.ejb3.interceptor.EJB3InterceptorsInterceptor.invoke(EJB3InterceptorsInterceptor.jav
a:63)
at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
at org.jboss.ejb3.entity.ExtendedPersistenceContextPropagationInterceptor.invoke(ExtendedPersist
enceContextPropagationInterceptor.java:57)
at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
at org.jboss.ejb3.entity.TransactionScopedEntityManagerInterceptor.invoke(TransactionScopedEntit
yManagerInterceptor.java:54)
at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
at org.jboss.ejb3.AllowedOperationsInterceptor.invoke(AllowedOperationsInterceptor.java:46)
at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
at org.jboss.aspects.tx.TxPolicy.invokeInCallerTx(TxPolicy.java:126)
... 47 more
Caused by: org.hibernate.exception.ConstraintViolationException: could not insert: [za.co.rmb.amendments
.bean.Amendment]
at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:71)
at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:43)
at org.hibernate.id.insert.AbstractReturningDelegate.performInsert(AbstractReturningDelegate.jav
a:40)
at org.hibernate.persister.entity.AbstractEntityPersister.insert(AbstractEntityPersister.java:20
93)
at org.hibernate.persister.entity.AbstractEntityPersister.insert(AbstractEntityPersister.java:25
73)
at org.hibernate.action.EntityIdentityInsertAction.execute(EntityIdentityInsertAction.java:47)
at org.hibernate.engine.ActionQueue.execute(ActionQueue.java:248)
at org.hibernate.event.def.AbstractSaveEventListener.performSaveOrReplicate(AbstractSaveEventLis
tener.java:290)
at org.hibernate.event.def.AbstractSaveEventListener.performSave(AbstractSaveEventListener.java:
180)
at org.hibernate.event.def.AbstractSaveEventListener.saveWithGeneratedId(AbstractSaveEventListen
er.java:108)
at org.hibernate.event.def.DefaultPersistEventListener.entityIsTransient(DefaultPersistEventList
ener.java:131)
at org.hibernate.event.def.DefaultPersistEventListener.onPersist(DefaultPersistEventListener.jav
a:87)
at org.hibernate.event.def.DefaultPersistEventListener.onPersist(DefaultPersistEventListener.jav
a:38)
at org.hibernate.impl.SessionImpl.firePersist(SessionImpl.java:618)
at org.hibernate.impl.SessionImpl.persist(SessionImpl.java:592)
at org.hibernate.impl.SessionImpl.persist(SessionImpl.java:596)
at org.hibernate.ejb.AbstractEntityManagerImpl.persist(AbstractEntityManagerImpl.java:212)
... 64 more
Caused by: com.sybase.jdbc2.jdbc.SybSQLException: The column amendmentId in table Amendment does not all
ow null values.


at com.sybase.jdbc2.tds.Tds.processEed(Tds.java:2834)
at com.sybase.jdbc2.tds.Tds.nextResult(Tds.java:2156)
at com.sybase.jdbc2.jdbc.ResultGetter.nextResult(ResultGetter.java:69)
at com.sybase.jdbc2.jdbc.SybStatement.nextResult(SybStatement.java:220)
at com.sybase.jdbc2.jdbc.SybStatement.nextResult(SybStatement.java:203)
at com.sybase.jdbc2.jdbc.SybStatement.executeLoop(SybStatement.java:1766)
at com.sybase.jdbc2.jdbc.SybStatement.execute(SybStatement.java:1758)
at com.sybase.jdbc2.jdbc.SybPreparedStatement.execute(SybPreparedStatement.java:619)
at org.jboss.resource.adapter.jdbc.WrappedPreparedStatement.execute(WrappedPreparedStatement.jav
a:209)
at org.hibernate.id.IdentityGenerator$InsertSelectDelegate.executeAndExtract(IdentityGenerator.j
ava:108)
at org.hibernate.id.insert.AbstractReturningDelegate.performInsert(AbstractReturningDelegate.jav
a:33)

does anyone have a work around to this problem.

Regards,
Vidya
Hi,

I am working with 2 schemas and the structure follows like this.
doument.xsd
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified" attributeFormDefault="unqualified">
<xs:element name="document" type ="documentType"/>
<xs:complexType name="documentType">
<xs:sequence>
<xs:element name="instance" type="xs:string"/>
<xs:element name="event" type="rmb:EventType"/>
<xs:element name="version" type="xs:string"/>
</xs:sequence>
</xs:complexType>

<xs:complexType name="EventType" abstract="true">
<xs:sequence>
<xs:element name="eventType" type="xs:string"/>
</xs:sequence>
</xs:complexType>
</xs:schema>

transferEvent.xsd
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified" attributeFormDefault="unqualified">
<xs:complexType name="transferEventType">
<xs:complexContent>
<xs:extension base="rmb:EventType">
<xs:sequence>
<xs:element name="productType" type="xs:string"/>
<xs:element name="currency" type="xs:string"/>
</xs:sequence>
</xs:extension>
</xs:complexContent>
<xs:complexType>
<xs:element name="transferEvent" type="transferEventType"/>
</xs:schema>

I am using jaxb 1.0.4 for marshalling the sample code snippet looks like this.

TrasferEvent transferEvent = objectFactory.createTransferEvent();
//set produtType etc on transferEvent
Document document = objectFactory.createDocument();
document.setInstance("Test");
document.setVersion("1.0");
document.setEvent(transferEvent);
//Validate and Marshal document

Here when I do marshalling it throws exception -

com.sun.xml.bind.serializer.AbortSerializationException: tag name "TransferEvent" is not allowed. Possible tag names are: <EventType>

Any idea if I can use java 'is a' relation with schema objects...

Thanks.
Hi,

I need to use a maven 2.0 plugin for Jaxb 1.0.4. I found couple of link over net, but none are well explained. Can anyone give me some help preferably with an example for this?

This is quite urgent.. I would appriciate any help on this.

Regards,
Vidya
17 years ago
Hi,

I am new to Webservices, and I need correct direction to start learning. I have downloaded the Sun AppServer 9i and webservices pack.. But it compains about the version compatability between the two. Can anyone please tell me which are the versions of Appserver, JDK and webservices pack that can work for me.

Thanks,
Vidya
18 years ago