vani venkat

Ranch Hand
+ Follow
since Nov 21, 2006
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
1
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 vani venkat

Hi

We are using jboss 6 as Application server.

I have a scheduler, that should run every 5 minutes to do some work related to database. Scheduler class(PollingThread) is with my ear file. and i have defined scheduler-service.xml inside meta-inf folder.

here is my folder structure.



SSLNEar.ear

- META-INF

- application.xml

- scheduler-service.xml

- SalesSelection

- css

- html

- js

- jsp

- WEB-INF

-classes

-lib

- SalesSelection.jar

- com.callidus.ssln.server.util.PollingThread

-spring-servlet.xml

-web.xml



Here is my scheduler-service.xml



<mbean code="org.jboss.varia.scheduler.Scheduler"

name=":service=Scheduler">

<attribute name="StartAtStartup">true</attribute>

<attribute name="SchedulableClass">com.callidus.ssln.server.util.PollingThread</attribute>

<attribute name="SchedulableArguments">Polling,12345</attribute>

<attribute name="SchedulableArgumentTypes">java.lang.String,int</attribute>

<attribute name="InitialStartDate">NOW</attribute>

<attribute name="SchedulePeriod">300000</attribute>

<attribute name="InitialRepetitions">-1</attribute>

<attribute name="FixedRate">true</attribute>

<depends>

<mbean code="javax.management.timer.Timer" name="jboss:service=Timer"/>

</depends>

</mbean>



This deploys and works fine in windows OS, but is giving NullPointer exception and can not find Polling Thread in linux server.





Here is the exception while deploying it in Linux box.



05:34:48,171 ERROR [AbstractKernelController] Error installing to Instantiated: name=:service=Scheduler state=Described mode=Manual requiredState=Configured

java.lang.NullPointerException
at EDU.oswego.cs.dl.util.concurrent.ConcurrentReaderHashMap.hash(ConcurrentReaderHashMap.java:299)

at EDU.oswego.cs.dl.util.concurrent.ConcurrentReaderHashMap.get(ConcurrentReaderHashMap.java:411)

at org.jboss.mx.server.registry.BasicMBeanRegistry.getMBeanMap(BasicMBeanRegistry.java:956)

at org.jboss.mx.server.registry.BasicMBeanRegistry.contains(BasicMBeanRegistry.java:580)

at org.jboss.mx.server.MBeanServerImpl.isRegistered(MBeanServerImpl.java:548)

at org.jboss.system.ServiceCreator.install(ServiceCreator.java:102)

at org.jboss.system.microcontainer.InstantiateAction.installAction(InstantiateAction.java:45)

at org.jboss.system.microcontainer.InstantiateAction.installAction(InstantiateAction.java:37)

at org.jboss.dependency.plugins.action.SimpleControllerContextAction.simpleInstallAction(SimpleControllerContextAction.java:62)

at org.jboss.dependency.plugins.action.AccessControllerContextAction.install(AccessControllerContextAction.java:71)

at org.jboss.dependency.plugins.AbstractControllerContextActions.install(AbstractControllerContextActions.java:51)

at org.jboss.dependency.plugins.AbstractControllerContext.install(AbstractControllerContext.java:348)

at org.jboss.system.microcontainer.ServiceControllerContext.install(ServiceControllerContext.java:298)

at org.jboss.dependency.plugins.AbstractController.install(AbstractController.java:1633)

at org.jboss.dependency.plugins.AbstractController.incrementState(AbstractController.java:935)

at org.jboss.dependency.plugins.AbstractController.resolveContexts(AbstractController.java:1083)

at org.jboss.dependency.plugins.AbstractController.resolveContexts(AbstractController.java:985)

at org.jboss.dependency.plugins.AbstractController.change(AbstractController.java:823)

at org.jboss.dependency.plugins.AbstractController.change(AbstractController.java:553)

at org.jboss.system.ServiceController.doChange(ServiceController.java:689)

at org.jboss.system.ServiceController.install(ServiceController.java:275)

