Win a copy of Testing JavaScript Applications this week in the HTML Pages with CSS and JavaScript forum!

Ben Hagadorn

Greenhorn
+ Follow
since Mar 28, 2006
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 Ben Hagadorn

I have corrected the problem. It turned out to be the JDBC driver that I was using. Downloading the correct driver from microsoft fixed everything.
I am using Hibernate 3 with a SQLServer DB. I have a web app that I use to display/edit data. One of the tables that I'm updating has a varchar(8000) column and two int columns. I can retrieve rows where the size of this column is 3000+ characters (inserted using a different tool) and I can display them just fine on the web site. However, whenever I attempt to update this column via hibernate, hibernate goes out to lunch. 2000 characters saves fine, 2001 dies. The config file for this table defines the column as 8000 characters. Any ideas? Here is the error:

15:52:01,711 WARN [JDBCExceptionReporter] SQL Error: 0, SQLState: HY000
15:52:01,711 ERROR [JDBCExceptionReporter] [Microsoft][SQLServer JDBC Driver]The DBMS returned an unspecified error.
15:52:01,711 ERROR [AbstractFlushingEventListener] Could not synchronize database state with session
org.hibernate.exception.GenericJDBCException: could not update: [net.teamsms.gwac.hibernate.ServiceOffering#10934]
at org.hibernate.exception.SQLStateConverter.handledNonSpecificException(SQLStateConverter.java:82)
at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:70)
at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:43)
at org.hibernate.persister.entity.BasicEntityPersister.update(BasicEntityPersister.java:2000)
at org.hibernate.persister.entity.BasicEntityPersister.updateOrInsert(BasicEntityPersister.java:1909)
at org.hibernate.persister.entity.BasicEntityPersister.update(BasicEntityPersister.java:2149)
at org.hibernate.action.EntityUpdateAction.execute(EntityUpdateAction.java:75)
at org.hibernate.engine.ActionQueue.execute(ActionQueue.java:239)
at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:223)
at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:137)
at org.hibernate.event.def.AbstractFlushingEventListener.performExecutions(AbstractFlushingEventListener.java:274)
at org.hibernate.event.def.DefaultFlushEventListener.onFlush(DefaultFlushEventListener.java:27)
at org.hibernate.impl.SessionImpl.flush(SessionImpl.java:730)
at org.hibernate.impl.SessionImpl.managedFlush(SessionImpl.java:324)
at org.hibernate.transaction.JDBCTransaction.commit(JDBCTransaction.java:86)
at net.teamsms.gwac.DatabaseManager.saveOrUpdate(DatabaseManager.java:45)
at net.teamsms.gwac.struts.action.MaintainServiceOfferingDetailAction.save(MaintainServiceOfferingDetailAction.java:115)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:324)
at org.apache.struts.actions.DispatchAction.dispatchMethod(DispatchAction.java:274)
at org.apache.struts.actions.LookupDispatchAction.execute(LookupDispatchAction.java:160)
at org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:419)
at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:224)
at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1194)
at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:432)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:81)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
at org.jboss.web.tomcat.security.CustomPrincipalValve.invoke(CustomPrincipalValve.java:39)
at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:159)
at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:59)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:856)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:744)
at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
at org.apache.tomcat.util.net.MasterSlaveWorkerThread.run(MasterSlaveWorkerThread.java:112)
at java.lang.Thread.run(Thread.java:534)
Caused by: java.sql.SQLException: [Microsoft][SQLServer JDBC Driver]The DBMS returned an unspecified error.
at com.microsoft.jdbc.base.BaseExceptions.createException(Unknown Source)
at com.microsoft.jdbc.base.BaseExceptions.getException(Unknown Source)
at com.microsoft.jdbc.sqlserver.tds.TDSRequest.processReplyToken(Unknown Source)
at com.microsoft.jdbc.sqlserver.tds.TDSRPCRequest.processReplyToken(Unknown Source)
at com.microsoft.jdbc.sqlserver.tds.TDSRequest.processReply(Unknown Source)
at com.microsoft.jdbc.sqlserver.SQLServerImplStatement.getNextResultType(Unknown Source)
at com.microsoft.jdbc.base.BaseStatement.commonExecute(Unknown Source)
at com.microsoft.jdbc.base.BaseStatement.executeInternal(Unknown Source)
at com.microsoft.jdbc.base.BasePreparedStatement.execute(Unknown Source)
at com.microsoft.jdbc.base.BasePreparedStatement.executeUpdate(Unknown Source)
at org.hibernate.jdbc.NonBatchingBatcher.addToBatch(NonBatchingBatcher.java:22)
at org.hibernate.persister.entity.BasicEntityPersister.update(BasicEntityPersister.java:1982)
... 44 more
Merrill,

