Diogo Gonzaga

Greenhorn
+ Follow
since Nov 04, 2008
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 Diogo Gonzaga

Thank you very much!!
10 years ago
How can I iterate an enum and show the value of the property.

I have an object which has an enum field, but I can't show the value (or name) of the enum restored by the database to that object.

I have tried the following in my jsp



Thanks
10 years ago
Hi everybody,

I'm looking for an introductory SOA book. Does anyone have one for indication?

Thank you!
11 years ago
"select object(o) from Item as o where o.ITEMNAME='TeddyBear'"

Try again and it would be solved.
When I try to get parameter "name" as req.getRequestParameter("name") I don't see any result, just null.

When I try to read by InputStream I get the full string (i.e name=diogo).

With method get I receive it correctly.

Whey is it happen??
11 years ago
I've been developed an application in j2me that send parameters (via POST) to a servlet. But these parameters don't have being recognized by this one (servlet).

J2me code:

HttpConnection http = null;
OutputStream os = null;
InputStream in = null;
boolean ret = false;

String url = "http://localhost:8080/corej2me1/Teste.do";

try {

http = (HttpConnection) Connector.open(url, Connector.READ_WRITE);
http.setRequestMethod(HttpConnection.POST);

http.setRequestProperty("User-Agent",
"Profile/MIDP-1.0 Confirguration/CLDC-1.0");
http.setRequestProperty("Content-Language", "en-CA");
// send input
String str = "name=182016";
http.setRequestProperty("Content-Length", "" + str.length());
http.setRequestProperty("Connection", "close");
http.setRequestProperty("Content-Type",
"application/x-www-form-urlencoded");

os = http.openOutputStream();
byte postmsg[] = str.getBytes();
for (int i = 0; i < postmsg.length; i++) {
os.write(postmsg[i]);
}
os.flush();

os.close();


SERVLET CODE:

public void doPost(HttpServletRequest req, HttpServletResponse resp)
throws ServletException, IOException {

// InputStream s = req.getInputStream();
// BufferedReader bis = new BufferedReader(new InputStreamReader(s));
//
// String str;
// while ((str = bis.readLine()) != null) {
// System.out.println(str);
// }

Enumeration enume = req.getHeaderNames();
while (enume.hasMoreElements()) {
String str2 = enume.nextElement().toString();
System.out.println(str2 + " : " + req.getHeader(str2));
}
//
// Enumeration enume2 = req.getParameterNames();
// while(enume2.hasMoreElements()) {
// String str2 = enume2.nextElement().toString();
// System.out.println(str + " : " + req.getParameter(str));
// }
//
System.out.println(req.getParameter("name"));

}

can anybody help me to solve this problem?

Thanks a lot.
11 years ago
Nothing about XML or deployment descriptor.
11 years ago
Yesterday I passed on SCBCD with 80%.

I used the following materials:

EJB 3 in Action (book)
Mikalai Zaikin study guide
EJB 3 core and persistence specification (read it if you want to get details)
Enthuware simulator
Whizlabs simulator

My next objective is the SCMAD.
11 years ago
I'm trying to deploy a MessageListener, but i get this error. What is that?

23:22:08,996 INFO [JmsActivation] Attempting to reconnect org.jboss.resource.adapter.jms.inflow.JmsActivationSpec@dea6bc(ra=org.jboss.resource.adapter.jms.JmsResourceAdapter@1ffb2eb destination=jms/ShippingRequestQueue isTopic=false tx=true durable=false reconnect=10 provider=java:/DefaultJMSProvider user=null maxMessages=1 minSession=1 maxSession=15 keepAlive=60000 useDLQ=true DLQHandler=org.jboss.resource.adapter.jms.inflow.dlq.GenericDLQHandler DLQJndiName=queue/DLQ DLQUser=null DLQMaxResent=0)
23:22:09,007 ERROR [JmsActivation] Unable to reconnect org.jboss.resource.adapter.jms.inflow.JmsActivationSpec@dea6bc(ra=org.jboss.resource.adapter.jms.JmsResourceAdapter@1ffb2eb destination=jms/ShippingRequestQueue isTopic=false tx=true durable=false reconnect=10 provider=java:/DefaultJMSProvider user=null maxMessages=1 minSession=1 maxSession=15 keepAlive=60000 useDLQ=true DLQHandler=org.jboss.resource.adapter.jms.inflow.dlq.GenericDLQHandler DLQJndiName=queue/DLQ DLQUser=null DLQMaxResent=0)
javax.naming.NameNotFoundException: jms not bound
at org.jnp.server.NamingServer.getBinding(NamingServer.java:529)
at org.jnp.server.NamingServer.getBinding(NamingServer.java:537)
at org.jnp.server.NamingServer.getObject(NamingServer.java:543)
at org.jnp.server.NamingServer.lookup(NamingServer.java:267)
at sun.reflect.GeneratedMethodAccessor87.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:294)
at sun.rmi.transport.Transport$1.run(Transport.java:153)
at java.security.AccessController.doPrivileged(Native Method)
at sun.rmi.transport.Transport.serviceCall(Transport.java:149)
at sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:466)
at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:707)
at java.lang.Thread.run(Thread.java:595)
at sun.rmi.transport.StreamRemoteCall.exceptionReceivedFromServer(StreamRemoteCall.java:247)
at sun.rmi.transport.StreamRemoteCall.executeCall(StreamRemoteCall.java:223)
at sun.rmi.server.UnicastRef.invoke(UnicastRef.java:126)
at org.jnp.server.NamingServer_Stub.lookup(Unknown Source)
at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:625)
at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:587)
at javax.naming.InitialContext.lookup(InitialContext.java:351)
at org.jboss.util.naming.Util.lookup(Util.java:215)
at org.jboss.resource.adapter.jms.inflow.JmsActivation.setupDestination(JmsActivation.java:399)
at org.jboss.resource.adapter.jms.inflow.JmsActivation.setup(JmsActivation.java:306)
at org.jboss.resource.adapter.jms.inflow.JmsActivation.handleFailure(JmsActivation.java:250)
at org.jboss.resource.adapter.jms.inflow.JmsActivation$SetupActivation.run(JmsActivation.java:593)
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)