at org.jboss.system.deployers.ServiceDeployer.deploy(ServiceDeployer.java:90)

at org.jboss.system.deployers.ServiceDeployer.deploy(ServiceDeployer.java:46)

at org.jboss.deployers.spi.deployer.helpers.AbstractSimpleRealDeployer.internalDeploy(AbstractSimpleRealDeployer.java:62)

at org.jboss.deployers.spi.deployer.helpers.AbstractRealDeployer.deploy(AbstractRealDeployer.java:50)

at org.jboss.deployers.plugins.deployers.DeployerWrapper.deploy(DeployerWrapper.java:179)

at org.jboss.deployers.plugins.deployers.DeployersImpl.doDeploy(DeployersImpl.java:1448)

at org.jboss.deployers.plugins.deployers.DeployersImpl.doInstallParentFirst(DeployersImpl.java:1166)

at org.jboss.deployers.plugins.deployers.DeployersImpl.doInstallParentFirst(DeployersImpl.java:1187)

at org.jboss.deployers.plugins.deployers.DeployersImpl.install(DeployersImpl.java:1107)

at org.jboss.dependency.plugins.AbstractControllerContext.install(AbstractControllerContext.java:348)

at org.jboss.dependency.plugins.AbstractController.install(AbstractController.java:1633)

at org.jboss.dependency.plugins.AbstractController.incrementState(AbstractController.java:935)

at org.jboss.dependency.plugins.AbstractController.resolveContexts(AbstractController.java:1083)

at org.jboss.dependency.plugins.AbstractController.resolveContexts(AbstractController.java:985)

at org.jboss.dependency.plugins.AbstractController.change(AbstractController.java:823)

at org.jboss.dependency.plugins.AbstractController.change(AbstractController.java:553)

at org.jboss.deployers.plugins.deployers.DeployersImpl.process(DeployersImpl.java:783)

at org.jboss.deployers.plugins.main.MainDeployerImpl.process(MainDeployerImpl.java:699)

at org.jboss.system.server.profileservice.repository.MainDeployerAdapter.process(MainDeployerAdapter.java:117)

at org.jboss.system.server.profileservice.repository.ProfileDeployAction.install(ProfileDeployAction.java:70)

at org.jboss.system.server.profileservice.repository.AbstractProfileAction.install(AbstractProfileAction.java:53)

at org.jboss.system.server.profileservice.repository.AbstractProfileService.install(AbstractProfileService.java:403)

at org.jboss.dependency.plugins.AbstractControllerContext.install(AbstractControllerContext.java:348)

at org.jboss.dependency.plugins.AbstractController.install(AbstractController.java:1633)

at org.jboss.dependency.plugins.AbstractController.incrementState(AbstractController.java:935)

at org.jboss.dependency.plugins.AbstractController.resolveContexts(AbstractController.java:1083)

at org.jboss.dependency.plugins.AbstractController.resolveContexts(AbstractController.java:985)

at org.jboss.dependency.plugins.AbstractController.install(AbstractController.java:775)

at org.jboss.dependency.plugins.AbstractController.install(AbstractController.java:540)

at org.jboss.system.server.profileservice.repository.AbstractProfileService.registerProfile(AbstractProfileService.java:308)

at org.jboss.system.server.profileservice.ProfileServiceBootstrap.start(ProfileServiceBootstrap.java:258)

at org.jboss.system.server.profileservice.ProfileServiceBootstrap.start(ProfileServiceBootstrap.java:97)

at org.jboss.bootstrap.impl.base.server.AbstractServer.startBootstraps(AbstractServer.java:860)

at org.jboss.bootstrap.impl.base.server.AbstractServer$StartServerTask.run(AbstractServer.java:441)

at java.lang.Thread.run(Thread.java:662)

05:34:48,196 ERROR [AbstractKernelController] Error installing to Real: name=vfsfile:/people/calduser/jboss-6.0.0.M1/server/default/deploy/SSLNEar.ear/ state=PreReal mode=Manual requiredState=Real