Thanks for the help! DownloadAction was exactly what I needed!
13 years ago
first, my apologies if STRUTS isn't the correct place to post this.

Here's my issue:

I have a web app that allows users to upload files to a directory under my deployment area. Then I have another page that displays links to these files that can be clicked so the uploaded documents can be viewed. The problem is that when I redeploy the app for any reason, the directory with the uploaded files gets blown away (since it resides in my deployment). What I'd like to do is upload these files to a place outside of my deployment so this does not happen. Assume that my web site is called MyApp and the directory where the files are going is called UploadedFiles

So now I have two issues:
1) how to specify the file path for where the uploaded files are saved. I currently derive this by using servletContext.getRealPath("UploadedFiles") but that won't give me what I need for a location outside my deployment.

2) how to derive a valid URL for the links I display on my JSP pages. I currently use "/MyAPP/UploadedFiles/<the file>". When the JSP page is rendered the link becomes http://localhost:8080/MyApp/UploadedFiles/<the file>.
13 years ago
We are in the process of migrating an application that uses JAAS from JBoss to BEA. I am having trouble getting the BEA deployment set up so that my custom login module is created and used correctly. I believe that I have done something wrong in the way I have set up permissions in my weblogic.policy file. Here's what I see:

To begin with, I am starting the weblogic server using a -D command that points to my login.config file:

-Djava.security.auth.login.config=${JAVA_HOME}/jre/lib/security/weblogic-login.config

I can then see that the server knows to use this file (and the custom loign module defined by that file) because the server echoes this out when it starts:

java.security.auth.login.config = /opt/bea/jdk142_08/jre/lib/security/weblogic-login.config
java.security.policy = /opt/bea/weblogic81/server/lib/weblogic.policy


So far, so good (I think). Now, when I open the security wide open in my weblogic.config file, my custom login module DOES get created and used by the application. However, I don't want the security as broad as this (I like to narrow it down to what I really need):

grant {
permission java.security.AllPermission;
};


So now I have begun to attempt to grant only those permissions that I really want:


grant {
permission java.lang.RuntimePermission "*";
permission java.io.FilePermission "${/}opt${/}bea${/}weblogic81${/}-", "read,write,delete";
permission java.io.FilePermission "${/}opt${/}bea${/}user_projects${/}domains${/}-", "read,write,delete";
permission java.io.FilePermission "${/}opt${/}bea${/}-", "read,write,delete";
permission java.io.FilePermission "${/}tmp${/}-", "read,write,delete";
permission java.util.PropertyPermission "*", "read";
permission java.net.SocketPermission "*", "connect";
permission javax.security.auth.AuthPermission "*";
permission java.security.auth.AuthPermission "*";
};


However, I now get this error when I attempt to create my custom login module:


ERROR [gov.va.med.logservice] No LoginModules configured for EelsLogin
javax.security.auth.login.LoginException: No LoginModules configured for EelsLogin
at javax.security.auth.login.LoginContext.init(LoginContext.java:189)
at javax.security.auth.login.LoginContext.<init>(LoginContext.java:404)
at gov.va.med.logService.struts.action.EelsLoginAction.execute(EelsLoginAction.java:87)
at org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:419)
at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:224)
at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1194)
at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:432)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:760)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at weblogic.servlet.internal.ServletStubImpl$ServletInvocationAction.run(ServletStubImpl.java:1072)
at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java:465)
at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java:348)
at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(WebAppServletContext.java:6981)
at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321)
at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:121)
at weblogic.servlet.internal.WebAppServletContext.invokeServlet(WebAppServletContext.java:3892)
at weblogic.servlet.internal.ServletRequestImpl.execute(ServletRequestImpl.java:2766)
at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:224)
at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:183)


Any ideas?

- Ben
13 years ago
I am migrating an existing web application from JBoss to BEA. There is code in the app that writes out a file to a location in the current deployment area -- for example: C:\Program Files\jboss-4.0.3SP1\server\default\.\deploy\EELSApp.ear\EELS.war\Report_Data_Sources\Result_92d5438b886f9f968a0b9976e399d552.xml.

This works just fine in JBoss but when I try to run it in BEA I get a file permission error. I've checked every conceivable permission and everything is read/write. Any ideas? Does BEA not allow you to create a file in the deployment area? If I change the code to write the file somewhere outside the deployment are it works just fine.

Thanks for the help.

- Ben
13 years ago
I have a servlet who's main purpose is to run a timed job that sends email to a list of recipients when certain error conditions occur (based upon checking a table in the DB). Included in this email is a link to a web page that the user can click on to view more details about the errors.

