Chandan Ghosh

Greenhorn
+ Follow
since Jun 13, 2005
Merit badge: grant badges
For More
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 Chandan Ghosh

Hi guys,

I am facing a problem. please help me out.

I have one MDB listening Queue for incoming messages. This MDB is CONTAINER managed transaction with NOT_SUPPORTED attribute.
When MDB is invoked on arrival of any message, it invokes another @Stateless session bean (SignatureDAO) method and the method is interacting with JPA EntityManager. But it is giving some error.

The @Stateless session bean (SignatureDAO) is CONTAINER managed transaction with MANDATORY attributes.

Can anyone please point me out what is the mistake?

Exception stack trace is below:

javax.ejb.EJBAccessException: [EJB:010160]Security Violation: User: 'anonymous' has insufficient permission to access EJB: type=<ejb>, application=FIH1_elardel2, module=common.jar, ejb=SignatureDAO, method=checkSignatureStatus, methodInterface=Remote, signature={int,int}..

javax.ejb.EJBAccessException: [EJB:010160]Security Violation: User: 'anonymous' has insufficient permission to access EJB: type=<ejb>, application=FIH1_elardel2, module=common.jar, ejb=SignatureDAO, method=checkSignatureStatus, methodInterface=Remote, signature={int,int}.

at weblogic.ejb.container.internal.MethodDescriptor.checkMethodPermissionsBusiness(MethodDescriptor.java:586)
at weblogic.ejb.container.internal.BaseRemoteObject.checkMethodPermissions(BaseRemoteObject.java:112)
at weblogic.ejb.container.internal.BaseRemoteObject.preInvoke(BaseRemoteObject.java:272)
at weblogic.ejb.container.internal.StatelessRemoteObject.preInvoke(StatelessRemoteObject.java:52)
Hi,

This case, you have to use the Java Network APIs...
Use URL & URLConnection to call a servlet and read from servlet's output...
---------------------------------------------------------------------
String url = "http://www.abc.com/servlet/TestServlet?Name=Chandan";
URL testServlet = new URL( url );
URLConnection servletConnection = testServlet.openConnection();
inputStreamFromServlet = servletConnection.getInputStream();

// Now read the input from the servlet.
. . .
----------------------------------------------------------------------
15 years ago
Did you do the servlet configuration in web.xml file? Please check the below..
Put the servlet entry in web.xml and user servlet mapping for your servlet as "/servlet/HelloServlet"

<servlet>
<servlet-name>HelloServlet</servlet-name>
<servlet-class>foo.HelloServlet</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>HelloServlet</servlet-name>
<uri-pattern>/servlet/HelloServlet</uri-pattern>
</servlet-mapping>
15 years ago
Can you please give some more details like your download servelt etc?
15 years ago
I am not sure but are you ensured about only one message listener thread pool in the application server because only one message listener thread pool can exists per application server and all listener port in the server will use thread from this pool.
specify your primary key class in ejb-jar.xml file like
<prim-key-class>foo.SimpleIdKey</prim-key-class>

and in your ejbCreate() method, extract the property called 'phone'(if caller generates the pk) from primary key object and map it to the desired column in your SQL INSERT statement.

public foo.SimpleIdKey ejbCreate(foo.SimpleIdKey pk,String sure,String flag )
throws javax.ejb.CreateException{

String sql = "INSERT INTO T_HKM_SISTEMPARAMETRELERI VALUES (?,?,?)";
try
{
PreparedStatement stmt = this.getConnection().prepareStatement(sql);
stmt.setString(1,pk.getPhone());
stmt.setString(2,sure);
stmt.setString(3,flag);
ResultSet rs = stmt.executeQuery();
this.releaseConnection();
}
catch(SQLException ex)
{
throw new CreateException();
}

return pk;
}
JMS
Try to give more details of your problem like problem scenario some code to help us understand your problem.
15 years ago
Hey,

I just run your code using HttpClient 3.1. and it working absolutely fine. I didnt get any such exceptions....

I changed nothing except the url of the post method action.
15 years ago
I would prefer your first idea.
I would write a simple web application to get status report of the batch process which will be running in the same container as web app without adding extra layer of RMI overhead.


~
Chandan
15 years ago

Originally posted by kajal mukergi:
this is my code



here i am getting the _destinationLocation value from .properties file

as C:\xyz this fine for window..
and working fine here
but in UNIX it is failing as
the directory stucture is.. "./xyx"
so my code is breaking
can any one tell how to handle..

or how to diferentiate whether it is unix or window os



Hi,

Use File.separator instead of hard coded string which will enable your code to run in both env.

for (String file : files) {
File destinationLocation = new File(_destinationLocation);
String _destpath = destinationLocation.getPath();
_destpath += File.separator;

_destpath += file;
}
15 years ago

Originally posted by kajal mukergi:
this is my code



here i am getting the _destinationLocation value from .properties file

as C:\xyz this fine for window..
and working fine here
but in UNIX it is failing as
the directory stucture is.. "./xyx"
so my code is breaking
can any one tell how to handle..

or how to diferentiate whether it is unix or window os

15 years ago

Originally posted by Javabuddy for u:
Hi Chandan,

First of congrats for your excellent score
I am also preparing for SCJP
Can you briefly tell us your whole process of preparation



Basically I first completed reading the book "Sun Certified Programmer and Developer for Java 2 Study Guide (Exams 310-035 and 310-027)" twice and practiced chapter-end questions. It enhanced the knowledge on the language and secondly I practiced almost 300 to 400 questions from various sites.
16 years ago
Hi Ranchers,

I passed the exam with 100% score. Thanks all the members for your help and supports.

Thanks,
Chandan
16 years ago
I have one doubt of a question as follows...

Q Does the calling of setPriority() method cause a thread to stop executing??
Can anyone please tell me why is SFSB allowed to open transaction across methods calls??
And can you take up a scenario where we might want to do this?