org.jboss.deployers.spi.DeploymentException: Error deploying: :service=Scheduler
at org.jboss.deployers.spi.DeploymentException.rethrowAsDeploymentException(DeploymentException.java:49)

at org.jboss.system.deployers.ServiceDeployer.deploy(ServiceDeployer.java:118)

at org.jboss.system.deployers.ServiceDeployer.deploy(ServiceDeployer.java:46)

at org.jboss.deployers.spi.deployer.helpers.AbstractSimpleRealDeployer.internalDeploy(AbstractSimpleRealDeployer.java:62)




12 years ago
as of now, i am going with work around,
1. save a record in child table(attachment here) and then get the id of record
2. set it as primary key of candidate, position, attachment. save this bean.


i wish there is a better way to handle it in hibernate way of doing using objects rather than dealing with child records first. but with composite keys it is not allowing me to map attachment as object. and childs id won't be available before attachment is inserted, it fails while saving candidate position attachment. i donot know a way to actually save attachment first and then insert candidate position attachment in one call to session.save()






hi,

i try my best to explain scenario of my tables.

there could be many records in attachment table for a given candidateSeq and positionSeq. this is represented as one to many with many id being set as foriegn key like in following two tables.

CandidatePositionAttachment table
PRIMARY KEY (candidateSeq, positionSeq, attachmentSeq)
FOREIGN KEY (attachmentSeq) REFERENCES CSS_Attachment

CSS_Attachment table
PRIMARY KEY attachmentSeq.

now how do I create mapping between candidatePositionAttachment and Attachment?

CandidatePositionAttachment.hbm.xml


is this correct? however it is not many to one mapping we have between these tables but it is one to many. and there is no key-one-to-many for this.

Requirement is to save multiple attachments for a given candidateId and positionId. using the above mapping, following code to save attachment for a given candidateId and positionId is giving null pointer exception when session.save is called.



really appreciate any help or pointer regarding this.


Note: this worked fine when i had one to one mapping between these two tables. and attachmentSeq was not included in primary key.




and created rows in attachment as well as candidatePositionAttachment tables were inserted really well. however, now the requirement is to add attachmentSeq as one of the keys of composite key.
Can some one guide me how to do that?
hi

i have a task that needs to be executed at frequent intervals of time(every 5 min.) so i have been using scheduler-service.xml of jboss to do that. declaration of this class in scheduler-service is as follows.





now, my scheduled implementation(PollingThread) needs to access spring related beans. i have declared a private variable of spring bean inside PollingThread and it is not instatiating that and is giving null pointer exception while accessing spring related bean. so this should be passed as paramter in one of application context.



how can I inject spring bean inside polling thread. should i delcare polling thread as one bean in spring application context and pass spring bean to it.
If I declare it in spring application context, am i not technically declaring them in two places and it is getting created twice?
Please suggest .



Thanks
12 years ago
hi,
i am retrieving all this information in a DTO, and then comitting the transaction. can some one point out what else is wrong here?
thanks
hi,
not sure what the problem is but did you try using this instead of openSession?
hi
I have one to one mapping between three objects.
Job --> salesRole --> positionTemplate.

I am getting this "failed to lazily initialize a collection of role" error with hibernate 3. i tried to use lazy="false" to force hibernate to load eagerly.
still i get the same error when i try to access position template fields. Here are my hibernate mapping files.
job.hbm.xml


SalesRole.hbm.xml

position template.hbm.xml


Can some one please point out the problem. here is how i am loading Job object.



i tried to use http://today.java.net/pub/a/today/2005/10/11/testing-hibernate-mapping.html?page=last not to load beans lazily. the commented code in above method shows that. that gives the same problem. I have been trying to figure it out for the past two days. appreciate any kind of help regarding this.
thanks
I restarted Jboss server and here is the new exception.
is there anything wrong with mapping?

