This week's book giveaway is in the iOS forum.
We're giving away four copies of Classic Computer Science Problems in Swift and have David Kopec on-line!
See this thread for details.
Win a copy of Classic Computer Science Problems in Swift this week in the iOS forum!

Manish Shah

Greenhorn
+ Follow
since Jun 09, 2002
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
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Manish Shah

Has any one used Ucertify test prep kit for SCDJWS 5.

I need review about this prep kit.

Anyone know good prep kit available in the market?
What is difference between service and an endpoint..?

To my knowledge service is a layer where business logic gets processed (synchronously or asynchronously) whereas an endpoint is that same service exposed as a web-service whether SOAP based or Restful based.

Please correct me..
Congrats for superb score..

Yes its the knowledge that matters & a pass is a pass after all.
the structure will look like this

@Entity
public class Dog{
...
private Collection<Flea> flea=new ArrayList<Flea>();

@One to Many
@JoinColumn(name="FLEA_ID")
public Collection<Flea> getFlea(){
return flea;
}

...
}

@Entity
public class Flea{
...

}

No need of having mapping information in Flea class since this is unidirectional.

Dog class is the owner side since it is annotated by @JoinColumn.

This approach can also be implemented by join tables.

@Entity
public class Dog{
...
private Collection<Flea> flea=new ArrayList<Flea>();

@One to Many
@JoinTable(name="DOG_FLEA"),
joinColumns{@JoinColumn(name="DOG_ID")},
inverseJoinColumns={@JoinColumn(name="FLEA_ID")}
)
public Collection<Flea> getFlea(){
return flea;
}

...
}



Do we need @PersistenceUnit annotation at line 41?.

Also I guess the default entity transaction manager is JTA, so i think you need to specify that you need Resource_Local.

In your persistence.xml file you need to remove <jta-data-source> element & add
<non-jta-data-source>RESOURCE_LOCAL</non-jta-data-source> element.

Correct me if i am wrong.



No.

Not all annotations are overridable.

Session bean types like @Stateful or @Stateless cant be overridden via a descriptor.
I am facing a serious problem while deploying the spring based application. Ant build successfully creates the ear file. Even there is no compilation error seen in Eclipse. All the required jars are added.

But after deploying when I click 'Start-->Servicing All Request' I get the following error: "java.lang.ClassNotFound: com.xxx...(class name of my application)

Following is the stack trace i took from console:

<Dec 3, 2008 3:12:57 AM EST> <Error> <Deployer> <BEA-149265> <Failure occured in
the execution of deployment request with ID '1228291968273' for task '4'. Error
is: 'weblogic.application.ModuleException: '
weblogic.application.ModuleException:
at weblogic.servlet.internal.WebAppModule.startContexts(WebAppModule.jav
a:894)
at weblogic.servlet.internal.WebAppModule.start(WebAppModule.java:336)
at weblogic.application.internal.flow.ModuleStateDriver$3.next(ModuleSta
teDriver.java:204)
at weblogic.application.utils.StateMachineDriver.nextState(StateMachineD
river.java:26)
at weblogic.application.internal.flow.ModuleStateDriver.start(ModuleStat
eDriver.java:60)
Truncated. see log file for complete stacktrace
java.lang.ClassNotFoundException:
com.***.systemmgmt.logging.SysMgmtLogManager

at weblogic.utils.classloaders.GenericClassLoader.findLocalClass(Generic
ClassLoader.java:286)
at weblogic.utils.classloaders.GenericClassLoader.findClass(GenericClass
Loader.java:259)
at weblogic.utils.classloaders.ChangeAwareClassLoader.findClass(ChangeAw
areClassLoader.java:54)
at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
Truncated. see log file for complete stacktrace
>
<Dec 3, 2008 3:12:57 AM EST> <Error> <Deployer> <BEA-149202> <Encountered an exc
eption while attempting to commit the 7 task for the application 'Path4LogonApp'
.>
<Dec 3, 2008 3:12:57 AM EST> <Warning> <Deployer> <BEA-149004> <Failures were de
tected while initiating start task for application 'Path4LogonApp'.>
<Dec 3, 2008 3:12:57 AM EST> <Warning> <Deployer> <BEA-149078> <Stack trace for
message 149004
weblogic.application.ModuleException:
at weblogic.servlet.internal.WebAppModule.startContexts(WebAppModule.jav
a:894)
at weblogic.servlet.internal.WebAppModule.start(WebAppModule.java:336)
at weblogic.application.internal.flow.ModuleStateDriver$3.next(ModuleSta
teDriver.java:204)
at weblogic.application.utils.StateMachineDriver.nextState(StateMachineD
river.java:26)
at weblogic.application.internal.flow.ModuleStateDriver.start(ModuleStat
eDriver.java:60)
Truncated. see log file for complete stacktrace
java.lang.ClassNotFoundException:
com.***.systemmgmt.logging.SysMgmtLogManager
at weblogic.utils.classloaders.GenericClassLoader.findLocalClass(Generic
ClassLoader.java:286)
at weblogic.utils.classloaders.GenericClassLoader.findClass(GenericClass
Loader.java:259)
at weblogic.utils.classloaders.ChangeAwareClassLoader.findClass(ChangeAw
areClassLoader.java:54)
at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
Truncated. see log file for complete stacktrace
>