The issue that I'm having is that I'd like to be able to dynamically determine what the URL of the website is for the email message I send. The doGet() and doPost() are never used so I have no handle to a request object -- all I have is the ServletContext object from the init() event.

I realize that I could add a configuration parameter to the web.xml file and get it by calling servletContext.getInitParameter() but I'd rather not do that: this app could be installed on several servers and I don't want to have to change the web.xml file for each one.

Is there a way to get the URL info from the servletContext?

Thanks for the help.

- Ben
14 years ago
Merrill,

Thanks so much for your help - that did the trick!
14 years ago
Merrill,

Thanks so much for your help - that did the trick!
14 years ago
I am currently using Struts 1.2 in my application. Government regulations require that I comply with 508 accessibility rules, one of which is:

For each FORM control, place its label in a LABEL element. A LABEL is attached to a specific form control through the use of the "for" attribute. The value of the "for" attribute must be the same as the value of the "id" attribute of the form control.

For example:

<FORM action="http://somesite.com/foo"; method="get">
<LABEL for="name">Name:</LABEL><br/><INPUT type="text" id="name" SIZE="50">



I currently have code that looks like this:


<LABEL for="userName">User ID :</LABEL>
<html:text id="userName" property="userName" size="15"/>


Initially, this caused the following server error:
Attribute id invalid for tag text according to TLD

I then modified the struts-html.tld file and added this code to the <name>text</name> section:

<attribute><br/> <name>id</name>
<required>false</required>
<rtexprvalue>true</rtexprvalue>
</attribute>


this resolved the server error but when the page renders the resulting HTML does not have the ID tag:

<LABEL for="userName">User ID :</LABEL>
<input type="text" name="userName" size="15" value="" />


Can anyone help here? I need to find a way to get the final HTML to have an ID tag in it.

Thanks for the help.

- Ben Hagadorn
14 years ago
I have a table in my Oracle database called Location. This table has two fields: LocationID Int (key), and LocationName String. I also have a JMS queue that receives requests to process Location records. It is possible to have messages queue up that have the same Location, in which case when I process the first message I need to create/insert a new Location and when I process the subsequent messages I need to use the Location created from the first message. So far, so good.

What I'm seeing is that if I have multiple messages queued up for a Location that does not yet exist, they all end up being inserted as new Locations. I'm not sure if this is the result of the way JMS works (asynchronous message processing?) or the way I've set up my hibernate files.

As a test, I print out the matching Location record count when I start my processing for the JMS queue, and also when I end. For new Locations, this is what I expect to see:

2006-06-07 09:41:52,186 INFO [STDOUT] >>> LOCATION RECORD COUNT @ START: 0
2006-06-07 09:41:52,192 INFO [STDOUT] >>> LOCATION RECORD COUNT @ END: 1
2006-06-07 09:41:52,286 INFO [STDOUT] >>> LOCATION RECORD COUNT @ START: 1
2006-06-07 09:41:52,292 INFO [STDOUT] >>> LOCATION RECORD COUNT @ END: 1
2006-06-07 09:41:52,386 INFO [STDOUT] >>> LOCATION RECORD COUNT @ START: 1
2006-06-07 09:41:52,392 INFO [STDOUT] >>> LOCATION RECORD COUNT @ END: 1
2006-06-07 09:41:52,486 INFO [STDOUT] >>> LOCATION RECORD COUNT @ START: 1
2006-06-07 09:41:52,492 INFO [STDOUT] >>> LOCATION RECORD COUNT @ END: 1
2006-06-07 09:41:52,586 INFO [STDOUT] >>> LOCATION RECORD COUNT @ START: 1
2006-06-07 09:41:52,592 INFO [STDOUT] >>> LOCATION RECORD COUNT @ END: 1


When I have multiple messages on the queue with the same Location I get this:

2006-06-07 09:41:52,186 INFO [STDOUT] >>> LOCATION RECORD COUNT @ START: 0
2006-06-07 09:41:52,186 INFO [STDOUT] >>> LOCATION RECORD COUNT @ START: 0
2006-06-07 09:41:52,241 INFO [STDOUT] >>> LOCATION RECORD COUNT @ START: 0
2006-06-07 09:41:52,250 INFO [STDOUT] >>> LOCATION RECORD COUNT @ START: 0
2006-06-07 09:41:52,257 INFO [STDOUT] >>> LOCATION RECORD COUNT @ START: 0
2006-06-07 09:41:52,621 INFO [STDOUT] >>> LOCATION RECORD COUNT @ END: 1
2006-06-07 09:41:52,651 INFO [STDOUT] >>> LOCATION RECORD COUNT @ END: 1
2006-06-07 09:41:52,667 INFO [STDOUT] >>> LOCATION RECORD COUNT @ END: 1
2006-06-07 09:41:52,681 INFO [STDOUT] >>> LOCATION RECORD COUNT @ END: 1
2006-06-07 09:41:52,695 INFO [STDOUT] >>> LOCATION RECORD COUNT @ END: 1