15:46:21,259 INFO [STDOUT] Hibernate: insert into CSS_User (userId, password, f
irstName, lastName) values (?, ?, ?, ?)
15:46:21,291 INFO [STDOUT] Hibernate: insert into css_candidate (firstName, las
tName, emailId, businessPhone, homePhone, cellPhone, street, apt, city, state, z
ip, country, createDate, modifiedDate, userId) values (?, ?, ?, ?, ?, ?, ?, ?, ?
, ?, ?, ?, ?, ?, ?)
15:46:21,291 WARN [org.hibernate.util.JDBCExceptionReporter] SQL Error: 1452, S
QLState: 23000
15:46:21,291 ERROR [org.hibernate.util.JDBCExceptionReporter] Cannot add or upda
te a child row: a foreign key constraint fails (`ssln`.`css_candidate`, CONSTRAI
NT `FK_Candidate_userId` FOREIGN KEY (`userId`) REFERENCES `css_user` (`userId`)
ON UPDATE CASCADE)

why is it not creating record in css_user table? should i save user too?
I have one to one relation between user and candidate. ideally user is used for authentication purposes and candidate holds all other information. i defined many to one relation in candidate hm file. when i try to save candidate bean, it gives lock wait time out exception. can some one point out what the problem is. i searched and could not get good infromation of solution for this.

Here are the hbm files.
User.hbm.xml


Candidate.hbm.xml


candidate.java


private User candidateUserId;
public User getCandidateUserId() {
return candidateUserId;
}

public void setCandidateUserId(User candidateUserId) {
this.candidateUserId = candidateUserId;
}




saving candidate bean in DAO.

thats nice TIm. I will try that approach today, so for mapping table there should be association class and in user and jobs, there should be one to many relation to join table. right.
I need to get that book java persistence with hibernate. is it good for beginners?

adding distinct to the hql did the trick. sure it took lot of time.

List<Candidate> candidateUpdates = session.createQuery("select distinct c from Candidate as c inner join fetch c.jobs as j").list();


hi
i have candidatejob relation as mentioned in my earlier post
join hql query


List<Candidate> candidateUpdates = session.createQuery("from Candidate as c inner join fetch c.jobs as j").list();



this is giving duplicate records. example, i have candidate 2 applying for 2 jobs. candidateUpdates List is containing two objects of candidate and each candidate bean is populated with 2 jobs. hence when i iterate, it is giving total of 4 records. how to avoid this duplicate records ?

if i try to load just one object as below,



it is giving correct results. but the problem is when i select all the candidates and jobs. Is there anything i am missing here?
sorry here is the query that is returning expected results. how should i map in hibernate.

select c.firstName,c.lastName,j.jobTitle,cj.status from css_candidate c,css_candidatejob cj,css_job j where c.candidateSeq = cj.candidateSeq and cj.jobSeq = j.jobSeq



should i have separate mapping file and java bean persistent class for css_candidatejob? and do "from candidateJob". this will return all records in candidateJob table as a list of candidateJob beans. Now how to load candidate and job classes for each of the rows to get firstName and jobTitle?

really appreciate help in this.
hi,
I have 2 two tables(css_job and css_candidate) with many to many mapping. it is normalized and many to many mappings are put in table called css_candidatejob.

I have to show all the candidates and jobs provided that there is mapping between these two in css_candidatejob.
query is "select c.firstName ,j.title from css_job j inner join css_candidate c"

i am trying to achieve this using hibernate mappings and HQL.

here is my candidate mapping.


here is job mapping.


java beans(Job and Candidate) have private String attributes with the same name and sets with candidates and jobs as names.

here is the code that fires inner join between these two tables.


now my questions is how to show firstName from this result. for timebeing i am trying to print first name for tiem being but need fields from both job and candidate. so i can not specifically say select candidate in query and assign it to candidate Class.

Please suggest. it could be something very simple as i have started working with hibernate very recently.
thanks
did you search for file application_name in jboss folders.
mine created folders in some temp location.
C:\jboss-6\server\default\tmp\vfs\vfsinmemory62f86dafefe63eef\sa.war

my was file was sa.war. it had all the files and folders.



12 years ago