[JBoss Portal] - invoque a Servlet into a portlet
by khadijbal
I want to use a servlet for the downalding of a file PDF, I tried to call it since my portlet with the following code ( in doView() method ):
public void doView(RenderRequest req, RenderResponse rep)
| {
| rep.setContentType("text/html");
| String titre = (String) req.getParameter("titreformation");
| if (title !=null)
| {
| HttpServletRequest request = null;
| HttpServletResponse reponse = null;
| request.setAttribute("title", title);
| try {
| RequestDispatcher d = (RequestDispatcher) getPortletContext().getRequestDispatcher(
| "/MyServlet");
| d.include(request, reponse);
| } catch (ServletException se) {
| System.out.print se);
| }
|
| }
but i have the following error:
Cause: java.lang.ClassCastException: org.jboss.portal.portlet.impl.jsr168.api.PortletRequestDispatcherImpl
| Message: org.jboss.portal.portlet.impl.jsr168.api.PortletRequestDispatcherImpl
| StackTrace:
| java.lang.ClassCastException: org.jboss.portal.portlet.impl.jsr168.api.PortletRequestDispatcherImpl
| at portal.portlets.PListeFormation.doView(Unknown Source)
| at javax.portlet.GenericPortlet.doDispatch(GenericPortlet.java:133)
| at javax.portlet.GenericPortlet.render(GenericPortlet.java:306)
| at org.jboss.portal.portlet.impl.jsr168.PortletContainerImpl.invokeRender(PortletContainerImpl.java:483)
Someone can help me please
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4155642#4155642
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4155642
16 years, 4 months
[Installation, Configuration & DEPLOYMENT] - Re: Incomplete deployment - DataSourceBinding- JBOSS 4.2.2 +
by July Pyrra
Thanks for your precisions. I read the documentation to configure JBoss, it seems it never ends, I always discover new things to do.
So now, I have the famous mysql-ds.xml that I added to JBOSSHOME/server/myapp/deploy as follow:
<datasources>
| <local-tx-datasource>
| <jndi-name>cuoreds</jndi-name>
| <connection-url>jdbc:mysql://localhost:3306/cuore</connection-url>
| <driver-class>com.mysql.jdbc.Driver</driver-class>
| <user-name>root</user-name>
| <password>123456</password> <exception-sorter-class-name>org.jboss.resource.adapter.jdbc.vendor.MySQLExceptionSorter</exception-sorter-class-name>
| <new-connection-sql>cuore</new-connection-sql>
| <!-- corresponding type-mapping in the standardjbosscmp-jdbc.xml -->
| <metadata>
| <type-mapping>mySQL</type-mapping>
| </metadata>
| </local-tx-datasource>
| </datasources>
Then I had an error of jbdc driver, so I dowloaded it , put the sqljdbc.jar in JBOSSHOME/server/myapp/lib, added it in the BUILDPATH in Eclipse and added it in the deploy folder, even if I'm not sure it's really useful.
Then I did the same with the mysql-connector-java-5.0.8-bin.jar.
But it still doesn't work...:´( Here is the log
2008-06-04 13:28:03,583 DEBUG [org.jboss.util.NestedThrowable] org.jboss.util.NestedThrowable.detectDuplicateNesting=true
2008-06-04 13:28:03,583 WARN [org.jboss.resource.connectionmanager.JBossManagedConnectionPool] Throwable while attempting to get a new connection: null
org.jboss.resource.JBossResourceException: Could not create connection; - nested throwable: (com.mysql.jdbc.exceptions.MySQLSyntaxErrorException: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'cuore' at line 1)
at org.jboss.resource.adapter.jdbc.local.LocalManagedConnectionFactory.createManagedConnection(LocalManagedConnectionFactory.java:179)
at org.jboss.resource.connectionmanager.InternalManagedConnectionPool.createConnectionEventListener(InternalManagedConnectionPool.java:577)
at org.jboss.resource.connectionmanager.InternalManagedConnectionPool.getConnection(InternalManagedConnectionPool.java:262)
at org.jboss.resource.connectionmanager.JBossManagedConnectionPool$BasePool.getConnection(JBossManagedConnectionPool.java:500)
at org.jboss.resource.connectionmanager.BaseConnectionManager2.getManagedConnection(BaseConnectionManager2.java:341)
at org.jboss.resource.connectionmanager.TxConnectionManager.getManagedConnection(TxConnectionManager.java:315)
at org.jboss.resource.connectionmanager.BaseConnectionManager2.allocateConnection(BaseConnectionManager2.java:396)
at org.jboss.resource.connectionmanager.BaseConnectionManager2$ConnectionManagerProxy.allocateConnection(BaseConnectionManager2.java:842)
at org.jboss.resource.adapter.jdbc.WrapperDataSource.getConnection(WrapperDataSource.java:88)
at org.hibernate.ejb.connection.InjectedDataSourceConnectionProvider.getConnection(InjectedDataSourceConnectionProvider.java:47)
at org.hibernate.cfg.SettingsFactory.buildSettings(SettingsFactory.java:84)
at org.hibernate.cfg.Configuration.buildSettings(Configuration.java:2009)
at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1292)
at org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Configuration.java:713)
at org.hibernate.ejb.HibernatePersistence.createContainerEntityManagerFactory(HibernatePersistence.java:127)
at org.jboss.ejb3.entity.PersistenceUnitDeployment.start(PersistenceUnitDeployment.java:246)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
...
and tons of lines.
It also says me this at the end:
Caused by: org.hibernate.HibernateException: Hibernate Dialect must be explicitly set
I'm lost and desperate...
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4155641#4155641
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4155641
16 years, 4 months
[Persistence, JBoss/CMP, Hibernate, Database] - Issue with persistence | No inserts/updates statements getti
by agup10
Context
I have a session scoped seam component from where I am invoking a method persistUserFund() in domain layer.
Seam version: 2.0.1.GA
Problem Statement
The method persistUserFund() does not fire an inserts/updates/deletes and the data is not peristed into theoracle database
Problem Explanation
The method in domain layer has the following code block. I am using session.flush to flush the session so that the inserts/updates/deletes could get fired.
persistUserFund() {
Session session = getSession();
Block block = userfund.removeBlock();
session.flush();
userfund.setMainBlock(block);
session.flush();
}
I tried executing the above method using TestNG and the method executes successfully generating inserts/updates statements.
However, from the session scoped seam component, no inserts/updates/deletes are generated.
I have tried using Conversation.changeFlushMode(FlushModeType.MANUAL); at the start of the method in seam component and Conversation.changeFlushMode(FlushModeType.AUTO); at the end of the seam component. But even this did not help.
Could someone provide any insights to help me solve this problem?
Thanks in Advance
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4155625#4155625
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4155625
16 years, 4 months