-------------
My class is:


@MessageDriven(name = "ShippingRequestProcessor", activationConfig = {
@ActivationConfigProperty(propertyName = "destinationType", propertyValue = "javax.jms.Queue"),
@ActivationConfigProperty(propertyName = "destination", propertyValue = "jms/ShippingRequestQueue") })
public class ShippingRequestProcessorMDB implements MessageListener {
private Connection connection;

private DataSource dataSource;

@Resource
private MessageDrivenContext context;

@Resource(name = "jdbc/TurtleDS", mappedName = "java:/DefaultDS")
public void setDataSource(DataSource dataSource) {
this.dataSource = dataSource;
}

@PostConstruct
public void initialize() {
try {
connection = dataSource.getConnection();
} catch (SQLException sqle) {
sqle.printStackTrace();
}
}

@PreDestroy
public void cleanup() {
try {
connection.close();
connection = null;
} catch (SQLException sqle) {
sqle.printStackTrace();
}
}

public void onMessage(Message message) {
try {
ObjectMessage objectMessage = (ObjectMessage) message;
ShippingRequest shippingRequest = (ShippingRequest) objectMessage
.getObject();
processShippingRequest(shippingRequest);
System.out.println("Shipping request processed.");
} catch (JMSException jmse) {
jmse.printStackTrace();
context.setRollbackOnly();
} catch (SQLException sqle) {
sqle.printStackTrace();
context.setRollbackOnly();
}
}

Anybody can give me a hint to solve this?
I'm trying to deploy a MessageListener, but i get this error. What is that?

23:22:08,996 INFO [JmsActivation] Attempting to reconnect org.jboss.resource.adapter.jms.inflow.JmsActivationSpec@dea6bc(ra=org.jboss.resource.adapter.jms.JmsResourceAdapter@1ffb2eb destination=jms/ShippingRequestQueue isTopic=false tx=true durable=false reconnect=10 provider=java:/DefaultJMSProvider user=null maxMessages=1 minSession=1 maxSession=15 keepAlive=60000 useDLQ=true DLQHandler=org.jboss.resource.adapter.jms.inflow.dlq.GenericDLQHandler DLQJndiName=queue/DLQ DLQUser=null DLQMaxResent=0)
23:22:09,007 ERROR [JmsActivation] Unable to reconnect org.jboss.resource.adapter.jms.inflow.JmsActivationSpec@dea6bc(ra=org.jboss.resource.adapter.jms.JmsResourceAdapter@1ffb2eb destination=jms/ShippingRequestQueue isTopic=false tx=true durable=false reconnect=10 provider=java:/DefaultJMSProvider user=null maxMessages=1 minSession=1 maxSession=15 keepAlive=60000 useDLQ=true DLQHandler=org.jboss.resource.adapter.jms.inflow.dlq.GenericDLQHandler DLQJndiName=queue/DLQ DLQUser=null DLQMaxResent=0)
javax.naming.NameNotFoundException: jms not bound
at org.jnp.server.NamingServer.getBinding(NamingServer.java:529)
at org.jnp.server.NamingServer.getBinding(NamingServer.java:537)
at org.jnp.server.NamingServer.getObject(NamingServer.java:543)
at org.jnp.server.NamingServer.lookup(NamingServer.java:267)
at sun.reflect.GeneratedMethodAccessor87.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:294)
at sun.rmi.transport.Transport$1.run(Transport.java:153)
at java.security.AccessController.doPrivileged(Native Method)
at sun.rmi.transport.Transport.serviceCall(Transport.java:149)
at sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:466)
at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:707)
at java.lang.Thread.run(Thread.java:595)
at sun.rmi.transport.StreamRemoteCall.exceptionReceivedFromServer(StreamRemoteCall.java:247)
at sun.rmi.transport.StreamRemoteCall.executeCall(StreamRemoteCall.java:223)
at sun.rmi.server.UnicastRef.invoke(UnicastRef.java:126)
at org.jnp.server.NamingServer_Stub.lookup(Unknown Source)
at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:625)
at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:587)
at javax.naming.InitialContext.lookup(InitialContext.java:351)
at org.jboss.util.naming.Util.lookup(Util.java:215)
at org.jboss.resource.adapter.jms.inflow.JmsActivation.setupDestination(JmsActivation.java:399)
at org.jboss.resource.adapter.jms.inflow.JmsActivation.setup(JmsActivation.java:306)
at org.jboss.resource.adapter.jms.inflow.JmsActivation.handleFailure(JmsActivation.java:250)
at org.jboss.resource.adapter.jms.inflow.JmsActivation$SetupActivation.run(JmsActivation.java:593)
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)

