Win a copy of Succeeding with AI this week in the Artificial Intelligence and Machine Learning forum!

Anup Om

Ranch Hand
+ Follow
since Dec 30, 2009
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 Anup Om

Can someone please point out what else is need to configure the JPA entity manager?


<bean id="entityManagerFactory"
class="org.springframework.orm.jpa.LocalEntityManagerFactoryBean">
<property name="persistenceUnitName" value="MyABook" />
</bean>



Thanks for you help.
9 years ago
Hello Everybody,

I am running a webapp on Jboss 6. I have a UserDAO class that perists User objects annotated with JPA annotations.
Everything works fine when I use

<jee:jndi-lookup id="entityManagerFactory" jndi-name="java:/MyABookFactory" />


But, when I use below, I am getting a "java.lang.IllegalArgumentException: Unknown entity: com.mypackage.User", when I am trying to save the User object using entitymanager's persist.

<bean id="entityManagerFactory"
class="org.springframework.orm.jpa.LocalEntityManagerFactoryBean">
<property name="persistenceUnitName" value="MyABook" />
</bean>



Can some one please point out where I am going wrong.

Here is my applicationContext.xml


persistence.xml


Thanks for help in advance.
9 years ago
Hello,
This is what I read about decorator design pattern.

Decorators prove more flexible than inheritance because the relationship between decorators and the objects they decorate can change at runtime, but relationships between base classes and their extensions are fixed at compile time.



Can someone please help me understand what it means by "relationship between decorators and the objects they decorate can change at runtime".

Thanks for your help in advance.
Hello,

I am trying to unit test Struts2 action class using Struts2-junit plugin. My application renders its result using tiles. I am getting a NullPointerException.




Thanks for help in advance.
9 years ago
Hi Phil,

This is what I read in API for JoinTable.


This annotation is used in the mapping of associations. It is specified on the owning side of a many-to-many association, or in a unidirectional one-to-many association.



But, your mapping is bi-directional. I think, JoinColumns must be used to define composite PK mapping.

I am no expert in Hibernate. Expert opinion welcome.
Thank you so much. I understand better now. Secondary table mapping may be used for table if they have same primary key.
Hello,

The struts2 app I am developing uses container based security (<security-constraint> in web.xml). But, the user registration page is unsecure.
Once the user reqisters successfully, he would have to access secured resources to perform further actions. when the user hits the secured resources' url, he is
being asked to authenticate again. I don't want that to happen. If a user is able to register successfully, I want to consider him as a authenticated user.

For now, I am calling HttpServletRequest's login() method to perform authentication in the user registeration action. But, this method is added in Servlet 3.
What are the other alternatives I have? How can I do it with Servlet 2.5?

Thanks for help in advance.
9 years ago
Hello Everybody,

I am trying to map following tables to a single class User. Is my mapping alright? Nowhere I specify that user_roles has a composite primary key. Will this work?




create table users (
user_name varchar(15) not null primary key,
user_pass varchar(15) not null
);

create table user_roles (
user_name varchar(15) not null,
role_name varchar(15) not null,
primary key (user_name, role_name)
);







Thanks,
Hello,

Could someone please explain me the concept of owning table? How is foreign key related to owning table?

Thanks for your help.
Hello Uttam,

Thanks for the reply. I was all the way looking in eclipse and was able to see freemarker jar in the lib folder of the web app in eclispe. When I deploy the application (through 'Add and Remove' server resources), the freemarker jar and javaassit jar are disappearing. I don't understand.

If I copy and paste the war file in deploy folder, the application deploys and runs fine.

Where am I going wrong in deploying the app? Is there are better approach to deploy applications?

9 years ago
Hello everybody,

I am trying to deploy struts 2.2.1 blank war onto JBOSS, but getting following errors. The application deploys and runs fine on Tomcat6.
Please help me figure out where I am going wrong. Thanks for your help in advance.

9 years ago
Hello,

I am trying to prepare for the beta exam (couldn't give up the opportunity to get certified for $50 ).

I am trying an example of async request processing. Copied the code from "examples" from Tomcat7. When I try to run this servlet, I am getting an IOException:


Exception:



type Exception report

message

description The server encountered an internal error () that prevented it from fulfilling this request.

exception

java.io.IOException: Socket error.
org.apache.catalina.connector.CoyoteAdapter.asyncDispatch(CoyoteAdapter.java:274)
org.apache.coyote.http11.Http11Processor.asyncDispatch(Http11Processor.java:340)
org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:267)
org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:260)
java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
java.lang.Thread.run(Thread.java:619)




Could somebody please explain what is going on?

Moderators,

If this is not the right forum for this question, please move to the appropriate one.

Thanks for help.

Hello,

I am relatively new to Java and have no experience in frameworks. I am trying to understand what it means to add/configure servlets/filters/listeners programmatically. Could somebody please give me a background of what it means, to get me started?

Your help is highly appreciated.

Thanks,
Hello Frits,

You are right. I have this message in the log.

SEVERE: Servlet.service() for servlet in context with path threw exception
java.lang.IllegalStateException: Cannot forward after response has been committed



Is this just tomcat specific behavior that it is displaying a part of the page instead of just showing the user the exception report?

Thanks for your help.
Hello Frits,

Thanks for the reply.

Frits Walraven wrote:
Don't get cheated by the page in your browser, because that will show an "a".



This is what I am seeing.

Frits Walraven wrote:
The "a" is sent before the error occurs (the error is not sent to your jsp)



What do you mean by "the error is not sent to your JSP"? I have a servlet here. Could you please elaborate? I am a bit confused.

Thanks,