I think I need a way to lock down the Location table while I'm processing Location records so that I can make sure new records are inserted and commited before other processes can insert duplicates.

Does anyone have any ideas how I can tackle this?

Thanks for the help.

- Ben
I have a table in my Oracle database called Location. This table has two fields: LocationID Int (key), and LocationName String. I also have a JMS queue that receives requests to process Location records. It is possible to have messages queue up that have the same Location, in which case when I process the first message I need to create/insert a new Location and when I process the subsequent messages I need to use the Location created from the first message. So far, so good.

What I'm seeing is that if I have multiple messages queued up for a Location that does not yet exist, they all end up being inserted as new Locations. I'm not sure if this is the result of the way JMS works (asynchronous message processing?) or the way I've set up my hibernate files.

As a test, I print out the matching Location record count when I start my processing for the JMS queue, and also when I end. For new Locations, this is what I expect to see:

2006-06-07 09:41:52,186 INFO [STDOUT] >>> LOCATION RECORD COUNT @ START: 0
2006-06-07 09:41:52,192 INFO [STDOUT] >>> LOCATION RECORD COUNT @ END: 1
2006-06-07 09:41:52,286 INFO [STDOUT] >>> LOCATION RECORD COUNT @ START: 1
2006-06-07 09:41:52,292 INFO [STDOUT] >>> LOCATION RECORD COUNT @ END: 1
2006-06-07 09:41:52,386 INFO [STDOUT] >>> LOCATION RECORD COUNT @ START: 1
2006-06-07 09:41:52,392 INFO [STDOUT] >>> LOCATION RECORD COUNT @ END: 1
2006-06-07 09:41:52,486 INFO [STDOUT] >>> LOCATION RECORD COUNT @ START: 1
2006-06-07 09:41:52,492 INFO [STDOUT] >>> LOCATION RECORD COUNT @ END: 1
2006-06-07 09:41:52,586 INFO [STDOUT] >>> LOCATION RECORD COUNT @ START: 1
2006-06-07 09:41:52,592 INFO [STDOUT] >>> LOCATION RECORD COUNT @ END: 1


When I have multiple messages on the queue with the same Location I get this:

2006-06-07 09:41:52,186 INFO [STDOUT] >>> LOCATION RECORD COUNT @ START: 0
2006-06-07 09:41:52,186 INFO [STDOUT] >>> LOCATION RECORD COUNT @ START: 0
2006-06-07 09:41:52,241 INFO [STDOUT] >>> LOCATION RECORD COUNT @ START: 0
2006-06-07 09:41:52,250 INFO [STDOUT] >>> LOCATION RECORD COUNT @ START: 0
2006-06-07 09:41:52,257 INFO [STDOUT] >>> LOCATION RECORD COUNT @ START: 0
2006-06-07 09:41:52,621 INFO [STDOUT] >>> LOCATION RECORD COUNT @ END: 1
2006-06-07 09:41:52,651 INFO [STDOUT] >>> LOCATION RECORD COUNT @ END: 1
2006-06-07 09:41:52,667 INFO [STDOUT] >>> LOCATION RECORD COUNT @ END: 1
2006-06-07 09:41:52,681 INFO [STDOUT] >>> LOCATION RECORD COUNT @ END: 1
2006-06-07 09:41:52,695 INFO [STDOUT] >>> LOCATION RECORD COUNT @ END: 1

I think I need a way to lock down the Location table while I'm processing Location records so that I can make sure new records are inserted and commited before other processes can insert duplicates.

Does anyone have any ideas how I can tackle this?

Thanks for the help.

- Ben
Got it. This is what I needed to do:


Add entries to my ejb-jar.xml file:

<env-entry>
<env-entry-name>SMTPMailServer</env-entry-name>
<env-entry-type>java.lang.String</env-entry-type>
<env-entry-value>internalmail.ourcompany.com</env-entry-value>
</env-entry>


Add code to my MessageDrivenBean:

String SMTPMailServer = (String)ctx.lookup("java:comp/env/SMTPMailServer");
I need a way to retrieve some intialization parameters for my MessageDrivenBean. If this was a servlet I would put the info into the web.xml file and then call servletContext.getInitParameter("X") where "X" was the name of my parameter in web.xml. Is there a comparable place to store these types of parameters for a MessageDrivenBean and what method do I call to get them?

Thanks for the help.

- Ben
I got it. I needed to add redirect="true" to my struts.config file
14 years ago