-------------
My class is:


@MessageDriven(name = "ShippingRequestProcessor", activationConfig = {
@ActivationConfigProperty(propertyName = "destinationType", propertyValue = "javax.jms.Queue"),
@ActivationConfigProperty(propertyName = "destination", propertyValue = "jms/ShippingRequestQueue") })
public class ShippingRequestProcessorMDB implements MessageListener {
private Connection connection;

private DataSource dataSource;

@Resource
private MessageDrivenContext context;

@Resource(name = "jdbc/TurtleDS", mappedName = "java:/DefaultDS")
public void setDataSource(DataSource dataSource) {
this.dataSource = dataSource;
}

@PostConstruct
public void initialize() {
try {
connection = dataSource.getConnection();
} catch (SQLException sqle) {
sqle.printStackTrace();
}
}

@PreDestroy
public void cleanup() {
try {
connection.close();
connection = null;
} catch (SQLException sqle) {
sqle.printStackTrace();
}
}

public void onMessage(Message message) {
try {
ObjectMessage objectMessage = (ObjectMessage) message;
ShippingRequest shippingRequest = (ShippingRequest) objectMessage
.getObject();
processShippingRequest(shippingRequest);
System.out.println("Shipping request processed.");
} catch (JMSException jmse) {
jmse.printStackTrace();
context.setRollbackOnly();
} catch (SQLException sqle) {
sqle.printStackTrace();
context.setRollbackOnly();
}
}
[ December 14, 2008: Message edited by: Diogo Gonzaga ]
Reza,

I've been removed interfaces classes from war and now it works fine.
Thank you for your tip.

Reza,

I'm using EJB3 in Action example in this case.
I do it. Now, just interfaces are the same classes in the jar and war packages and the problem persists.

I have no idea.
When I use @Stateless EJB my application run correctly, but with @Stateful I get this error:

20:37:36,361 ERROR [STDERR] java.lang.ClassCastException: $Proxy169
20:37:36,362 ERROR [STDERR] at web.ejb3inaction.actionbazaar.client.PlaceOrderClient.doGet(PlaceOrderClient.java:25)
20:37:36,362 ERROR [STDERR] at javax.servlet.http.HttpServlet.service(HttpServlet.java:697)
20:37:36,362 ERROR [STDERR] at javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
20:37:36,362 ERROR [STDERR] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
20:37:36,362 ERROR [STDERR] at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
20:37:36,362 ERROR [STDERR] at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
20:37:36,362 ERROR [STDERR] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
20:37:36,362 ERROR [STDERR] at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
20:37:36,362 ERROR [STDERR] at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
20:37:36,362 ERROR [STDERR] at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
20:37:36,362 ERROR [STDERR] at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:175)
20:37:36,362 ERROR [STDERR] at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:74)
20:37:36,362 ERROR [STDERR] at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
20:37:36,362 ERROR [STDERR] at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
20:37:36,362 ERROR [STDERR] at org.jboss.web.tomcat.tc5.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:156)
20:37:36,362 ERROR [STDERR] at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
20:37:36,362 ERROR [STDERR] at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
20:37:36,363 ERROR [STDERR] at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:869)
20:37:36,363 ERROR [STDERR] at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:664)
20:37:36,363 ERROR [STDERR] at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
20:37:36,363 ERROR [STDERR] at org.apache.tomcat.util.net.MasterSlaveWorkerThread.run(MasterSlaveWorkerThread.java:112)
20:37:36,363 ERROR [STDERR] at java.lang.Thread.run(Thread.java:595)

Any idea?
[ December 12, 2008: Message edited by: Diogo Gonzaga ]
I've been declared an init-parameter on DD for a jsp page, but it does not work. It is in the following:

<servlet>
<jsp-file>/pages/teste_param.jsp</jsp-file>

<init-param>
<param-name>teste</param-name>
<param-value>ola mundo</param-value>
</init-param>
</servlet>

in jsp:

<%!String s = null;
public void jspInit() {
ServletConfig sConfig = getServletConfig();

String s = sConfig.getInitParameter("teste");

}
%>

<%
out.print(s);
%>

what's wrong?