Any idea what is the reason? I tried by checking all the jars so that there should be no conflict..

I see that weblogic's Generic Class loader is not able to load the class. I checked it in my ear file but the required is present. Still it is not able to locate the file.

Thanks
Manish
9 years ago
Hello,

I am newbie in Spring Framework & I am finding using spring very interesting. Currently I am using Spring 2.5.

Coming to my query..

In my application I need to update the user information in LDAP as well as Audit log those information into the database.

For the pupose of using transaction I searched so many ways of performing transaction & found using @Transactional annotation to be suitable currently.
So in my service interface I annotated all the methods with @Transactional.
I also appended <tx:annotationdriven/> element in applicationContext.xml
But during deployment (I use weblogic 9.2 server) i got error saying
"org.springframework.beans.factory.NoSuchBeanDefinitionException: No bean named 'transactionManager is defined"
I thought the default transaction manager would handle the situation.

Later on I defined a bean :_
<bean id="transactionManager"
class=" org.springframework.ldap.transaction.compensating.manager.ContextSourceAndDataSourceTransactionManager">
<property name="dataSource" ref="dataSource" />
<property name="contextSource" ref="ldapContextSource"></property>
</bean>

<!-- Get the datasource from above loaded property file. -->
<bean id="dataSource" class="org.springframework.jndi.JndiObjectFactoryBean">
<property name="jndiName">
<value>${dataSource}</value>
</property></bean>

<!-- LDAP Bean -->
<bean id="ldapUtil" class="com.***.LdapUtil">
<property name="ldapTemplate" ref="ldapTemplate"></property>
</bean>

<!-- LdapTemplate Bean -->
<bean id="ldapTemplate" class="org.springframework.ldap.core.LdapTemplate">
<property name="contextSource" ref="ldapContextSource"></property>
</bean>

<!-- Path4 Context Source -->
<bean id="ldapContextSource" class="org.springframework.ldap.core.support.LdapContextSource">
<property name="url" value="ldap://***.xxx:31389" />
<property name="base" value="o=***" />
<property name="userDn" value="***" />
<property name="password" value="***" />
</bean>

I want to run both the (LDAP & DB) operation in a single transaction. If either of the operation fails it should rollback. I read in docs that this transactionManager doesnt support two phase commit.
How should I ensure that the transaction I am having is safe & will be roll backed during exception.

Also I would like to know that do we need to specify @Transactional annotation in the furthur following classes like DAOInterface, DAOImpl, LDAPUtil etc.. or only mentioning it service layer will suffice?

Please let me know is my approach correct? I find using TransactionProxyFactoryBean to be very verbose so I wanted to try my hands in annotationdriven.

Thanks..
Manish
Congrats.. fantastic score
9 years ago
Hello,

I want to learn & implement Web Service Security. I would like to know what are the different aspects of security & how to implement each one of them.

Please suggest me if you are aware of any good refrence material for JAX WS Security.

Thanks
Manish
9 years ago
Yes even i faced similar problem.

I was using JAAS & had CustomLoginModule and authenticating the user against the database.

I had the following entry in login-config.xml which was not getting parsed

<application-policy name="Example">
<authentication>
<login-module code="com.manish.jaas.RdbmsLoginModule" flag="required">
<module-option name="url">
jdbc:mysql://localhost:3306/db1?user=root&password=pass
</module-option>
<module-option name="driver">
com.mysql.jdbc.Driver
</module-option>
</login-module>
</authentication>
</application-policy>

after wasting the whole day in investigating about the problem, I tried my hands to alter the value of url. I removed the query string and added another module-option tag for user name & password.

It successfully parsed the login-config.xml. The ampersand ('&') was creating the problem.

I altered it in this way

<application-policy name="Example">
<authentication>
<login-module code="com.manish.jaas.RdbmsLoginModule" flag="required">
<module-option name="url">
jdbc:mysql://localhost:3306/db1
</module-option>
<module-option name="driver">
com.mysql.jdbc.Driver
</module-option>
<module-option name ="username">root</module-option>
<module-option name ="password">pass</module-option>
</login-module>
</authentication>
</application-policy>
9 years ago
Hi James

I am also doing POC in JAAS & configuring it in JBoss. I would like to know What do you mean by Web based API..

'JAAS is a very good API for handling security. It is best applied to standard Java objects, not web-based API objects.'

Arent web based API java objects? Please explain..

Thanks
9 years ago
Thanks folks for your earliest reply.

Yes the tables are created inmemory.

In order to avoid drops & creates & i have kept the below entry in hibernate config
<property name="hbm2ddl.auto">validate</property>

and have written a simple jdbc servlet (loads on start up) that will check whether the table is existing or not. It will start the HSQL server & then it will create the table if it does not exists.